Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wiki page with neovim config to send commands etc.? #97

Open
swissr opened this issue Feb 9, 2017 · 0 comments
Open

Add wiki page with neovim config to send commands etc.? #97

swissr opened this issue Feb 9, 2017 · 0 comments

Comments

@swissr
Copy link
Contributor

swissr commented Feb 9, 2017

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant