" Keybindings let mapleader=";" " use ;; for escape " http://vim.wikia.com/wiki/Avoid_the_escape_key inoremap ;; " horizontal split with new buffer nnoremap bh :new " vertical split with new buffer nnoremap bv :vnew " improved keyboard navigation nnoremap h h nnoremap j j nnoremap k k nnoremap l l " improved keyboard support for navigation (especially terminal) " http://neovim.io/doc/user/nvim_terminal_emulator.html tnoremap tnoremap h tnoremap j tnoremap k tnoremap l nnoremap h nnoremap j nnoremap k nnoremap l if !exists('g:vscode') " Auto start NERD tree when opening a directory autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | wincmd p | endif " Auto start NERD tree if no files are specified autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | exe 'NERDTree' | endif " Let quit work as expected if after entering :q the only window left open is NERD Tree itself autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " Shortcut to edit THIS configuration file: (e)dit (c)onfiguration nnoremap ec :e $MYVIMRC " Shortcut to source (reload) THIS configuration file after editing it: (s)ource (c)onfiguraiton nnoremap sc :source $MYVIMRC " Toggle NERDTree " Can't get by itself to work, so this works as Ctrl - space - space " https://github.com/neovim/neovim/issues/3101 " http://stackoverflow.com/questions/7722177/how-do-i-map-ctrl-x-ctrl-o-to-ctrl-space-in-terminal-vim#answer-24550772 "nnoremap :NERDTreeToggle "nmap nnoremap :NERDTreeToggle " toggle tagbar nnoremap tb :TagbarToggle " toggle line numbers nnoremap n :set number! number? " toggle line wrap nnoremap w :set wrap! wrap? " toggle buffer (switch between current and last buffer) nnoremap bb " go to next buffer nnoremap bn :bn nnoremap :bn " go to previous buffer nnoremap bp :bp " https://github.com/neovim/neovim/issues/2048 nnoremap :bp " close buffer nnoremap bd :bd " kill buffer nnoremap bk :bd! " list buffers nnoremap bl :ls " list and select buffer nnoremap bg :ls:buffer " TELESCOPE " Find files using Telescope command-line sugar. nnoremap ff Telescope find_files nnoremap fg Telescope live_grep " Maps display of current buffers nnoremap Telescope buffers nnoremap fb Telescope buffers nnoremap fh Telescope help_tags " Telescope project nnoremap fp :Telescope project " Start terminal in insert mode " au BufEnter * if &buftype == 'terminal' | :startinsert | endif " nnoremap tt :terminal " nnoremap tv :vnew:terminal " nnoremap th :new:terminal " tnoremap q let s:hidden_all = 0 function! ToggleHiddenAll() if s:hidden_all == 0 let s:hidden_all = 1 set noshowmode set noruler set laststatus=0 set noshowcmd TagbarClose NERDTreeClose else let s:hidden_all = 0 set showmode set ruler set laststatus=2 set showcmd NERDTree " NERDTree takes focus, so move focus back to the right " (note: "l" is lowercase L (mapped to moving right) wincmd l TagbarOpen endif endfunction " nnoremap h :call ToggleHiddenAll() nnoremap :FloatermNew --height=0.4 --width=0.98 --wintype=floating --position=bottom --autoclose=2 --title= tnoremap :FloatermNew --height=0.4 --width=0.98 --wintype=floating --position=bottom --autoclose=2 --title= nnoremap :FloatermPrev tnoremap :FloatermPrev nnoremap :FloatermNext tnoremap :FloatermNext inoremap :FloatermToggle nnoremap :FloatermToggle tnoremap :FloatermToggle tnoremap nnoremap :FloatermSend vnoremap :FloatermSend " Automatic formatting for Julia files autocmd FileType julia nnoremap :JuliaFormatterFormat " Maps quit noremap q :q " Maps quit all noremap :qa " Maps write nnoremap w :w end