set nocompatible syntax on let VIMHOME = split(&rtp, ",")[0] let $VIMHOME = VIMHOME " vim-plug call plug#begin(VIMHOME."/plugs") " Plug 'Valloric/YouCompleteMe' Plug 'nixprime/cpsm', {'do': './install.sh'} Plug 'kien/ctrlp.vim' Plug 'prabirshrestha/asyncomplete.vim' Plug 'prabirshrestha/vim-lsp' Plug 'prabirshrestha/asyncomplete-lsp.vim' Plug 'ervandew/supertab' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'ConradIrwin/vim-bracketed-paste' Plug 'NLKNguyen/papercolor-theme' Plug 'Shougo/deoplete.nvim' Plug 'christoomey/vim-tmux-navigator' Plug 'cohama/lexima.vim', {'do': 'sed -i \"s/has(.nvim.) && //\" autoload/lexima/insmode.vim'} Plug 'editorconfig/editorconfig-vim' Plug 'gmarik/Vundle.vim' Plug 'hdima/python-syntax' Plug 'jeetsukumaran/vim-buffergator' Plug 'kristijanhusak/vim-hybrid-material' Plug 'lambdalisue/fern.vim' Plug 'lervag/vimtex' Plug 'neovimhaskell/haskell-vim' Plug 'nvie/vim-flake8' Plug 'octol/vim-cpp-enhanced-highlight' Plug 'pangloss/vim-javascript' Plug 'posva/vim-vue' Plug 'rhysd/vim-grammarous' Plug 'roxma/nvim-yarp' Plug 'roxma/vim-hug-neovim-rpc' Plug 'tmux-plugins/vim-tmux' Plug 'tmux-plugins/vim-tmux-focus-events' Plug 'tomtom/tcomment_vim' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'vim-scripts/indentpython.vim' Plug 'vimwiki/vimwiki' call plug#end() let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py' let mapleader="," :command W w :command Q q :command WQ wq :command Wq wq nnoremap j gj nnoremap k gk nnoremap nnoremap " don't store .swp files in the file's own directory " neither for .ext~ files set directory=/home/user/.vim/tmp/ set backupdir=/home/user/.vim/tmp/ " VimWiki let g:vimwiki_key_mappings = { 'table_mappings': 0 } let g:vimwiki_markdown_link_ext = 1 autocmd FileType vimwiki setlocal shiftwidth=2 softtabstop=2 expandtab " Autoindent for filetype filetype plugin indent on set autoindent set encoding=utf-8 set scrolloff=5 set sidescrolloff=10 set completeopt-=preview set backspace=indent,eol,start " Splits set splitbelow set splitright " CtrlP let g:ctrlp_match_func = {'match': 'cpsm#CtrlPMatch'} nnoremap :CtrlPBuffer let g:cpsm_unicode=1 let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] " Unsaved buffer switching set hidden " Line numbering set number set numberwidth=4 :set mouse=a " Allow xterm-key usage inside tmux execute "set =\e[1;*A" execute "set =\e[1;*B" execute "set =\e[1;*C" execute "set =\e[1;*D" " Persistent undo set undodir=~/.vim/undodir/ set undofile set undolevels=1000 set undoreload=10000 " Searching set ignorecase set smartcase set incsearch set hlsearch nnoremap :noh " Text wrapping set lbr " Vimtex let g:tex_flavor = 'latex' " Tabs if has("autocmd") filetype plugin indent on autocmd FileType make set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab endif " Terminal colors set t_Co=256 set background=dark let g:airline_theme="solarized" let g:airline_solarized_bg="dark" set tabstop=4 set shiftwidth=4 set softtabstop=4 set expandtab " Commenting nnoremap c :TComment nnoremap C :TCommentBlock vnoremap c :TCommentInline vnoremap C :TCommentBlock " Tab completion set wildmode=longest,list set wildmenu set guifont=Ubuntu\ Mono\ derivative\ Powerline\ 13 let g:airline_powerline_fonts = 1 set laststatus=2 set ttimeoutlen=50 " Color scheme syntax enable let python_highlight_all=1 let g:solarized_termcolors=256 colorscheme hybrid_material " Remap u to y vnoremap u y " Save clipboard on quit autocmd VimLeave * call system("xsel -ib", getreg('+')) " Automatically remove trailing spaces let blacklist = ['vimwiki'] autocmd BufWritePre * if index(blacklist, &ft) < 0 | :%s/\s\+$//e " Use deoplete. autocmd FileType python let g:deoplete#enable_at_startup = 1 " VPW: set filetype for .py3 autocmd BufRead,BufNewFile *.py3 set filetype=python " Vue indent autocmd FileType vue setlocal shiftwidth=2 softtabstop=2 expandtab autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab autocmd FileType vue syntax sync fromstart " Disable shift+k for manual lookup map " Prolog: set filetype for .pl autocmd BufRead,BufNewFile *.pl set filetype=prolog " Disable modelines, fix CVE set modelines=0 set nomodeline " Coc extensions set updatetime=300 set shortmess+=c if has("nvim-0.5.0") || has("patch-8.1.1564") " Recently vim can merge signcolumn and number column into one set signcolumn=number else set signcolumn=yes endif let g:coc_global_extensions = [] command! -nargs=1 Ext :call add(g:coc_global_extensions, ) let g:coc_filetype_map = {'tex': 'latex', 'md': 'markdown'} nmap p (coc-diagnostic-prev) nmap n (coc-diagnostic-next) nmap f (coc-codeaction-line) vmap f (coc-codeaction-line) nmap gd (lsp-definition) nnoremap p :CocList yank vnoremap p :CocList yank Ext 'coc-snippets' Ext 'coc-emoji' Ext 'coc-highlight' Ext 'coc-emmet' " Ext 'coc-omnisharp' Ext 'coc-vimtex' Ext 'coc-json' Ext 'coc-java' Ext 'coc-pyright' Ext 'coc-css' Ext 'coc-html' Ext 'coc-cmake' Ext 'coc-clangd' Ext 'coc-docker' Ext 'coc-fzf-preview' Ext 'coc-ltex' Ext 'coc-vetur' Ext 'coc-yank' " Ext 'coc-sh' " FZF Preview nnoremap / :CocCommand fzf-preview.Lines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'" nnoremap :CocCommand fzf-preview.ProjectGrepRecall nnoremap d :CocCommand fzf-preview.CocCurrentDiagnostics nnoremap d :CocCommand fzf-preview.CocCurrentDiagnostics delc Ext " Language Server if executable('pyls') " pip install python-language-server au User lsp_setup call lsp#register_server({ \ 'name': 'pyls', \ 'cmd': {server_info->['pyls']}, \ 'allowlist': ['python'], \ }) endif function! s:on_lsp_buffer_enabled() abort setlocal omnifunc=lsp#complete setlocal signcolumn=yes if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif nmap gs (lsp-document-symbol-search) nmap gS (lsp-workspace-symbol-search) nmap gr (lsp-references) nmap gi (lsp-implementation) nmap gt (lsp-type-definition) nmap rn (lsp-rename) nmap [g (lsp-previous-diagnostic) nmap ]g (lsp-next-diagnostic) nmap K (lsp-hover) nnoremap lsp#scroll(+4) nnoremap lsp#scroll(-4) let g:lsp_format_sync_timeout = 1000 autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync') " refer to doc to add more commands endfunction augroup lsp_install au! " call s:on_lsp_buffer_enabled only for languages that has the server registered. autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() augroup END " Tab for completion let g:SuperTabContextDefaultCompletionType = "" let g:SuperTabDefaultCompletionType = "" " Go to Defintion CoC nmap gd :call CocActionAsync('jumpDefinition')