Move existing mappings into new file
Simply take all the mappings and move them to one big new file.
This commit is contained in:
parent
8798642c61
commit
66f33b8f74
2 changed files with 187 additions and 170 deletions
|
|
@ -541,174 +541,8 @@ endfunction
|
|||
" use :ShowMaps to call the function
|
||||
com! ShowMaps call s:ShowMaps() " Enable :ShowMaps to call the function
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" split buffers vertically/horizontally with the leader \ or - (mirrors my
|
||||
" tmux setup)
|
||||
nnoremap <leader>- :sp<cr>
|
||||
nnoremap <leader>\ :vsp<cr>
|
||||
|
||||
" move around between matching brackets with tab
|
||||
nnoremap <tab> %
|
||||
nnoremap <tab> %
|
||||
|
||||
" Spell check set to <leader>O, 'o' for 'orthography':
|
||||
noremap <leader>O :setlocal spell! spelllang=en_us<CR>
|
||||
noremap <leader>OE :setlocal spell! spelllang=en_us<CR>
|
||||
noremap <leader>OG :setlocal spell! spelllang=de_de<CR>
|
||||
noremap <leader>o z=
|
||||
|
||||
" select the whole buffer with <leader>-a
|
||||
nnoremap <leader>a ggVG
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp $MYVIMRC<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source $MYVIMRC<cr>
|
||||
|
||||
" since u undoes, would it not make sense that U redoes?
|
||||
nnoremap U <C-r>
|
||||
|
||||
" when in insertion mode, C-u uppercases the current word, C-l lowercases it,
|
||||
inoremap <C-u> <esc>gUiw`]a
|
||||
inoremap <C-l> <esc>guiw`]a
|
||||
|
||||
" get rid of the help message popping up when I miss esc and hit F1
|
||||
nnoremap <F1> <ESC>
|
||||
inoremap <F1> <ESC>
|
||||
vnoremap <F1> <ESC>
|
||||
|
||||
" yank filename to f buffer
|
||||
nnoremap yf :let @f = expand("%")<cr>
|
||||
|
||||
" remove all trailing whitespaces
|
||||
" on pressing space+W
|
||||
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
|
||||
" automatically on saving
|
||||
" autocmd BufWritePre * :%s/\s\+$//e
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" open/close NERDtree with leader-e
|
||||
" whatever method tree has been opened by, leader-e closes it again
|
||||
nnoremap <leader>e :NERDTreeToggle<CR>
|
||||
" open root of current VCS project in tree
|
||||
nnoremap <leader><C-e> :NERDTreeVCS<CR>
|
||||
" open current nerdtree with current file highlighted
|
||||
nnoremap <leader>E :NERDTreeFind<CR>
|
||||
|
||||
" vim-go mappings - will only activate in go files
|
||||
" most of this credit to https://hackernoon.com/my-neovim-setup-for-go-7f7b6e805876
|
||||
" switch between test file and function
|
||||
au Filetype go nnoremap <leader>ga <Plug>(go-alternate-edit)
|
||||
" switch between test file and function - in a horizontal/vertical split
|
||||
au Filetype go nnoremap <leader>gah <Plug>(go-alternate-split)
|
||||
au Filetype go nnoremap <leader>gav <Plug>(go-alternate-vertical)
|
||||
" run a test (but run it as short version, in case tests are tagged
|
||||
" accordingly)
|
||||
au FileType go nnoremap <F10> :GoTest -short<cr>
|
||||
" show/hide code coverage of go file
|
||||
au FileType go nnoremap <F9> :GoCoverageToggle -short<cr>
|
||||
" To get the documentation of whatever you are hovering over press K (to go
|
||||
" back C-t) -- this is enabled by default and needs no bind
|
||||
" go to the definition of whatever you hover over
|
||||
au FileType go nnoremap <F12> <Plug>(go-def)
|
||||
|
||||
" Configure notational-fzf-vim
|
||||
let g:nv_search_paths = [ g:wiki_root ]
|
||||
let g:nv_wrap_preview_text=1
|
||||
" Dictionary with string keys and values. Must be in the form 'ctrl-KEY':
|
||||
" 'command' or 'alt-KEY' : 'command'. See examples below.
|
||||
let g:nv_fzf_binds = [
|
||||
\ 'alt-a:select-all',
|
||||
\ 'alt-q:deselect-all',
|
||||
\ 'alt-p:toggle-preview',
|
||||
\ 'alt-u:page-up',
|
||||
\ 'alt-d:page-down',
|
||||
\ 'ctrl-w:backward-kill-word',
|
||||
\ ]
|
||||
|
||||
|
||||
" Markdown & Pandoc compilation group
|
||||
" the commented out command can be used if vim-rmarkdown plugin is not
|
||||
" installed (it is a bit more brittle)
|
||||
" autocmd FileType rmd noremap <F10> :!echo<space>"require(rmarkdown);<space>render('<c-r>%')"<space>\|<space>R<space>--vanilla<enter>
|
||||
" Compile with rmarkdown
|
||||
" autocmd FileType markdown,rmarkdown noremap <leader>c :RMarkdown pdf<cr>
|
||||
" autocmd FileType markdown,rmarkdown noremap <leader>C :RMarkdown! pdf<cr>
|
||||
|
||||
function! SearchWiki()
|
||||
let l:curpath=getcwd()
|
||||
:execute(":cd " . g:wiki_root)
|
||||
let l:texttofind=input("Search in Notes: ")
|
||||
:execute(":CtrlSF " . l:texttofind)
|
||||
:CtrlSFFocus
|
||||
:execute(":cd " . l:curpath)
|
||||
endfunction
|
||||
|
||||
" search in wiki with ctrlsf, in fullscreen window
|
||||
nnoremap <leader>wf :execute(":call SearchWiki()")<cr>
|
||||
|
||||
" FUZZY FINDING
|
||||
" FZF buffers and files in current workdir
|
||||
noremap <leader>s :FzfBuffers<cr>
|
||||
" FZF most recently used / MRU, bound to S since it is essentially a larger
|
||||
" go-back intention than just buffers
|
||||
noremap <leader>S :FzfHistory<cr>
|
||||
noremap <leader>f :FzfFiles<cr>
|
||||
|
||||
" use wiki.vim to look through document outlines in fzf (only for note
|
||||
" directory atm)
|
||||
nnoremap <leader>l :WikiFzfToc<cr>
|
||||
|
||||
" FZF general full-text search in cwd with rg
|
||||
noremap <leader>F :FzfRg<cr>
|
||||
" FZF note full-text search with notational-velocity like functions (in wiki
|
||||
" directory)
|
||||
noremap <leader>n :NV<cr>
|
||||
noremap <leader>N :NV!<cr>
|
||||
|
||||
" FZF git diff
|
||||
noremap <leader>gd :FzfGFiles?<cr>
|
||||
|
||||
" FZF colorschemes
|
||||
nnoremap <leader><F8> :FzfColors<cr>
|
||||
" Toggle background light/dark
|
||||
call togglebg#map("<F8>")
|
||||
|
||||
" Mostly dealing with Prose writing from here on out
|
||||
" Format current Paragraph (esp useful in prose writing)
|
||||
nnoremap <silent> <leader>q gqap
|
||||
xnoremap <silent> <leader>q gq
|
||||
nnoremap <silent> <leader>Q vapJgqap
|
||||
|
||||
" Enter distraction free prose mode with F11
|
||||
noremap <F11> :Goyo<CR>
|
||||
|
||||
" surround stuff with quotes, from normal or visual mode
|
||||
nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
|
||||
vnoremap <leader>" <esc>`<i"<esc>`>la"<esc>l
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
" Begin mapping definitions
|
||||
runtime! **/maps.vim
|
||||
|
||||
" }}}
|
||||
" ABBREVIATIONS {{{
|
||||
|
|
@ -721,8 +555,9 @@ iabbrev whit with
|
|||
iabbrev whith with
|
||||
|
||||
" Text expansion
|
||||
iabbrev @e@ marty.oehme@gmail.com
|
||||
iabbrev ccopy Copyright 2019 Marty Oehme, all rights reserved.
|
||||
iabbrev mo@ marty.oehme@gmail.com
|
||||
iabbrev mo.me@ <https://martyoeh.me/>
|
||||
iabbrev mcc@ Copyright 2019 Marty Oehme, all rights reserved.
|
||||
|
||||
"
|
||||
" }}}
|
||||
|
|
|
|||
182
.config/nvim/maps.vim
Normal file
182
.config/nvim/maps.vim
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
" The general ideas behind these mappings:
|
||||
"
|
||||
" * Leader prefix is the generally preferred way to map new things, however
|
||||
" only for those that affect all of vim
|
||||
"
|
||||
" * Localleader prefix is used for mappings which only affect single buffers,
|
||||
" in other words mostly filetype specific mappings
|
||||
"
|
||||
" many of these mapping ideas come from Tom Ryder who has them nicely
|
||||
" documented
|
||||
|
||||
" backspace to switch to alternate (last) buffer
|
||||
nnoremap <BS> <C-^>
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" split buffers vertically/horizontally with the leader \ or - (mirrors my
|
||||
" tmux setup)
|
||||
nnoremap <leader>- :sp<cr>
|
||||
nnoremap <leader>\ :vsp<cr>
|
||||
|
||||
" move around between matching brackets with tab
|
||||
nnoremap <tab> %
|
||||
nnoremap <tab> %
|
||||
|
||||
" Spell check set to <leader>O, 'o' for 'orthography':
|
||||
noremap <leader>O :setlocal spell! spelllang=en_us<CR>
|
||||
noremap <leader>OE :setlocal spell! spelllang=en_us<CR>
|
||||
noremap <leader>OG :setlocal spell! spelllang=de_de<CR>
|
||||
noremap <leader>o z=
|
||||
|
||||
" select the whole buffer with <leader>-a
|
||||
nnoremap <leader>a ggVG
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp $MYVIMRC<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source $MYVIMRC<cr>
|
||||
|
||||
" since u undoes, would it not make sense that U redoes?
|
||||
nnoremap U <C-r>
|
||||
|
||||
" when in insertion mode, C-u uppercases the current word, C-l lowercases it,
|
||||
inoremap <C-u> <esc>gUiw`]a
|
||||
inoremap <C-l> <esc>guiw`]a
|
||||
|
||||
" get rid of the help message popping up when I miss esc and hit F1
|
||||
nnoremap <F1> <ESC>
|
||||
inoremap <F1> <ESC>
|
||||
vnoremap <F1> <ESC>
|
||||
|
||||
" yank filename to f buffer
|
||||
nnoremap yf :let @f = expand("%")<cr>
|
||||
|
||||
" remove all trailing whitespaces
|
||||
" on pressing space+W
|
||||
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
|
||||
" automatically on saving
|
||||
" autocmd BufWritePre * :%s/\s\+$//e
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" open/close NERDtree with leader-e
|
||||
" whatever method tree has been opened by, leader-e closes it again
|
||||
nnoremap <leader>e :NERDTreeToggle<CR>
|
||||
" open root of current VCS project in tree
|
||||
nnoremap <leader><C-e> :NERDTreeVCS<CR>
|
||||
" open current nerdtree with current file highlighted
|
||||
nnoremap <leader>E :NERDTreeFind<CR>
|
||||
|
||||
" vim-go mappings - will only activate in go files
|
||||
" most of this credit to https://hackernoon.com/my-neovim-setup-for-go-7f7b6e805876
|
||||
" switch between test file and function
|
||||
au Filetype go nnoremap <leader>ga <Plug>(go-alternate-edit)
|
||||
" switch between test file and function - in a horizontal/vertical split
|
||||
au Filetype go nnoremap <leader>gah <Plug>(go-alternate-split)
|
||||
au Filetype go nnoremap <leader>gav <Plug>(go-alternate-vertical)
|
||||
" run a test (but run it as short version, in case tests are tagged
|
||||
" accordingly)
|
||||
au FileType go nnoremap <F10> :GoTest -short<cr>
|
||||
" show/hide code coverage of go file
|
||||
au FileType go nnoremap <F9> :GoCoverageToggle -short<cr>
|
||||
" To get the documentation of whatever you are hovering over press K (to go
|
||||
" back C-t) -- this is enabled by default and needs no bind
|
||||
" go to the definition of whatever you hover over
|
||||
au FileType go nnoremap <F12> <Plug>(go-def)
|
||||
|
||||
" Configure notational-fzf-vim
|
||||
let g:nv_search_paths = [ g:wiki_root ]
|
||||
let g:nv_wrap_preview_text=1
|
||||
" Dictionary with string keys and values. Must be in the form 'ctrl-KEY':
|
||||
" 'command' or 'alt-KEY' : 'command'. See examples below.
|
||||
let g:nv_fzf_binds = [
|
||||
\ 'alt-a:select-all',
|
||||
\ 'alt-q:deselect-all',
|
||||
\ 'alt-p:toggle-preview',
|
||||
\ 'alt-u:page-up',
|
||||
\ 'alt-d:page-down',
|
||||
\ 'ctrl-w:backward-kill-word',
|
||||
\ ]
|
||||
|
||||
|
||||
" Markdown & Pandoc compilation group
|
||||
" the commented out command can be used if vim-rmarkdown plugin is not
|
||||
" installed (it is a bit more brittle)
|
||||
" autocmd FileType rmd noremap <F10> :!echo<space>"require(rmarkdown);<space>render('<c-r>%')"<space>\|<space>R<space>--vanilla<enter>
|
||||
" Compile with rmarkdown
|
||||
" autocmd FileType markdown,rmarkdown noremap <leader>c :RMarkdown pdf<cr>
|
||||
" autocmd FileType markdown,rmarkdown noremap <leader>C :RMarkdown! pdf<cr>
|
||||
|
||||
function! SearchWiki()
|
||||
let l:curpath=getcwd()
|
||||
:execute(":cd " . g:wiki_root)
|
||||
let l:texttofind=input("Search in Notes: ")
|
||||
:execute(":CtrlSF " . l:texttofind)
|
||||
:CtrlSFFocus
|
||||
:execute(":cd " . l:curpath)
|
||||
endfunction
|
||||
|
||||
" search in wiki with ctrlsf, in fullscreen window
|
||||
nnoremap <leader>wf :execute(":call SearchWiki()")<cr>
|
||||
|
||||
" FUZZY FINDING
|
||||
" FZF buffers and files in current workdir
|
||||
noremap <leader>s :FzfBuffers<cr>
|
||||
" FZF most recently used / MRU, bound to S since it is essentially a larger
|
||||
" go-back intention than just buffers
|
||||
noremap <leader>S :FzfHistory<cr>
|
||||
noremap <leader>f :FzfFiles<cr>
|
||||
|
||||
" use wiki.vim to look through document outlines in fzf (only for note
|
||||
" directory atm)
|
||||
nnoremap <leader>l :WikiFzfToc<cr>
|
||||
|
||||
" FZF general full-text search in cwd with rg
|
||||
noremap <leader>F :FzfRg<cr>
|
||||
" FZF note full-text search with notational-velocity like functions (in wiki
|
||||
" directory)
|
||||
noremap <leader>n :NV<cr>
|
||||
noremap <leader>N :NV!<cr>
|
||||
|
||||
" FZF git diff
|
||||
noremap <leader>gd :FzfGFiles?<cr>
|
||||
|
||||
" FZF colorschemes
|
||||
nnoremap <leader><F8> :FzfColors<cr>
|
||||
" Toggle background light/dark
|
||||
call togglebg#map("<F8>")
|
||||
|
||||
" Mostly dealing with Prose writing from here on out
|
||||
" Format current Paragraph (esp useful in prose writing)
|
||||
nnoremap <silent> <leader>q gqap
|
||||
xnoremap <silent> <leader>q gq
|
||||
nnoremap <silent> <leader>Q vapJgqap
|
||||
|
||||
" Enter distraction free prose mode with F11
|
||||
noremap <F11> :Goyo<CR>
|
||||
|
||||
" surround stuff with quotes, from normal or visual mode
|
||||
nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
|
||||
vnoremap <leader>" <esc>`<i"<esc>`>la"<esc>l
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
Loading…
Add table
Add a link
Reference in a new issue