set nocompatible " be iMproved, required filetype off " required call plug#begin('~/.vim/plugged') " Ctrlp for fuzzy file search Plug 'ctrlpvim/ctrlp.vim' " File browser Plug 'scrooloose/nerdtree' " tab support for nerdtree Plug 'jistr/vim-nerdtree-tabs' " Snippet handler " Plug 'SirVer/ultisnips' " snippets for ultisnips " Plug 'honza/vim-snippets' " supertab for completion " Plug 'ervandew/supertab' " YouCompleteMe auto-completion " Plug 'Valloric/YouCompleteMe' " More clever matching for % key Plug 'tmhedberg/matchit' " JavaScript syntax highlighting " Plug 'pangloss/vim-javascript' " jsx syntax highlighting " Plug 'mxw/vim-jsx' " Language server protocol linter " Plug 'w0rp/ale' " fugitive.vim git integration Plug 'tpope/vim-fugitive' " Clojure highlight " Plug 'guns/vim-clojure-static' " Surround Plug 'tpope/vim-surround' " Repeat of plugin commands Plug 'tpope/vim-repeat' " Ack.vim -- can use ag with this Plug 'mileszs/ack.vim' " Haskell syntax Plug 'neovimhaskell/haskell-vim' " Typescript syntax Plug 'leafgarland/typescript-vim' call plug#end() " All of your Plugins must be added before the following line filetype plugin indent on " required syntax on "Set the status line options.Make it show more information. set laststatus=2 set statusline=%{FugitiveStatusline()}\ %F%m%r%h%w\ [BUF=%n]\ [FORMAT=%{&ff}]\ [FO=%{&fo}]\ [TYPE=%Y]\ [POS=%l,%v]\[%p%%]\ %{strftime(\"%d/%m/%y\ -\%H:%M\")} "set line no, buffer, search, highlight, autoindent and more. set nu set hidden set ignorecase set incsearch set smartcase set showmatch " set autoindent set ruler set vb set noerrorbells set showcmd set mouse=a set history=1000 set undolevels=1000 " highlight search results set hlsearch " show tabs and spaces set list set listchars=tab:>··,trail:· hi SpecialKey ctermfg=darkgrey " make delimitMate insert another line when " closing curlys for example let delimitMate_expand_cr = 1 " make YCM load with python 3 let g:ycm_server_python_interpreter = '/usr/bin/python2' " YCM non-arch package install path to ycm extra conf "let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py" " YCM extra configuration for arch specific YCM package "let g:ycm_global_ycm_extra_conf = '/usr/share/vim/vimfiles/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' "let g:ycm_path_to_python_interpreter = '/usr/bin/python2' " Eclim completion method should be set to omnifunc in order to work with YCM let g:EclimCompletionMethod = 'omnifunc' " let syntastic handle the syntax checking let g:ycm_show_diagnostics_ui = 0 " make YCM compatible with UltiSnips (using supertab) let g:ycm_key_list_select_completion = ['', ''] let g:ycm_key_list_previous_completion = ['', ''] let g:SuperTabDefaultCompletionType = '' " better key bindings for UltiSnipsExpandTrigger let g:UltiSnipsExpandTrigger = "" let g:UltiSnipsJumpForwardTrigger = "" let g:UltiSnipsJumpBackwardTrigger = "" " Leader maps let mapleader="," let maplocalleader="\\" map n NERDTreeTabsToggle autocmd VimEnter * wincmd p "for ino completion "autocmd BufNewFile,BufRead *.ino setlocal ft=arduino " IMPORTANT: grep will sometimes skip displaying the file name if you " search in a singe file. This will confuse Latex-Suite. Set your grep " program to always generate a file-name. " set grepprg=grep\ -nH\ $* " OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to " 'plaintex' instead of 'tex', which results in vim-latex not being loaded. " The following changes the default filetype back to 'tex': " let g:tex_flavor='latex' " Short commands ----------------------- " Searching for visually selected text vnoremap // y/"" " For latex compiling augroup latex_macros " { autocmd! autocmd FileType tex :nnoremap c :w :!latexmk -pdf % autocmd FileType tex :nnoremap v :!evince %:r.pdf & augroup END " } " JavaScript macros augroup html_macros " { autocmd! autocmd FileType html :nnoremap c :w :silent !firefox %:p & augroup END " } augroup javascript_macros " { autocmd! autocmd FileType javascript.jsx :nnoremap df :YcmCompleter GoTo augroup END " } " JSON macros augroup json_macros " { autocmd! autocmd FileType json :nnoremap fm :%!python -m json.tool augroup END " } " Haskell augroup haskell_stuff " { autocmd! autocmd BufNewFile,BufRead *.hsc set ft=haskell augroup END " } " C augroup c_stuff " { autocmd! autocmd BufNewFile,BufRead *.h set ft=c augroup END " } augroup verona_stuff " { autocmd! autocmd BufNewFile,BufRead *.verona set ft=typescript augroup end " } " Function for toggling the relative line numbers function ToggleRelative() if &relativenumber==1 set norelativenumber else set relativenumber endif endfunction " Macros for toggling relative number lines noremap :call ToggleRelative() inoremap :call ToggleRelative() function GrepAskForDir(specifier) let cw = expand("") let cwd = getcwd() call inputsave() let dir = input('Grep for word ' . cw . 'in dir: ') call inputrestore() execute 'Ack '. a:specifier . ' ' . dir endfunction noremap g :call GrepAskForDir(expand("")) function SetIdentWidth() call inputsave() let l:width = input('Set ident: ') call inputrestore() if l:width=='' set tabstop=8 shiftwidth=8 noexpandtab else let l:numw = str2nr(l:width, 10) execute 'set softtabstop=' . l:numw . ' shiftwidth=' . l:numw . ' expandtab' endif endfunction noremap i :call SetIdentWidth() noremap r :call ToggleRelative() " Automatically user relative lines when not in insert mode " au InsertLeave * :set relativenumber " au InsertEnter * :set norelativenumber " Syntastic settings "let g:syntastic_mode_map = { " \ "mode": "active", " \ "passive_filetypes": ["java", "scala"] } " Ale linter settings let g:ale_linters = { \ 'javascript': ['standard'], \} let g:ale_fixers = {'javascript': ['standard']} "let g:ale_lint_on_text_changed = 'never' " Ctrl-p settings "let g:ctrlp_max_files = 30000 let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] let g:ale_linters_explicit = 1 " hlsearch noremap h :nohlsearch " Ack if executable('ag') let g:ackprg = 'ag --vimgrep' endif digraphs \- 8866 digraphs -\ 8867 digraphs !( 8840 digraphs !) 8841 digraphs /< 10216 digraphs /> 10217 digraphs mt 8614 digraphs /( 8713 digraphs /) 8716 " Markdown let g:markdown_fenced_languages = ['python', 'typescript', 'javascript', 'haskell'] colorscheme habamax