Last active
October 12, 2019 03:52
-
-
Save phanviet/e1e692d036841e571e8615292f583cbc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin('~/.local/share/nvim/plugged') | |
Plug 'tpope/vim-fugitive' | |
" Better default | |
Plug 'tpope/vim-sensible' | |
" Project management | |
Plug 'scrooloose/nerdtree' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
" Ctags | |
" Plug 'ozelentok/denite-gtags' | |
Plug 'fntlnz/atags.vim' | |
" Plug 'ludovicchabant/vim-gutentags' | |
" Syntax checking | |
" Plug 'neomake/neomake' | |
Plug 'w0rp/ale' | |
Plug 'chiel92/vim-autoformat' | |
Plug 'sheerun/vim-polyglot' | |
Plug 'keith/swift.vim' | |
" Rest client | |
" Plug 'aquach/vim-http-client' | |
" Multi cursors | |
Plug 'terryma/vim-multiple-cursors' | |
" quote | |
Plug 'tpope/vim-surround' | |
Plug 'jiangmiao/auto-pairs' | |
" Plug 'dhruvasagar/vim-table-mode' | |
" Plug 'luochen1990/rainbow' | |
" tmux | |
Plug 'christoomey/vim-tmux-navigator' | |
Plug 'benmills/vimux' | |
" Search | |
" Plug 'ctrlpvim/ctrlp.vim' | |
" Plug 'mileszs/ack.vim' | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
" Plug 'Shougo/denite.nvim' | |
Plug 'eugen0329/vim-esearch' | |
" Org mode | |
" Plug 'jceb/vim-orgmode' | |
" Plug 'tpope/vim-speeddating' | |
Plug 'vimwiki/vimwiki' | |
" Tab alginment | |
Plug 'godlygeek/tabular' | |
Plug 'nathanaelkane/vim-indent-guides' | |
" Browse tag | |
Plug 'majutsushi/tagbar' | |
" Comment | |
Plug 'tomtom/tcomment_vim' | |
" Git gutter | |
Plug 'airblade/vim-gitgutter' | |
" Javascript improve | |
Plug 'pangloss/vim-javascript' | |
Plug 'mhartington/nvim-typescript', { 'do': './install.sh' } | |
" Plug 'ternjs/tern_for_vim' | |
Plug 'mxw/vim-jsx' | |
Plug 'HerringtonDarkholme/yats.vim' | |
Plug 'maksimr/vim-jsbeautify' | |
" C# | |
Plug 'OmniSharp/omnisharp-vim' | |
" Quick move in file | |
Plug 'easymotion/vim-easymotion' | |
" For Ruby & Rails | |
Plug 'vim-ruby/vim-ruby' | |
Plug 'tpope/vim-rails' | |
Plug 'tpope/vim-endwise' | |
Plug 'kagux/vim-rubocop-autocorrect' | |
Plug 'ecomba/vim-ruby-refactoring' | |
" Rust | |
Plug 'rust-lang/rust.vim' | |
" Front end | |
Plug 'mattn/emmet-vim' | |
Plug 'othree/html5.vim' | |
" Plug 'tpope/vim-markdown' | |
Plug 'hail2u/vim-css3-syntax' | |
Plug 'cakebaker/scss-syntax.vim' | |
Plug 'ap/vim-css-color' | |
Plug 'csscomb/vim-csscomb' | |
Plug 'alvan/vim-closetag' | |
" Plug 'HTML-AutoCloseTag' | |
Plug 'tyru/open-browser.vim' | |
Plug 'valloric/MatchTagAlways' | |
Plug 'digitaltoad/vim-pug' | |
" Style guide | |
Plug 'editorconfig/editorconfig-vim' | |
" Gist | |
Plug 'mattn/gist-vim' | |
" Themes | |
Plug 'itchyny/lightline.vim' | |
Plug 'phanviet/vim-monokai-pro' | |
Plug 'Akin909/oni-theme-night-owl' | |
Plug 'morhetz/gruvbox' | |
" Plug 'andreypopp/vim-colors-plain' | |
" Plug 'tomasr/molokai' | |
" Plug 'andreasvc/vim-256noir' | |
" Plug 'phanviet/Sidonia' | |
" Plug 'liuchengxu/space-vim-dark' | |
" Plug 'sickill/vim-monokai' | |
" Plug 'nanotech/jellybeans.vim' | |
" Plug 'joshdick/onedark.vim' | |
Plug 'icymind/NeoSolarized' | |
" Plug 'owickstrom/vim-colors-paramount' | |
Plug 'tomasr/molokai' | |
" GraphQL | |
Plug 'jparise/vim-graphql' | |
Plug 'lepture/vim-velocity' | |
Plug 'Shougo/neosnippet.vim' | |
Plug 'Shougo/neosnippet-snippets' | |
Plug 'honza/vim-snippets' | |
Plug 'tpope/vim-repeat' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | |
" Plug 'zchee/deoplete-jedi' | |
" Plug 'tweekmonster/deoplete-clang2' | |
" Plug 'sebastianmarkow/deoplete-rust' | |
" Plug 'autozimu/LanguageClient-neovim', { | |
" \ 'branch': 'next', | |
" \ 'do': 'bash install.sh', | |
" \ } | |
call plug#end() | |
syntax on | |
let mapleader = ',' | |
let maplocalleader = '\' | |
set mouse=a | |
set langmenu=en_US | |
let $LANG = 'en_US' | |
set list | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set expandtab | |
set noswapfile | |
set colorcolumn=80 | |
set clipboard=unnamedplus | |
" set cursorline | |
set autoread | |
" Auto trailing space after save | |
function! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces() | |
" Theme config | |
set termguicolors | |
" set t_Co=256 | |
" set t_AB=^[[48;5;%dm | |
" set t_AF=^[[38;5;%dm]]]] | |
" set background=light | |
" colorscheme 256_noir | |
" colorscheme sidonia | |
" colorscheme molokai | |
" colorscheme gruvbox | |
" colorscheme monokai_pro | |
colorscheme night-owl | |
" colorscheme NeoSolarized | |
set background=dark | |
" Show line numbers | |
set number | |
set relativenumber | |
" toggle highlight. | |
set hlsearch! | |
nnoremap <Leader>hl :set hlsearch!<CR> | |
nnoremap <c-j> <c-w>j | |
nnoremap <c-k> <c-w>k | |
nnoremap <c-h> <c-w>h | |
nnoremap <c-l> <c-w>l | |
tnoremap <Esc> <C-\><C-n> | |
nnoremap <silent> <BS> <c-w>h<cr> | |
inoremap jj <ESC> | |
" Ctags & definition | |
map <Leader>F :vsp <CR>:wincmd l<CR>:exec("tag ".expand("<cword>"))<CR> | |
map <Leader>f :exec("tag ".expand("<cword>"))<CR> | |
" NERDTree config | |
map <C-\> :NERDTreeToggle<CR> | |
map <Leader>\ :NERDTreeFind<CR> | |
" Tagbar config | |
nmap <Leader>tb :TagbarToggle<CR> | |
" Navigation config | |
map vv :vsplit<CR> | |
map ss :split<CR> | |
" Indent guides | |
let g:indent_guides_start_level=2 | |
let g:indent_guides_guide_size=1 | |
nnoremap <Leader>ti :IndentGuidesToggle<cr> | |
" NERDComment config | |
" let g:NERDSpaceDelims = 1 | |
" let g:NERDDefaultAlign = 'left' | |
" Syntastic config | |
" let g:syntastic_ruby_checkers = ['mri', 'rubocop'] | |
" autocmd! BufReadPost,BufWritePost * Neomake | |
" Parenthese | |
" let g:rainbow_active = 1 | |
" Tabular Alignment config | |
nmap <Leader>a= :Tabularize /=<CR> | |
vmap <Leader>a= :Tabularize /=<CR> | |
nmap <Leader>a: :Tabularize /:<CR> | |
vmap <Leader>a: :Tabularize /:<CR> | |
nmap <Leader>a:: :Tabularize /:\\zs<CR> | |
vmap <Leader>a:: :Tabularize /:\\zs<CR> | |
nmap <Leader>a, :Tabularize /,<CR> | |
vmap <Leader>a, :Tabularize /,<CR> | |
nmap <Leader>a/ :Tabularize /\/\/<CR> | |
vmap <Leader>a/ :Tabularize /\/\/<CR> | |
" Use deoplete. | |
" let g:deoplete#enable_at_startup = 1 | |
" let g:deoplete#disable_auto_complete = 1 | |
" inoremap <expr> <C-n> deoplete#mappings#manual_complete() | |
" function! Multiple_cursors_before() | |
" let b:deoplete_disable_auto_complete = 1 | |
" endfunction | |
" | |
" function! Multiple_cursors_after() | |
" let b:deoplete_disable_auto_complete = 0 | |
" endfunction | |
let g:ale_completion_enabled = 0 | |
" call deoplete#custom#option('sources', { | |
" \ 'cs': ['omnisharp'], | |
" \}) | |
" nnoremap <F5> :call LanguageClient_contextMenu()<CR> | |
" Or map each action separately | |
" nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR> | |
" nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR> | |
" nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR> | |
" neosnippet | |
" Plugin key-mappings. | |
" Note: It must be "imap" and "smap". It uses <Plug> mappings. | |
imap <C-k> <Plug>(neosnippet_expand_or_jump) | |
smap <C-k> <Plug>(neosnippet_expand_or_jump) | |
xmap <C-k> <Plug>(neosnippet_expand_target) | |
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>" | |
" SuperTab like snippets behavior. | |
" Note: It must be "imap" and "smap". It uses <Plug> mappings. | |
imap <expr><TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>" | |
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>" | |
function! s:check_back_space() abort "{{{ | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~ '\s' | |
endfunction"}}} | |
" For conceal markers. | |
" if has('conceal') | |
" set conceallevel=2 concealcursor=niv | |
" endif | |
" end neosnippet | |
nnoremap <C-]> g<C-]> | |
nnoremap <C-P> :FZF<CR> | |
" Typescript | |
nnoremap <Leader>i :TSImport<cr> | |
" Rest | |
nnoremap <Leader>rs :HTTPClientDoRequest<cr> | |
" Ctags | |
nnoremap <Leader>t :call atags#generate()<cr> | |
" autocmd BufWritePost * call atags#generate() | |
let g:atags_build_commands_list = [ | |
\ "ag -g '' | ctags -L - --fields=+l -f tags" | |
\ ] | |
" let g:atags_build_commands_list = [ | |
" \ "ag -g '' | ctags -L - --fields=+l -f tags.tmp", | |
" \ "awk 'length($0) < 400' tags.tmp > tags", | |
" \ "rm tags.tmp" | |
" \ ] | |
" gutentags | |
let g:gutentags_ctags_exclude = ['node_modules'] | |
let g:jsx_ext_required = 0 | |
let g:esearch = { | |
\ 'adapter': 'ag', | |
\ 'backend': 'nvim', | |
\ 'out': 'win', | |
\ 'batch_size': 1000, | |
\ 'use': ['visual', 'hlsearch', 'last'], | |
\} | |
" vimux config | |
" Prompt for a command to run | |
map <Leader>vp :VimuxPromptCommand<CR> | |
" Run last command executed by VimuxRunCommand | |
map <Leader>vl :VimuxRunLastCommand<CR> | |
function! SynStack() | |
if !exists('*synstack') | |
return | |
endif | |
echo map(synstack(line('.'), col('.')), "synIDattr(v:val, 'name')") | |
endfunc | |
" Example mapping: | |
nmap <leader>x :call SynStack()<CR> | |
" Js beautify | |
autocmd FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr> | |
autocmd FileType json noremap <buffer> <c-f> :call JsonBeautify()<cr> | |
autocmd FileType jsx noremap <buffer> <c-f> :call JsxBeautify()<cr> | |
autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr> | |
autocmd FileType css noremap <buffer> <c-f> :call CSSBeautify()<cr> | |
autocmd FileType javascript vnoremap <buffer> <c-f> :call RangeJsBeautify()<cr> | |
autocmd FileType json vnoremap <buffer> <c-f> :call RangeJsonBeautify()<cr> | |
autocmd FileType jsx vnoremap <buffer> <c-f> :call RangeJsxBeautify()<cr> | |
autocmd FileType html vnoremap <buffer> <c-f> :call RangeHtmlBeautify()<cr> | |
autocmd FileType css vnoremap <buffer> <c-f> :call RangeCSSBeautify()<cr> | |
" Auto format | |
noremap <F3> :Autoformat<CR> | |
" aug python | |
" ftype/python.vim overwrites this | |
" au FileType python setlocal ts=4 sts=4 sw=4 noexpandtab | |
" aug end | |
" au BufNewFile,BufRead *.request,*.response set ft=velocity | |
" hi Normal guibg=NONE ctermbg=NONE | |
" coc setting | |
" if hidden is not set, TextEdit might fail. | |
set hidden | |
" Some servers have issues with backup files, see #649 | |
set nobackup | |
set nowritebackup | |
" Better display for messages | |
set cmdheight=2 | |
" You will have bad experience for diagnostic messages when it's default 4000. | |
set updatetime=300 | |
" don't give |ins-completion-menu| messages. | |
set shortmess+=c | |
" always show signcolumns | |
set signcolumn=yes | |
" 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) | |
" Use <c-space> to trigger completion. | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" Use `[c` and `]c` to navigate diagnostics | |
nmap <silent> [c <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]c <Plug>(coc-diagnostic-next) | |
" Highlight symbol under cursor on CursorHold | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
" Remap for rename current word | |
nmap <leader>rn <Plug>(coc-rename) | |
" Remap for format selected region | |
xmap <leader>f <Plug>(coc-format-selected) | |
nmap <leader>f <Plug>(coc-format-selected)<Paste> | |
augroup mygroup | |
autocmd! | |
" Setup formatexpr specified filetype(s). | |
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
augroup end | |
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph | |
xmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>a <Plug>(coc-codeaction-selected) | |
" Remap for do codeAction of current line | |
nmap <leader>ac <Plug>(coc-codeaction) | |
" Fix autofix problem of current line | |
nmap <leader>qf <Plug>(coc-fix-current) | |
" Use <tab> for select selections ranges, needs server support, like: coc-tsserver, coc-python | |
" nmap <silent> <TAB> <Plug>(coc-range-select) | |
" xmap <silent> <TAB> <Plug>(coc-range-select) | |
" xmap <silent> <S-TAB> <Plug>(coc-range-select-backword) | |
" Use `:Format` to format current buffer | |
command! -nargs=0 Format :call CocAction('format') | |
" Use `:Fold` to fold current buffer | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
" use `:OR` for organize import of current buffer | |
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') | |
" Add status line support, for integration with other plugin, checkout `:h coc-status` | |
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} | |
" Using CocList | |
" Show all diagnostics | |
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr> | |
" Manage extensions | |
nnoremap <silent> <space>e :<C-u>CocList extensions<cr> | |
" Show commands | |
nnoremap <silent> <space>c :<C-u>CocList commands<cr> | |
" Find symbol of current document | |
nnoremap <silent> <space>o :<C-u>CocList outline<cr> | |
" Search workspace symbols | |
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr> | |
" Do default action for next item. | |
nnoremap <silent> <space>j :<C-u>CocNext<CR> | |
" Do default action for previous item. | |
nnoremap <silent> <space>k :<C-u>CocPrev<CR> | |
" Resume latest coc list | |
nnoremap <silent> <space>p :<C-u>CocListResume<CR> | |
" inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
" end coc setting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment