mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 16:41:43 +05:30
- Accommodating Ideavimrc with Jetbrains quirks
- VIM: New useful keymaps created - VIM: Config refactored for better portability to many NVim distros - NVim: Trials with LSP Autocompletion failed :(
This commit is contained in:
@@ -36,28 +36,49 @@ nnoremap N Nzzzv
|
||||
vnoremap J :m '>+1<CR>gv=gv
|
||||
vnoremap K :m '<-2<CR>gv=gv
|
||||
|
||||
" Better indenting
|
||||
vnoremap < <gv
|
||||
vnoremap > >gv
|
||||
xnoremap < <gv
|
||||
xnoremap > >gv
|
||||
|
||||
" Keeps the cursor at the same place when doing J
|
||||
" And not move to end of the line
|
||||
nnoremap J mzJ`z:delmarks z<CR>
|
||||
|
||||
" Better Up/Down
|
||||
nnoremap j gj
|
||||
xnoremap j gj
|
||||
nnoremap k gk
|
||||
xnoremap k gk
|
||||
|
||||
" Better window/split navigation
|
||||
map <C-j> <C-w>j
|
||||
map <C-k> <C-w>k
|
||||
map <C-h> <C-w>h
|
||||
map <C-l> <C-w>l
|
||||
|
||||
" Clear searches
|
||||
nnoremap <leader>/ :call clearmatches()<CR>:noh<CR>
|
||||
" Navigate buffers
|
||||
nnoremap <Tab> :bnext<CR>
|
||||
nnoremap <S-Tab> :bprevious<CR>
|
||||
|
||||
" Changes the pwd to the opened file's directory
|
||||
nnoremap <leader>cd :lcd %:h<CR>
|
||||
" Resize window using <ctrl> arrow keys
|
||||
nnoremap <C-Up> :resize +2<CR>
|
||||
nnoremap <C-Down> :resize -2<CR>
|
||||
nnoremap <C-Left> :vertical resize -2<CR>
|
||||
nnoremap <C-Right> :vertical resize +2<CR>
|
||||
|
||||
" Map easymotion Plugin to <Leader>j
|
||||
map <leader>j <Plug>(easymotion-s)
|
||||
" Saner search n & N
|
||||
nnoremap <expr> n 'Nn'[v:searchforward]
|
||||
xnoremap <expr> n 'Nn'[v:searchforward]
|
||||
onoremap <expr> n 'Nn'[v:searchforward]
|
||||
nnoremap <expr> N 'nN'[v:searchforward]
|
||||
xnoremap <expr> N 'nN'[v:searchforward]
|
||||
onoremap <expr> N 'nN'[v:searchforward]
|
||||
|
||||
" Map nerdtree to <Leader>e
|
||||
" Changes the pwd and opens the VCS root
|
||||
nnoremap <leader>e :tcd %:h<CR> :NERDTreeToggleVCS<CR>
|
||||
" Clear search highlights
|
||||
nnoremap <esc> :nohlsearch<CR><esc>
|
||||
inoremap <esc> :nohlsearch<CR><esc>
|
||||
|
||||
" <ctrl-q> to save everything and quit Neovim
|
||||
nnoremap <C-q> :wqa<CR>
|
||||
@@ -65,3 +86,21 @@ vnoremap <C-q> :wqa<CR>
|
||||
nnoremap <C-s> :wa<CR>
|
||||
vnoremap <C-s> :wa<CR>
|
||||
|
||||
" Move cursor in insert mode
|
||||
inoremap <C-b> <ESC>^i
|
||||
inoremap <C-e> <END>
|
||||
inoremap <C-h> <Left>
|
||||
inoremap <C-l> <Right>
|
||||
inoremap <C-j> <Down>
|
||||
inoremap <C-k> <Up>
|
||||
|
||||
" Copy entire content of the current buffer
|
||||
nnoremap <C-c> :%y+<CR>
|
||||
|
||||
" Clear search, diff update and redraw
|
||||
nnoremap <leader>/ :nohlsearch<CR>:diffupdate<CR>:normal! <C-L><CR>
|
||||
|
||||
" Changes the pwd to the opened file's directory
|
||||
nnoremap <leader>cd :lcd %:h<CR>
|
||||
|
||||
map <leader>j <Plug>(easymotion-s)
|
||||
|
||||
Reference in New Issue
Block a user