Skip to content

Instantly share code, notes, and snippets.

@tajpouria
Created March 30, 2020 14:40
Show Gist options
  • Select an option

  • Save tajpouria/b71a1ae13c352dd926733677ac8b07df to your computer and use it in GitHub Desktop.

Select an option

Save tajpouria/b71a1ae13c352dd926733677ac8b07df to your computer and use it in GitHub Desktop.
my-nvimrc-rc
set number
imap jj <esc>
set tabstop=2 softtabstop=0 expandtab shiftwidth=2 smarttab
set background=dark
set spell!
set mouse=a
set formatoptions-=cro "disable continuation of comments to the next line
call plug#begin('~/.vim/plugged')
Plug 'mxw/vim-jsx' " JSX Syntax
Plug 'pangloss/vim-javascript' " JS Syntax
Plug 'HerringtonDarkholme/yats.vim' " TS Syntax
Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
Plug 'morhetz/gruvbox'
Plug 'ctrlpvim/ctrlp.vim' " fuzzy find files
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'tpope/vim-fugitive'
call plug#end()
nmap <C-S-i> <Plug>(Prettier)
colorscheme gruvbox
" ctrlp ignores the file that ignored by git
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" coc
let g:coc_global_extensions = [
\ 'coc-snippets',
\ 'coc-pairs',
\ 'coc-tsserver',
\ 'coc-prettier',
\ 'coc-json',
\ ]
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Remap for rename current word
nmap <F2> <Plug>(coc-rename)
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" always show signcolumns
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment