julia-vim
julia-vim copied to clipboard
Add wiki page with neovim config to send commands etc.?
Hi,
I've made a quick and dirty config to send commands and lines to a julia terminal (see below). Wanted to ask, if there is an interest to put it into a wiki page. It's not perfect but seems to work well and may help others getting started. It also may help me insofar as others who have more such (neo)vim experience give comments and/or refine the config. Tested in the console (iTerm2) and with VimR.
Here the relevant snippets from my 'init.vim' config file:
""" misc
Plug 'JuliaLang/julia-vim'
Plug 'kassio/neoterm'
let maplocalleader = "-"
autocmd FileType julia setlocal shiftwidth=4 foldmethod=indent tabstop=4 softtabstop=4
""" julia-vim
let g:default_julia_version = "devel"
""" neoterm
" -- config (not sure if I keep c-h, c-k window navigation remap)
let g:neoterm_position = 'horizontal'
autocmd BufWinEnter,WinEnter term://* startinsert
:tnoremap <C-h> <C-\><C-n><C-w>h
:tnoremap <C-k> <C-\><C-n><C-w>k
" -- commands and send (shortcuts partly based on Nvim-R - quick and dirty)
" - *t*erminal (julia only starts with the first send command)
nnoremap <silent> <localleader>tn :Tnew<cr>
nnoremap <silent> <localleader>to :Topen<cr>
nnoremap <silent> <localleader>tc :Tclose<cr>
" - *c*lear, *c*trl-c, workspace *c*ommand
nnoremap <silent> <localleader>cl :call neoterm#clear()<cr>
nnoremap <silent> <localleader>cc :call neoterm#kill()<cr>
nnoremap <silent> <localleader>cw :call neoterm#do("workspace()")<cr>
" - show *j*ulia @doc, show(info)
nnoremap <silent> <localleader>jd :call neoterm#do("@doc " . expand("<cword>"))<cr>
nnoremap <silent> <localleader>je :call neoterm#do("@edit " . expand("<cword>"))<cr>
nnoremap <silent> <localleader>ji :call neoterm#do(expand("<cword>"))<cr>
" - send *a*ll, i.e. file
nnoremap <silent> <localleader>aa :w<cr>:call neoterm#do("include(\"%\")")<cr>
nnoremap <silent> <localleader>ae :w<cr>:TREPLSendFile<cr>
" - send *p*aragraph (cursor location changes)
nnoremap <silent> <localleader>pp vip:TREPLSendLine<cr><esc>
nnoremap <silent> <localleader>pd vip:TREPLSendLine<cr><esc>}
" - send *s*election (cursor location changes)
vnoremap <silent> <localleader>ss :TREPLSendSelection<cr>
vnoremap <silent> <localleader>sd :TREPLSendSelection<cr>j
" - send *l*ine, optionally go *d*own, *q*uickly continue editing...
nnoremap <silent> <localleader>l :TREPLSendLine<cr>
nnoremap <silent> <localleader>d :TREPLSendLine<cr>j
nnoremap <silent> <localleader>q :TREPLSendLine<cr>i