Skip to content

Instantly share code, notes, and snippets.

@ryan10328
Last active April 5, 2025 08:15
Show Gist options
  • Save ryan10328/4cd6c12e9fc82b8af5ff13832fff7bf3 to your computer and use it in GitHub Desktop.
Save ryan10328/4cd6c12e9fc82b8af5ff13832fff7bf3 to your computer and use it in GitHub Desktop.
nvim setup
Plug 'vim-scripts/argtextobj.vim'
Plug 'preservim/nerdtree'
let mapleader = ' '
" This is the ideavimrc setting comes from https://github.com/saaguero/ideavimrc/blob/master/.ideavimrc
set history=1000
set showmode
set hlsearch
set scrolloff=3
set ignorecase smartcase
set ideajoin
set number relativenumber
set clipboard+=unnamed
" easy system clipboard copy/paste
noremap <space>y "*y
noremap <space>Y "*Y
noremap <space>p "*p
noremap <space>P "*P
" exit highlight search
nnoremap <esc><esc> :nohlsearch<cr>
" easy window navigation
nnoremap <c-l> <c-w>l
nnoremap <c-j> <c-w>j
nnoremap <c-h> <c-w>h
nnoremap <c-k> <c-w>k
" navigate between tabs
nnoremap <S-l> gt
nnoremap <S-h> gT
" Select all
nnoremap <C-a> gg<S-v>G
nnoremap <leader>gI :action GotoImplementation<cr>
nnoremap <leader>gD :action GotoDeclaration<cr>
nnoremap <leader>gd :action GotoDeclaration<cr>
nnoremap <leader>gy :action GotoTypeDeclaration<cr>
nnoremap <leader>gr :action FindUsages<cr>
" git annotate
nnoremap <leader>ga :action Annotate<cr>
" code editing
nnoremap <leader>ca :action ShowIntentionActions<cr>
nnoremap <leader>cf :action ReformatCode<cr>
nnoremap <leader>cr :action RenameElement<cr>
" cannot use gcc because ideavim not support
nnoremap <leader>cc :action CommentByLineComment<cr>
" explorer
nnoremap <leader>e :NERDTreeToggle<cr>:action EditSource<cr>
" pane
nnoremap <C-a>\ :action SplitVertically<cr>
nnoremap <C-a>- :action SplitHorizontally<cr>
if has('ide')
if &ide =~? 'rider'
" put some rider-only mapping here
else if &ide =~? 'webstorm'
endif
endif
let mapleader = ' '
set number relativenumber
set hlsearch
nnoremap + <C-a><CR>
nnoremap - <C-x><CR>
nnoremap <esc><esc> :nohlsearch<CR>
nnoremap dw vb"_d
nnoremap <C-a> gg<S-v>G
" switch between tabs
nnoremap <A-]> :vsc Window.NextDocumentWindow<CR>
nnoremap <A-[> :vsc Window.PreviousDocumentWindow<CR>
" navigation
nnoremap <leader>gi :vsc Edit.GoToDeclaration<CR>
nnoremap <leader>gd :vsc Edit.GoToDefinition<CR>
nnoremap <leader>gu :vsc Edit.FindAllReferences<CR>
" formatting
nnoremap <leader>fd :vsc Edit.FormatDocument<CR>
vnoremap <leader>fs :vsc Edit.FormatSelection<CR>
" debugging
nnoremap <leader>ds :vsc Debug.Start<CR>
nnoremap <leader>dw :vsc Debug.StartWithoutDebugging<CR>
nnoremap <leader>dt :vsc Debug.StopDebugging<CR>

vim keymaps

  • .ideavimrc is for JetBrain IDE's
  • .vsvimrc is for Visual Studio VsVim extension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment