Replace various vim mappings with the noremap kind
This commit is contained in:
parent
8a6b0197e6
commit
e5580826b9
109
vimrc
109
vimrc
|
@ -332,14 +332,14 @@ if &term =~ '256color'
|
|||
endif
|
||||
|
||||
" Disable arrow keys.
|
||||
map <up> <nop>
|
||||
map <down> <nop>
|
||||
map <left> <nop>
|
||||
map <right> <nop>
|
||||
imap <up> <nop>
|
||||
imap <down> <nop>
|
||||
imap <left> <nop>
|
||||
imap <right> <nop>
|
||||
noremap <up> <nop>
|
||||
noremap <down> <nop>
|
||||
noremap <left> <nop>
|
||||
noremap <right> <nop>
|
||||
inoremap <up> <nop>
|
||||
inoremap <down> <nop>
|
||||
inoremap <left> <nop>
|
||||
inoremap <right> <nop>
|
||||
|
||||
"---------------------------------------------------------------
|
||||
" Load vimrc.private
|
||||
|
@ -505,7 +505,7 @@ augroup campoCmds
|
|||
" Only allow one instance of ctags to run in this directory at any given time.
|
||||
let l:lock_file = "ctags.lock"
|
||||
if filereadable(l:lock_file) || filereadable("newtags")
|
||||
call PrintError("ctags already running (found ".l:lock_file." or newtags file)")
|
||||
" Don't print a warning because this will always show when saving multiple files at the same time with a :wa or :xa
|
||||
return
|
||||
endif
|
||||
|
||||
|
@ -606,26 +606,25 @@ augroup END
|
|||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Mapping ESC in insert mode and command mode to double i.
|
||||
imap jj <Esc>
|
||||
"cmap ii <Esc>
|
||||
|
||||
" Suspend vim process and return to the shell. Can return to vim with `fg`.
|
||||
nmap <leader>z <c-z>
|
||||
nnoremap <leader>z <c-z>
|
||||
|
||||
" Open the vimrc file for editing / reload vimrc file.
|
||||
nmap <silent> <leader>ev :vsp $MYVIMRC<cr>
|
||||
nmap <silent> <leader>pv :vsp ~/.vimrc.private<cr>
|
||||
nmap <silent> <leader>rv :source $MYVIMRC<cr>
|
||||
nnoremap <silent> <leader>ev :vsp $MYVIMRC<cr>
|
||||
nnoremap <silent> <leader>pv :vsp ~/.vimrc.private<cr>
|
||||
nnoremap <silent> <leader>rv :source $MYVIMRC<cr>
|
||||
|
||||
" Type %/ in the command bar to have it replaced with the current buffer's
|
||||
" path if the file is on disk. One thing I noticed is that you have to type
|
||||
" the full %/ quickly otherwise it won't replace it.
|
||||
:cmap %/ %:p:h/
|
||||
cmap %/ %:p:h/
|
||||
|
||||
" Remap saving and quiting.
|
||||
nmap <leader>w :w!<cr>
|
||||
nmap <leader>q :q<cr>
|
||||
nmap <leader>qq :q!<cr>
|
||||
nmap <leader>x :x<cr>
|
||||
nnoremap <leader>w :w!<cr>
|
||||
nnoremap <leader>q :q<cr>
|
||||
nnoremap <leader>qq :q!<cr>
|
||||
nnoremap <leader>x :x<cr>
|
||||
:ca Wa wa!
|
||||
:ca WA wa!
|
||||
:ca WQ wq
|
||||
|
@ -640,11 +639,11 @@ command! Q q " Bind :Q to :q
|
|||
command! Qall qall
|
||||
command! Qa qall
|
||||
" Disable Ex mode.
|
||||
map Q <Nop>
|
||||
noremap Q <Nop>
|
||||
|
||||
" Open a terminal within vim. Use `exit` to close it.
|
||||
if exists(':terminal')
|
||||
map <leader>t :terminal<cr>
|
||||
noremap <leader>t :terminal<cr>
|
||||
tnoremap <leader>e <C-\><C-n>
|
||||
tnoremap <A-h> <C-\><C-n><C-w>h
|
||||
tnoremap <A-j> <C-\><C-n><C-w>j
|
||||
|
@ -657,10 +656,10 @@ if exists(':terminal')
|
|||
endif
|
||||
|
||||
" Jump to other buffers.
|
||||
map <c-k> <c-w><Up>
|
||||
map <c-j> <c-w><Down>
|
||||
map <c-l> <c-w><Right>
|
||||
map <c-h> <c-w><Left>
|
||||
noremap <c-k> <c-w><Up>
|
||||
noremap <c-j> <c-w><Down>
|
||||
noremap <c-l> <c-w><Right>
|
||||
noremap <c-h> <c-w><Left>
|
||||
|
||||
" Make it easier to jump around the command line. The default behaviour is
|
||||
" using the arrow keys with or without shift.
|
||||
|
@ -669,40 +668,38 @@ map <c-h> <c-w><Left>
|
|||
|
||||
" Window splitting - couldn't figure out how to remap <c-w>v & <c-w>n to <c-m>
|
||||
" & <c-n>
|
||||
map <leader>m :vsplit<cr>
|
||||
map <leader>mm :split<cr>
|
||||
noremap <leader>m :vsplit<cr>
|
||||
noremap <leader>mm :split<cr>
|
||||
|
||||
" Forward delete and replace a word.
|
||||
map <leader>d ciw
|
||||
noremap <leader>d ciw
|
||||
|
||||
" Allow fast pasting by accessing the system clipboard register.
|
||||
map <leader>p "+p
|
||||
" Likely won't need to use this if pasting with <leader>p, but just in case
|
||||
" here ya go.
|
||||
map <leader>pp :set paste! paste?<cr>
|
||||
noremap <leader>p "+p
|
||||
" Likely won't need to use this if pasting with <leader>p, but just in case here ya go.
|
||||
noremap <leader>pp :set paste! paste?<cr>
|
||||
|
||||
map <leader>o :set number! number?<cr>
|
||||
" Toggle line numbers.
|
||||
noremap <leader>o :set number! number?<cr>
|
||||
|
||||
" Show spell checking.
|
||||
" @note: you can add new entries to the dict by moving the cursor over the
|
||||
" word and pressing `zg`.
|
||||
map <leader>j :exec &spell==&spell? "se spell! spelllang=en_us" : "se spell!"<cr>
|
||||
map <leader>= z=
|
||||
" You can add new entries to the dict by moving the cursor over the word and pressing `zg`.
|
||||
noremap <leader>j :exec &spell==&spell? "se spell! spelllang=en_us" : "se spell!"<cr>
|
||||
noremap <leader>= z=
|
||||
|
||||
" Clear the search buffer (highlighting) when hitting return.
|
||||
function! MapCR()
|
||||
nnoremap <cr> :nohlsearch<cr>
|
||||
endfunction
|
||||
call MapCR()
|
||||
nnoremap <cr> :nohlsearch<cr>
|
||||
|
||||
" Switch to the previous file.
|
||||
nnoremap <leader><leader> <c-^>
|
||||
|
||||
" Replace currently selected text with default register without yanking it.
|
||||
vnoremap p "_dP
|
||||
|
||||
" Switch between C++ source and header files.
|
||||
map <leader>v :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
|
||||
"map <leader>vv :e %:p:s,.h$,.X123X,:s,.c$,.h,:s,.X123X$,.c,<CR>
|
||||
"map <leader>vvv :e %:p:s,.h$,.X123X,:s,.cc$,.h,:s,.X123X$,.cc,<CR>
|
||||
noremap <leader>v :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
|
||||
"noremap <leader>vv :e %:p:s,.h$,.X123X,:s,.c$,.h,:s,.X123X$,.c,<CR>
|
||||
"noremap <leader>vvv :e %:p:s,.h$,.X123X,:s,.cc$,.h,:s,.X123X$,.cc,<CR>
|
||||
|
||||
" Replace all instances of the highlighted text with whatever you enter.
|
||||
nnoremap <c-g> :%s///g<left><left>
|
||||
|
@ -772,9 +769,9 @@ noremap <F12> :TagbarToggle<cr>
|
|||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
let g:gitgutter_enabled = 1
|
||||
let g:gitgutter_highlight_lines = 0
|
||||
nmap <leader>ha <Plug>GitGutterStageHunk
|
||||
nmap <leader>hh :GitGutterToggle<cr>
|
||||
nmap [h <Plug>GitGutterNextHunk
|
||||
nnoremap <leader>hh :GitGutterToggle<cr>
|
||||
nmap <leader>ha <Plug>(GitGutterStageHunk)
|
||||
nmap [h <Plug>(GitGutterNextHunk)
|
||||
nmap ]h <Plug>GitGutterPrevHunk
|
||||
|
||||
augroup gitGutterPluginCmds
|
||||
|
@ -824,7 +821,7 @@ let g:rg_window_height = g:quickfix_pane_height
|
|||
" ctrl-o = ask how to open a file search result.
|
||||
" ctrl-p | ctrl-n = traverse search history.
|
||||
|
||||
map <leader>g :CtrlP<cr>
|
||||
noremap <leader>g :CtrlP<cr>
|
||||
let g:ctrlp_map = '<leader>f'
|
||||
let g:ctrlp_cmd = 'CtrlPTag' " Search tags by default.
|
||||
let g:ctrlp_by_filename = 1 " File search by filename as opposed to full path.
|
||||
|
@ -846,7 +843,7 @@ let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standar
|
|||
" GIT
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
map <leader>gb :Git blame -w<cr>
|
||||
noremap <leader>gb :Git blame -w<cr>
|
||||
" Ignore whitespace changes; follow renames and copies.
|
||||
command! -bar -bang -nargs=* Blame :Git blame<bang> -wCM <args>
|
||||
command! -bar -bang -nargs=* Gblame :Git blame<bang> -wCM <args>
|
||||
|
@ -968,8 +965,8 @@ exec "autocmd ColorScheme " . g:campo_dark_theme . " call ReloadRainbow()"
|
|||
exec "autocmd ColorScheme " . g:campo_light_theme . " call ReloadRainbow()"
|
||||
|
||||
" Switch between light and dark themes.
|
||||
map <leader>l :call ChangeBgTheme('light', 0)<cr>
|
||||
map <leader>ll :call ChangeBgTheme('dark', 0)<cr>
|
||||
noremap <leader>l :call ChangeBgTheme('light', 0)<cr>
|
||||
noremap <leader>ll :call ChangeBgTheme('dark', 0)<cr>
|
||||
|
||||
function! ChangeBgTheme(bg, onlySetTheme)
|
||||
if a:bg =~ 'light'
|
||||
|
@ -1160,11 +1157,11 @@ function! Search(case_sensitive, search_args)
|
|||
endfunction
|
||||
|
||||
" Case insensitive
|
||||
map <leader>s :call Search(0, g:campo_custom_search_args)<cr>
|
||||
noremap <leader>s :call Search(0, g:campo_custom_search_args)<cr>
|
||||
noremap <F2> :call Search(0, g:campo_custom_search_args_2)<cr>
|
||||
|
||||
" Case sensitive
|
||||
map <leader>ss :call Search(1, g:campo_custom_search_args)<cr>
|
||||
noremap <leader>ss :call Search(1, g:campo_custom_search_args)<cr>
|
||||
noremap <F3> :call Search(1, g:campo_custom_search_args_2)<cr>
|
||||
|
||||
" Navigation for the vim-ripgrep search results.
|
||||
|
@ -1233,8 +1230,8 @@ function! GlobalReplaceIt(confirm_replacement) range
|
|||
call PrintError("Unable to search since you're not in a git repo!")
|
||||
endif
|
||||
endfunction
|
||||
map <leader>r :call GlobalReplaceIt(0)<cr>
|
||||
map <leader>rr :call GlobalReplaceIt(1)<cr>
|
||||
noremap <leader>r :call GlobalReplaceIt(0)<cr>
|
||||
noremap <leader>rr :call GlobalReplaceIt(1)<cr>
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
@ -1249,7 +1246,7 @@ function! RenameFile()
|
|||
redraw!
|
||||
endif
|
||||
endfunction
|
||||
map <leader>n :call RenameFile()<cr>
|
||||
noremap <leader>n :call RenameFile()<cr>
|
||||
|
||||
"---------------------------------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user