Skip to content

Instantly share code, notes, and snippets.

@ryan10328
Last active April 5, 2025 08:15
Show Gist options
  • Select an option

  • Save ryan10328/4cd6c12e9fc82b8af5ff13832fff7bf3 to your computer and use it in GitHub Desktop.

Select an option

Save ryan10328/4cd6c12e9fc82b8af5ff13832fff7bf3 to your computer and use it in GitHub Desktop.

Revisions

  1. ryan10328 revised this gist Apr 5, 2025. 1 changed file with 29 additions and 24 deletions.
    53 changes: 29 additions & 24 deletions .ideavimrc
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    Plug 'vim-scripts/argtextobj.vim'
    Plug 'preservim/nerdtree'

    let mapleader = ' '

    @@ -28,36 +29,40 @@ nnoremap <c-h> <c-w>h
    nnoremap <c-k> <c-w>k

    " navigate between tabs
    nnoremap <A-]> gt
    nnoremap <A-[> gT

    " yank from cursor to end of line, to be consistent with C and D
    nnoremap Y y$

    " useful keymap
    " Increment / decrement
    nnoremap - <C-x>
    nnoremap + <C-a>
    " Delete a word backwards
    nnoremap dw vb"_d
    nnoremap <S-l> gt
    nnoremap <S-h> gT

    " Select all
    nnoremap <C-a> gg<S-v>G

    " code navigation
    nnoremap <leader>gi :action GotoImplementation<cr>
    nnoremap <leader>gs :action GotoSuperMethod<cr>
    nnoremap <leader>gu :action FindUsages<cr>
    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>
    " debugging
    nnoremap <leader>dw :action Run<cr>
    nnoremap <leader>ds :action Debug<cr>
    nnoremap <leader>dt :action Stop<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'
    nnoremap <leader>ut :action RiderUnitTestRunSolutionAction<cr>

    " put some rider-only mapping here
    else if &ide =~? 'webstorm'

    endif
    endif
    endif
  2. ryan10328 revised this gist Dec 8, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion .vsvimrc
    Original file line number Diff line number Diff line change
    @@ -9,13 +9,14 @@ nnoremap <esc><esc> :nohlsearch<CR>
    nnoremap dw vb"_d
    nnoremap <C-a> gg<S-v>G

    " visual studio action mapping
    " 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>
  3. ryan10328 revised this gist Dec 8, 2023. 1 changed file with 9 additions and 8 deletions.
    17 changes: 9 additions & 8 deletions .ideavimrc
    Original file line number Diff line number Diff line change
    @@ -44,13 +44,14 @@ nnoremap dw vb"_d
    nnoremap <C-a> gg<S-v>G

    " code navigation
    nnoremap <leader>gI :action GotoImplementation<cr>
    nnoremap <leader>gS :action GotoSuperMethod<cr>
    nnoremap <leader>gU :action FindUsages<cr>
    nnoremap <leader>gA :action Annotate<cr>
    nnoremap <leader>gR :action Run<cr>
    nnoremap <leader>gD :action Debug<cr>
    nnoremap <leader>cD :action Stop<cr>
    nnoremap <leader>gi :action GotoImplementation<cr>
    nnoremap <leader>gs :action GotoSuperMethod<cr>
    nnoremap <leader>gu :action FindUsages<cr>
    nnoremap <leader>ga :action Annotate<cr>
    " debugging
    nnoremap <leader>dw :action Run<cr>
    nnoremap <leader>ds :action Debug<cr>
    nnoremap <leader>dt :action Stop<cr>

    if has('ide')
    if &ide =~? 'rider'
    @@ -59,4 +60,4 @@ if has('ide')
    else if &ide =~? 'webstorm'

    endif
    endif
    endif
  4. ryan10328 revised this gist Dec 8, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions .vsvimrc
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,6 @@ nnoremap <leader>fd :vsc Edit.FormatDocument<CR>
    vnoremap <leader>fs :vsc Edit.FormatSelection<CR>

    " debugging
    nnoremap <leader>de :vsc Debug.Start<CR>
    nnoremap <leader>ds :vsc Debug.Start<CR>
    nnoremap <leader>dw :vsc Debug.StartWithoutDebugging<CR>
    nnoremap <leader>dc :vsc Debug.StopDebugging<CR>
    nnoremap <leader>dt :vsc Debug.StopDebugging<CR>
  5. ryan10328 revised this gist Dec 8, 2023. 1 changed file with 11 additions and 3 deletions.
    14 changes: 11 additions & 3 deletions .vsvimrc
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,16 @@ nnoremap <C-a> gg<S-v>G
    " visual studio action mapping
    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>

    " formatting
    nnoremap <leader>fd :vsc Edit.FormatDocument<CR>
    vnoremap <leader>fs :vsc Edit.FormatSelection<CR>
    nnoremap <leader>gD :vsc Debug.Start<CR>
    nnoremap <leader>gR :vsc Debug.StartWithoutDebugging<CR>
    nnoremap <leader>cD :vsc Debug.StopDebugging<CR>

    " debugging
    nnoremap <leader>de :vsc Debug.Start<CR>
    nnoremap <leader>dw :vsc Debug.StartWithoutDebugging<CR>
    nnoremap <leader>dc :vsc Debug.StopDebugging<CR>
  6. ryan10328 revised this gist Dec 7, 2023. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion .vsvimrc
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,7 @@ nnoremap <C-a> gg<S-v>G
    nnoremap <A-]> :vsc Window.NextDocumentWindow<CR>
    nnoremap <A-[> :vsc Window.PreviousDocumentWindow<CR>
    nnoremap <leader>fd :vsc Edit.FormatDocument<CR>
    vnoremap <leader>fs :vsc Edit.FormatSelection<CR>
    vnoremap <leader>fs :vsc Edit.FormatSelection<CR>
    nnoremap <leader>gD :vsc Debug.Start<CR>
    nnoremap <leader>gR :vsc Debug.StartWithoutDebugging<CR>
    nnoremap <leader>cD :vsc Debug.StopDebugging<CR>
  7. ryan10328 revised this gist Dec 6, 2023. 2 changed files with 20 additions and 1 deletion.
    16 changes: 16 additions & 0 deletions .vsvimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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

    " visual studio action mapping
    nnoremap <A-]> :vsc Window.NextDocumentWindow<CR>
    nnoremap <A-[> :vsc Window.PreviousDocumentWindow<CR>
    nnoremap <leader>fd :vsc Edit.FormatDocument<CR>
    vnoremap <leader>fs :vsc Edit.FormatSelection<CR>
    5 changes: 4 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,4 @@
    # .ideavimrc configuration
    # vim keymaps

    - `.ideavimrc` is for JetBrain IDE's
    - `.vsvimrc` is for Visual Studio VsVim extension
  8. ryan10328 revised this gist Dec 3, 2023. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion .ideavimrc
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,7 @@ nnoremap <c-j> <c-w>j
    nnoremap <c-h> <c-w>h
    nnoremap <c-k> <c-w>k

    " navigate between tabs
    nnoremap <A-]> gt
    nnoremap <A-[> gT

    @@ -49,10 +50,11 @@ nnoremap <leader>gU :action FindUsages<cr>
    nnoremap <leader>gA :action Annotate<cr>
    nnoremap <leader>gR :action Run<cr>
    nnoremap <leader>gD :action Debug<cr>
    nnoremap <leader>cD :action Stop<cr>

    if has('ide')
    if &ide =~? 'rider'
    nnoremap <leader>gt :action RiderUnitTestRunSolutionAction<cr>
    nnoremap <leader>ut :action RiderUnitTestRunSolutionAction<cr>

    else if &ide =~? 'webstorm'

  9. ryan10328 revised this gist Dec 3, 2023. 1 changed file with 9 additions and 22 deletions.
    31 changes: 9 additions & 22 deletions .ideavimrc
    Original file line number Diff line number Diff line change
    @@ -27,21 +27,12 @@ nnoremap <c-j> <c-w>j
    nnoremap <c-h> <c-w>h
    nnoremap <c-k> <c-w>k

    " move to previous tab
    nnoremap <a-h> gT

    " move to next tab
    nnoremap <a-l> gt
    nnoremap <c-s-tab> gT
    nnoremap <c-tab> gt
    nnoremap <A-]> gt
    nnoremap <A-[> gT

    " yank from cursor to end of line, to be consistent with C and D
    nnoremap Y y$

    " built-in search
    " nnoremap / :action Find<cr>
    " nnoremap g/ /

    " useful keymap
    " Increment / decrement
    nnoremap - <C-x>
    @@ -52,16 +43,12 @@ nnoremap dw vb"_d
    nnoremap <C-a> gg<S-v>G

    " code navigation
    nnoremap <leader>] :action GotoImplementation<cr>
    nnoremap <leader>[ :action GotoSuperMethod<cr>
    nnoremap <leader>u :action FindUsages<cr>
    nnoremap <leader>k :action HighlightUsagesInFile<cr>
    nnoremap <leader>gb :action Annotate<cr>
    nnoremap <leader>r :action RunClass<cr>
    nnoremap <leader>R :action Run<cr>
    nnoremap <leader>d :action DebugClass<cr>
    nnoremap <leader>D :action Debug<cr>
    nnoremap <leader>c :action CheckStyleCurrentFileAction<cr>
    nnoremap <leader>gI :action GotoImplementation<cr>
    nnoremap <leader>gS :action GotoSuperMethod<cr>
    nnoremap <leader>gU :action FindUsages<cr>
    nnoremap <leader>gA :action Annotate<cr>
    nnoremap <leader>gR :action Run<cr>
    nnoremap <leader>gD :action Debug<cr>

    if has('ide')
    if &ide =~? 'rider'
    @@ -70,4 +57,4 @@ if has('ide')
    else if &ide =~? 'webstorm'

    endif
    endif
    endif
  10. ryan10328 revised this gist Feb 17, 2023. 1 changed file with 39 additions and 50 deletions.
    89 changes: 39 additions & 50 deletions .ideavimrc
    Original file line number Diff line number Diff line change
    @@ -1,27 +1,35 @@
    " This is the ideavimrc setting comes from https://github.com/saaguero/ideavimrc/blob/master/.ideavimrc
    Plug 'vim-scripts/argtextobj.vim'

    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
    noremap <c-a> <esc>ggVG<cr>


    " 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

    " move to previous tab
    nnoremap <a-h> gT

    " move to next tab
    nnoremap <a-l> gt
    nnoremap <c-s-tab> gT
    @@ -30,55 +38,36 @@ nnoremap <c-tab> gt
    " yank from cursor to end of line, to be consistent with C and D
    nnoremap Y y$

    " clear search buffer when hitting return
    nnoremap <space><cr> :nohlsearch<cr>
    " built-in search
    " nnoremap / :action Find<cr>
    " nnoremap g/ /

    " actions
    nnoremap <space>q :action CloseContent<cr>
    nnoremap <space>Q :action ReopenClosedTab<cr>
    nnoremap <space>\ :action VimFilePrevious<cr>
    nnoremap <space>e :action SearchEverywhere<cr>
    nnoremap <space>E :action Switcher<cr>
    nnoremap <space>t :action FileStructurePopup<cr>
    nnoremap <space>T :action GotoSymbol<cr>
    nnoremap <space>a :action GotoAction<cr>
    nnoremap <space>b :action ToggleLineBreakpoint<cr>
    nnoremap <space>rc :action ReformatCode<cr>
    " useful keymap
    " Increment / decrement
    nnoremap - <C-x>
    nnoremap + <C-a>
    " Delete a word backwards
    nnoremap dw vb"_d
    " Select all
    nnoremap <C-a> gg<S-v>G

    " code navigation
    nnoremap <space>i :action GotoImplementation<cr>
    nnoremap <space>s :action GotoSuperMethod<cr>
    nnoremap <space>d :action GotoDeclaration<cr>
    nnoremap <space>u :action FindUsages<cr>
    nnoremap <space>gt :action GotoTest<cr>
    nnoremap <space>k :action HighlightUsagesInFile<cr>
    nnoremap \r :action RunClass<cr>
    nnoremap \R :action Run<cr>
    nnoremap \d :action DebugClass<cr>
    nnoremap \D :action Debug<cr>
    nnoremap \c :action CheckStyleCurrentFileAction<cr>

    " test explorer (rider)
    nnoremap \t :action RiderUnitTestRunSolutionAction<cr>
    nnoremap <leader>] :action GotoImplementation<cr>
    nnoremap <leader>[ :action GotoSuperMethod<cr>
    nnoremap <leader>u :action FindUsages<cr>
    nnoremap <leader>k :action HighlightUsagesInFile<cr>
    nnoremap <leader>gb :action Annotate<cr>
    nnoremap <leader>r :action RunClass<cr>
    nnoremap <leader>R :action Run<cr>
    nnoremap <leader>d :action DebugClass<cr>
    nnoremap <leader>D :action Debug<cr>
    nnoremap <leader>c :action CheckStyleCurrentFileAction<cr>

    " code refactoring
    nnoremap <space>rr :action RenameElement<cr>
    if has('ide')
    if &ide =~? 'rider'
    nnoremap <leader>gt :action RiderUnitTestRunSolutionAction<cr>

    else if &ide =~? 'webstorm'

    " unimpaired mappings
    nnoremap [<space> O<esc>j
    nnoremap ]<space> o<esc>k
    nnoremap [q :action PreviousOccurence<cr>
    nnoremap ]q :action NextOccurence<cr>
    nnoremap [m :action MethodUp<cr>
    nnoremap ]m :action MethodDown<cr>

    " built-in navigation to navigated items works better
    " nnoremap <c-o> :action Back<cr>
    " nnoremap <c-i> :action Forward<cr>
    " but preserve ideavim defaults
    nnoremap g<c-o> <c-o>
    nnoremap g<c-i> <c-i>

    " built-in search
    nnoremap / :action Find<cr>
    nnoremap g/ /
    endif
    endif
  11. ryan10328 revised this gist Jan 13, 2022. 5 changed files with 1 addition and 128 deletions.
    7 changes: 1 addition & 6 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1 @@
    # nvim setup

    ## nvim configuration file location

    Windows
    - `$env:LOCALAPPDATA\nvim`
    # .ideavimrc configuration
    58 changes: 0 additions & 58 deletions init.vim
    Original file line number Diff line number Diff line change
    @@ -1,58 +0,0 @@
    set encoding=utf-8
    let mapleader = ' '

    " init autocmd
    autocmd!
    " set script encoding
    scriptencoding utf-8
    if !1 | finish | endif

    set number
    set relativenumber
    syntax enable
    set fileencodings=utf-8
    set encoding=utf-8
    set title
    set autoindent
    set background=dark
    set nobackup
    set hlsearch
    set showcmd
    set cmdheight=1
    set laststatus=2
    set scrolloff=10
    set expandtab
    set ignorecase
    set smarttab
    " indents
    filetype plugin indent on
    set shiftwidth=2
    set tabstop=2
    set autoindent
    set smartindent
    set nowrap
    set backspace=start,eol,indent

    set cursorline

    " terminals
    set splitright
    set splitbelow

    " set path+=**
    " set wildignore+=*/node_modules/*

    " Imports "{{{
    " ---------------------------------------------------------------------
    runtime ./plug.vim

    if has('unix')
    let s:uname = system('uname -s')
    if s:uname == 'Darwin\n'
    runtime ./macos.vim
    endif
    endif

    runtime ./maps.vim
    "}}}

    2 changes: 0 additions & 2 deletions macos.vim
    Original file line number Diff line number Diff line change
    @@ -1,2 +0,0 @@
    " macos specific setting
    set clipboard+=unnamedplus
    16 changes: 0 additions & 16 deletions maps.vim
    Original file line number Diff line number Diff line change
    @@ -1,16 +0,0 @@
    " Keymaps

    " terminal keymaps
    nnoremap <c-n> :call OpenTerminal()<CR>
    tnoremap <A-h> <C-\><C-n><C-w>h
    tnoremap <A-j> <C-\><C-n><C-w>j
    tnoremap <A-k> <C-\><C-n><C-w>k
    tnoremap <A-l> <C-\><C-n><C-w>l
    nnoremap <A-h> <C-w>h
    nnoremap <A-j> <C-w>j
    nnoremap <A-k> <C-w>k
    nnoremap <A-l> <C-w>l

    nnoremap <silent> <C-b> :NERDTreeToggle<CR>
    nnoremap <leader>[f :CocCommand prettier.formatFile<CR>
    46 changes: 0 additions & 46 deletions plug.vim
    Original file line number Diff line number Diff line change
    @@ -1,46 +0,0 @@
    call plug#begin('~/.config/nvim/plugged')

    if has('nvim')

    Plug 'scrooloose/nerdtree'
    Plug 'ryanoasis/vim-devicons'
    Plug 'morhetz/gruvbox'
    Plug 'neoclide/coc.nvim', {'branch': 'release'}
    Plug 'leafgarland/typescript-vim'
    Plug 'scrooloose/nerdcommenter'
    Plug 'windwp/nvim-autopairs'

    endif


    call plug#end()

    " Terminals
    au BufEnter * if &buftype == 'terminal' | :startinsert | endif

    function! OpenTerminal()
    if has('mac')
    split term://zsh
    elseif has('win32') " if it's in windows then call powershell as the terminal source
    split term://pwsh -NoLogo
    endif
    resize 10
    endfunction

    " NerdTree
    let g:NERDTreeShowHidden = 1
    let g:NERDTreeMinimalUI = 1
    let g:NERDTreeIgnore = ['^node_modules$']
    let g:NERDTreeStatusline = ''
    " automatically close nerdtree if nerdtree is the only thing left open
    autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

    " Coc.nvim
    let g:coc_global_extensions = ['coc-emmet', 'coc-css', 'coc-html', 'coc-json', 'coc-prettier', 'coc-tsserver', 'coc-pairs']

    " Theme
    set background=dark
    colorscheme gruvbox
    " let g:gruvbox_contrast_dark='hard'


  12. ryan10328 revised this gist Jan 13, 2022. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions .ideavimrc
    Original file line number Diff line number Diff line change
    @@ -6,12 +6,14 @@ set hlsearch
    set scrolloff=3
    set ignorecase smartcase
    set ideajoin
    set number relativenumber

    " easy system clipboard copy/paste
    noremap <space>y "*y
    noremap <space>Y "*Y
    noremap <space>p "*p
    noremap <space>P "*P
    noremap <c-a> <esc>ggVG<cr>

    " easy window navigation
    nnoremap <c-l> <c-w>l
    @@ -44,8 +46,9 @@ nnoremap <space>b :action ToggleLineBreakpoint<cr>
    nnoremap <space>rc :action ReformatCode<cr>

    " code navigation
    nnoremap <space>] :action GotoImplementation<cr>
    nnoremap <space>[ :action GotoSuperMethod<cr>
    nnoremap <space>i :action GotoImplementation<cr>
    nnoremap <space>s :action GotoSuperMethod<cr>
    nnoremap <space>d :action GotoDeclaration<cr>
    nnoremap <space>u :action FindUsages<cr>
    nnoremap <space>gt :action GotoTest<cr>
    nnoremap <space>k :action HighlightUsagesInFile<cr>
    @@ -70,8 +73,8 @@ nnoremap [m :action MethodUp<cr>
    nnoremap ]m :action MethodDown<cr>

    " built-in navigation to navigated items works better
    nnoremap <c-o> :action Back<cr>
    nnoremap <c-i> :action Forward<cr>
    " nnoremap <c-o> :action Back<cr>
    " nnoremap <c-i> :action Forward<cr>
    " but preserve ideavim defaults
    nnoremap g<c-o> <c-o>
    nnoremap g<c-i> <c-i>
  13. ryan10328 revised this gist Dec 15, 2021. 4 changed files with 94 additions and 47 deletions.
    76 changes: 50 additions & 26 deletions init.vim
    Original file line number Diff line number Diff line change
    @@ -1,34 +1,58 @@
    set encoding=utf-8
    let mapleader = ','
    let mapleader = ' '

    " Imports "{{{
    " ---------------------------------------------------------------------
    runtime ./plug.vim
    runtime ./maps.vim
    "}}}
    " init autocmd
    autocmd!
    " set script encoding
    scriptencoding utf-8
    if !1 | finish | endif

    " Terminals
    au BufEnter * if &buftype == 'terminal' | :startinsert | endif
    set number
    set relativenumber
    syntax enable
    set fileencodings=utf-8
    set encoding=utf-8
    set title
    set autoindent
    set background=dark
    set nobackup
    set hlsearch
    set showcmd
    set cmdheight=1
    set laststatus=2
    set scrolloff=10
    set expandtab
    set ignorecase
    set smarttab
    " indents
    filetype plugin indent on
    set shiftwidth=2
    set tabstop=2
    set autoindent
    set smartindent
    set nowrap
    set backspace=start,eol,indent

    function! OpenTerminal()
    split term://pwsh -NoLogo
    resize 10
    endfunction
    set cursorline

    " NerdTree
    let g:NERDTreeShowHidden = 1
    let g:NERDTreeMinimalUI = 1
    let g:NERDTreeIgnore = ['^node_modules$']
    let g:NERDTreeStatusline = ''
    " automatically close nerdtree if nerdtree is the only thing left open
    autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
    " terminals
    set splitright
    set splitbelow

    " Coc.nvim
    let g:coc_global_extensions = ['coc-emmet', 'coc-css', 'coc-html', 'coc-json', 'coc-prettier', 'coc-tsserver', 'coc-pairs']
    " set path+=**
    " set wildignore+=*/node_modules/*

    " Theme
    set background=dark
    colorscheme gruvbox
    let g:gruvbox_contrast_dark='hard'
    " Imports "{{{
    " ---------------------------------------------------------------------
    runtime ./plug.vim

    if has('unix')
    let s:uname = system('uname -s')
    if s:uname == 'Darwin\n'
    runtime ./macos.vim
    endif
    endif

    runtime ./maps.vim
    "}}}

    syntax enable
    2 changes: 2 additions & 0 deletions macos.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    " macos specific setting
    set clipboard+=unnamedplus
    23 changes: 4 additions & 19 deletions maps.vim
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,4 @@
    " Description: Keymaps

    set number
    set relativenumber
    set hlsearch
    set incsearch

    set tabstop=4
    set shiftwidth=4
    set expandtab

    " integrated terminal
    set splitright
    set splitbelow
    tnoremap <C-\><C-n>
    " format file using :Prettier
    command! -nargs=0 Prettier :CocCommand prettier.formatFile
    " Keymaps

    " terminal keymaps
    nnoremap <c-n> :call OpenTerminal()<CR>
    @@ -28,4 +11,6 @@ nnoremap <A-j> <C-w>j
    nnoremap <A-k> <C-w>k
    nnoremap <A-l> <C-w>l
    nnoremap <silent> <C-b> :NERDTreeToggle<CR>

    nnoremap <silent> <C-b> :NERDTreeToggle<CR>
    nnoremap <leader>[f :CocCommand prettier.formatFile<CR>
    40 changes: 38 additions & 2 deletions plug.vim
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,46 @@
    call plug#begin('~/AppData/Local/nvim/plugged')
    call plug#begin('~/.config/nvim/plugged')

    if has('nvim')

    Plug 'scrooloose/nerdtree'
    Plug 'ryanoasis/vim-devicons'
    Plug 'morhetz/gruvbox'
    Plug 'neoclide/coc.nvim', {'branch': 'release'}
    Plug 'leafgarland/typescript-vim'
    Plug 'scrooloose/nerdcommenter'
    Plug 'windwp/nvim-autopairs'

    endif


    call plug#end()

    " Terminals
    au BufEnter * if &buftype == 'terminal' | :startinsert | endif

    function! OpenTerminal()
    if has('mac')
    split term://zsh
    elseif has('win32') " if it's in windows then call powershell as the terminal source
    split term://pwsh -NoLogo
    endif
    resize 10
    endfunction

    " NerdTree
    let g:NERDTreeShowHidden = 1
    let g:NERDTreeMinimalUI = 1
    let g:NERDTreeIgnore = ['^node_modules$']
    let g:NERDTreeStatusline = ''
    " automatically close nerdtree if nerdtree is the only thing left open
    autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

    " Coc.nvim
    let g:coc_global_extensions = ['coc-emmet', 'coc-css', 'coc-html', 'coc-json', 'coc-prettier', 'coc-tsserver', 'coc-pairs']

    " Theme
    set background=dark
    colorscheme gruvbox
    " let g:gruvbox_contrast_dark='hard'


    call plug#end()
  14. ryan10328 revised this gist Dec 14, 2021. 1 changed file with 81 additions and 0 deletions.
    81 changes: 81 additions & 0 deletions .ideavimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,81 @@
    " 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

    " easy system clipboard copy/paste
    noremap <space>y "*y
    noremap <space>Y "*Y
    noremap <space>p "*p
    noremap <space>P "*P

    " 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
    " move to previous tab
    nnoremap <a-h> gT
    " move to next tab
    nnoremap <a-l> gt
    nnoremap <c-s-tab> gT
    nnoremap <c-tab> gt

    " yank from cursor to end of line, to be consistent with C and D
    nnoremap Y y$

    " clear search buffer when hitting return
    nnoremap <space><cr> :nohlsearch<cr>

    " actions
    nnoremap <space>q :action CloseContent<cr>
    nnoremap <space>Q :action ReopenClosedTab<cr>
    nnoremap <space>\ :action VimFilePrevious<cr>
    nnoremap <space>e :action SearchEverywhere<cr>
    nnoremap <space>E :action Switcher<cr>
    nnoremap <space>t :action FileStructurePopup<cr>
    nnoremap <space>T :action GotoSymbol<cr>
    nnoremap <space>a :action GotoAction<cr>
    nnoremap <space>b :action ToggleLineBreakpoint<cr>
    nnoremap <space>rc :action ReformatCode<cr>

    " code navigation
    nnoremap <space>] :action GotoImplementation<cr>
    nnoremap <space>[ :action GotoSuperMethod<cr>
    nnoremap <space>u :action FindUsages<cr>
    nnoremap <space>gt :action GotoTest<cr>
    nnoremap <space>k :action HighlightUsagesInFile<cr>
    nnoremap \r :action RunClass<cr>
    nnoremap \R :action Run<cr>
    nnoremap \d :action DebugClass<cr>
    nnoremap \D :action Debug<cr>
    nnoremap \c :action CheckStyleCurrentFileAction<cr>

    " test explorer (rider)
    nnoremap \t :action RiderUnitTestRunSolutionAction<cr>

    " code refactoring
    nnoremap <space>rr :action RenameElement<cr>

    " unimpaired mappings
    nnoremap [<space> O<esc>j
    nnoremap ]<space> o<esc>k
    nnoremap [q :action PreviousOccurence<cr>
    nnoremap ]q :action NextOccurence<cr>
    nnoremap [m :action MethodUp<cr>
    nnoremap ]m :action MethodDown<cr>

    " built-in navigation to navigated items works better
    nnoremap <c-o> :action Back<cr>
    nnoremap <c-i> :action Forward<cr>
    " but preserve ideavim defaults
    nnoremap g<c-o> <c-o>
    nnoremap g<c-i> <c-i>

    " built-in search
    nnoremap / :action Find<cr>
    nnoremap g/ /
  15. ryan10328 created this gist Dec 12, 2021.
    6 changes: 6 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    # nvim setup

    ## nvim configuration file location

    Windows
    - `$env:LOCALAPPDATA\nvim`
    34 changes: 34 additions & 0 deletions init.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    set encoding=utf-8
    let mapleader = ','

    " Imports "{{{
    " ---------------------------------------------------------------------
    runtime ./plug.vim
    runtime ./maps.vim
    "}}}

    " Terminals
    au BufEnter * if &buftype == 'terminal' | :startinsert | endif

    function! OpenTerminal()
    split term://pwsh -NoLogo
    resize 10
    endfunction

    " NerdTree
    let g:NERDTreeShowHidden = 1
    let g:NERDTreeMinimalUI = 1
    let g:NERDTreeIgnore = ['^node_modules$']
    let g:NERDTreeStatusline = ''
    " automatically close nerdtree if nerdtree is the only thing left open
    autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

    " Coc.nvim
    let g:coc_global_extensions = ['coc-emmet', 'coc-css', 'coc-html', 'coc-json', 'coc-prettier', 'coc-tsserver', 'coc-pairs']

    " Theme
    set background=dark
    colorscheme gruvbox
    let g:gruvbox_contrast_dark='hard'

    syntax enable
    31 changes: 31 additions & 0 deletions maps.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    " Description: Keymaps

    set number
    set relativenumber
    set hlsearch
    set incsearch

    set tabstop=4
    set shiftwidth=4
    set expandtab

    " integrated terminal
    set splitright
    set splitbelow
    tnoremap <C-\><C-n>
    " format file using :Prettier
    command! -nargs=0 Prettier :CocCommand prettier.formatFile

    " terminal keymaps
    nnoremap <c-n> :call OpenTerminal()<CR>
    tnoremap <A-h> <C-\><C-n><C-w>h
    tnoremap <A-j> <C-\><C-n><C-w>j
    tnoremap <A-k> <C-\><C-n><C-w>k
    tnoremap <A-l> <C-\><C-n><C-w>l
    nnoremap <A-h> <C-w>h
    nnoremap <A-j> <C-w>j
    nnoremap <A-k> <C-w>k
    nnoremap <A-l> <C-w>l
    nnoremap <silent> <C-b> :NERDTreeToggle<CR>
    10 changes: 10 additions & 0 deletions plug.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    call plug#begin('~/AppData/Local/nvim/plugged')

    Plug 'scrooloose/nerdtree'
    Plug 'ryanoasis/vim-devicons'
    Plug 'morhetz/gruvbox'
    Plug 'neoclide/coc.nvim', {'branch': 'release'}
    Plug 'leafgarland/typescript-vim'
    Plug 'scrooloose/nerdcommenter'

    call plug#end()