Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kdheepak/startup.jl
https://github.com/kdheepak/startup.jl
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kdheepak/startup.jl
- Owner: kdheepak
- License: mit
- Created: 2023-08-04T00:44:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-24T14:37:08.000Z (about 1 year ago)
- Last Synced: 2024-10-15T16:51:41.942Z (2 months ago)
- Language: Julia
- Size: 119 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Startup
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://kdheepak.github.io/Startup.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://kdheepak.github.io/Startup.jl/dev/)
[![Build Status](https://github.com/kdheepak/Startup.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/kdheepak/Startup.jl/actions/workflows/CI.yml?query=branch%3Amain)## Julia tips and tricks
Based on [@mroavi's configuration](https://github.com/mroavi/dotfiles/blob/2d1f6d05515153b3616f5384faf85e2d406a6e26/julia/.julia/config/tips-and-tricks.md).
### Open file in stacktrace
In the REPL, enter the stacktrace number followed by Ctrl+q
```julia
julia> map("hola")
Stacktrace:
[1] map(f::String)
@ Base ./abstractarray.jl:2859
[2] top-level scope
@ REPL[15]:1
julia> 1
```### List of Handy Macros
```julia
@edit
@debug [key=value | value ...]
```To enable @debug messages, you need to set the JULIA_DEBUG environment var:
```julia
julia> ENV["JULIA_DEBUG"] = "all"
```### View Code at different Compiling Stages
```julia
@code_lowered
@code_typed
@code_llvm
@code_native@code_warntype
```### Methods Available
Write a function in the REPL with the opening parenthesis and type Tab
Another option is to use the `@which` macro:
```julia
@which
```You can also query Julia to output all methods that take a certain type of
argument with:```julia
methodswith(typ[, module or function]; supertypes::Bool=false])
```### REPL History
Type the beginning of a command and type Ctrl+p to browse
through all commands in history that begin with the same chars. For example:```julia
julia> ENV
```completes to:
```julia
julia> ENV["JULIA_DEBUG"] = "all"
```With OhMyREPL, type Ctrl+R in the REPL to start FZF to
filter the REPL History### REPL apropos
Search available docstrings for entries containing pattern. When pattern is a
string, case is ignored. Results are printed to io.```julia
apropos([io::IO=stdout], pattern::Union{AbstractString,Regex})
```### Debugger
```
julia> using Debugger # import the julia debugger
julia> @enter # run in debugger mode
debug> ? # list the help to see all debugger available cmds
debug> ` # go to julia mode keeping the backtrace (backspace to leave)
|julia> print(x) # print the content of `x`
|julia> x = 2 # assign the value 2 to `x`
```### Search Documentation
Search available docstrings for entries containing `pattern` with the `apropos`
function. See ?aproposREPL help mode understands regex, e.g., enter r"^has" to get all methods
starting with "has".### Disabling auto-indentation of code in Julia REPL
Source:
Consists of overwriting `REPL.LineEdit.options` method to make sure that we
always use `REPL.GlobalOptions` with auto-indentation disabled.Useful when using **onthefly** for live-coding presentations.
```julia
import REPL
REPL.GlobalOptions.auto_indent = false
REPL.LineEdit.options(s::REPL.LineEdit.PromptState) = REPL.GlobalOptions
```