Last active
April 28, 2021 03:59
-
-
Save Climax777/ef703ea372a15e36d90c to your computer and use it in GitHub Desktop.
My vimrc file, based on the example vimrc file in Ubuntu, adding a LOT of plugins and settings
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
" An updated vimrc from the unix example. | |
" GistID: ef703ea372a15e36d90c | |
" Maintainer: Pieter Jordaan | |
" Last change: 13 Sept 2020 | |
" | |
" To use it, copy it to | |
" for Unix and OS/2: ~/.vimrc | |
" for Amiga: s:.vimrc | |
" for MS-DOS and Win32: $VIM\_vimrc | |
" for OpenVMS: sys$login:.vimrc | |
" When started as "evim", evim.vim will already have done these settings. | |
if v:progname =~? "evim" | |
finish | |
endif | |
let $FZF_DEFAULT_COMMAND="rg --files --follow --hidden" | |
set shell=/bin/bash | |
set encoding=utf-8 | |
" Use Vim settings, rather than Vi settings (much better!). | |
" This must be first, because it changes other options as a side effect. | |
set nocompatible | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
" TODO watch for vim-gutentags, could be useful | |
" My plugin selection | |
" Editorconfig support | |
Plugin 'editorconfig/editorconfig-vim' | |
" Git control in VIM | |
Plugin 'tpope/vim-fugitive' | |
" Tmux support | |
Plugin 'benmills/vimux' | |
" Easy motion plugin allows for faster search motion | |
Plugin 'Lokaltog/vim-easymotion' | |
" Auto brace insert | |
" Plugin 'Raimondi/delimitMate' using auto-pairs now | |
Plugin 'jiangmiao/auto-pairs' | |
" Vim indent guides | |
Plugin 'nathanaelkane/vim-indent-guides' | |
" Tree-based file browser | |
Plugin 'scrooloose/nerdtree' | |
" Smart commenting | |
Plugin 'scrooloose/nerdcommenter' | |
" Tabulate stuff | |
Plugin 'godlygeek/tabular' | |
" Surround stuff | |
Plugin 'tpope/vim-surround' | |
" Minimap for vim | |
Plugin 'severin-lemaignan/vim-minimap' | |
" CtrlP fuzzy buffer searching | |
"Plugin 'ctrlpvim/ctrlp.vim' REPLACED WITH FZF | |
" install ripgrep and fzf | |
Plugin 'junegunn/fzf' | |
Plugin 'junegunn/fzf.vim' | |
" Buffergator helps manage buffers | |
"Plugin 'jeetsukumaran/vim-buffergator' REPLACED WITH FZF | |
" Allow surround (and other plugins) to use the . operator for repeating | |
Plugin 'tpope/vim-repeat' | |
" Snippets with snipmate | |
Plugin 'SirVer/ultisnips' | |
Plugin 'honza/vim-snippets' | |
" The famous taglist plugin with JS support | |
Plugin 'taglist.vim' | |
"Plugin 'vim-scripts/taglist-plus' | |
"Plugin 'majutsushi/tagbar' | |
" The famous cscope | |
Plugin 'cscope.vim' | |
" Alternative for ack: Ag, note install sudo apt-get install silversearcher-ag | |
"Plugin 'gabesoft/vim-ags' REPLACED BY fzf | |
" Better grepping by acking | |
" Plugin 'mileszs/ack.vim' | |
" completion Stuff https://github.com/Valloric/YouCompleteMe | |
" Remember to install libclang, cmake, python-dev | |
Plugin 'Valloric/YouCompleteMe' | |
"Plugin 'tenfyzhong/CompleteParameter.vim' | |
" YCM generator | |
"Plugin 'rdnetto/YCM-Generator' | |
" Color schemes | |
Plugin 'flazz/vim-colorschemes' | |
Plugin 'CSApprox' | |
Plugin 'morhetz/gruvbox' | |
" Visual undo tree | |
Plugin 'mbbill/undotree' | |
" Airline statusline | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'airblade/vim-gitgutter' | |
" GitHub Stuff | |
Plugin 'mattn/webapi-vim' | |
Plugin 'mattn/gist-vim' | |
" Pastebin | |
Plugin 'mattn/pastebin-vim' | |
" Cmake stuff | |
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
"Plugin 'jalcine/cmake.vim' " gives errors | |
" Java stuff | |
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
Plugin 'tfnico/vim-gradle' | |
" C++ stuff | |
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
" requires pip install pyclewn | |
" follow instructions on http://pyclewn.sourceforge.net/install.html | |
Plugin 'Shougo/vimproc.vim' | |
Plugin 'idanarye/vim-vebugger' | |
Plugin 'vim-scripts/a.vim' | |
Plugin 'tenfyzhong/vim-gencode-cpp' | |
" HTML Stuff | |
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
" Emmet - HTML scaffolding stuff | |
Plugin 'mattn/emmet-vim' | |
" Node and JS specific | |
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
Plugin 'moll/vim-node' | |
" Multiple syntax files | |
Plugin 'sheerun/vim-polyglot' | |
"Node Autocomplete | |
"Plugin 'ahayman/vim-nodejs-complete' | |
" Syntax checking. Check https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers | |
"Plugin 'scrooloose/syntastic' | |
" Linting for js/ts | |
Plugin 'dense-analysis/ale' | |
" Angular snippets | |
Plugin 'matthewsimo/angular-vim-snippets' | |
" Node completion | |
" Node snippets | |
Plugin 'jamescarr/snipmate-nodejs' | |
" UUID generator | |
Plugin 'kburdett/vim-nuuid' | |
" Difftool | |
Plugin 'will133/vim-dirdiff' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" To ignore plugin indent changes, instead use: "filetype plugin on | |
" | |
" Brief help | |
" :PluginList - list configured plugins | |
" :PluginInstall(!) - install (update) plugins | |
" :PluginSearch(!) foo - search (or refresh cache first) for foo | |
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" Put your non-Plugin stuff after this line | |
" allow backspacing over everything in insert mode | |
set backspace=indent,eol,start | |
if has("vms") | |
set nobackup " do not keep a backup file, use versions instead | |
else | |
set backup " keep a backup file | |
endif | |
set history=50 " keep 50 lines of command line history | |
set ruler " show the cursor position all the time | |
set showcmd " display incomplete commands | |
set incsearch " do incremental searching | |
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries | |
" let &guioptions = substitute(&guioptions, "t", "", "g") | |
" Don't use Ex mode, use Q for formatting | |
map Q gq | |
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, | |
" so that you can undo CTRL-U after inserting a line break. | |
inoremap <C-U> <C-G>u<C-U> | |
" In many terminal emulators the mouse works just fine, thus enable it. | |
if has('mouse') | |
set mouse=a | |
endif | |
" Switch syntax highlighting on, when the terminal has colors | |
" Also switch on highlighting the last used search pattern. | |
if &t_Co > 2 || has("gui_running") | |
syntax on | |
set hlsearch | |
set cursorline | |
if &term =~ '^\(xterm\|screen\)$' && $COLORTERM == 'gnome-terminal' | |
set t_Co=256 | |
elseif (&term == 'xterm' || &term =~? '^screen') | |
" On my machine, I use an old Konsole with 256 color support | |
set t_Co=256 | |
let g:CSApprox_konsole = 1 | |
endif | |
endif | |
if exists('+termguicolors') | |
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" | |
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" | |
set termguicolors | |
let &t_Cs = "\e[4:3m" | |
let &t_Ce = "\e[4:0m" | |
endif | |
" Only do this part when compiled with support for autocommands. | |
if has("autocmd") | |
" Enable file type detection. | |
" Use the default filetype settings, so that mail gets 'tw' set to 72, | |
" 'cindent' is on in C files, etc. | |
" Also load indent files, to automatically do language-dependent indenting. | |
filetype plugin indent on | |
" Put these in an autocmd group, so that we can delete them easily. | |
augroup vimrcEx | |
au! | |
" For all text files set 'textwidth' to 78 characters. | |
autocmd FileType text setlocal textwidth=78 | |
" When editing a file, always jump to the last known cursor position. | |
" Don't do it when the position is invalid or when inside an event handler | |
" (happens when dropping a file on gvim). | |
" Also don't do it when the mark is in the first line, that is the default | |
" position when opening a file. | |
autocmd BufReadPost * | |
\ if line("'\"") > 1 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
augroup END | |
else | |
set autoindent " always set autoindenting on | |
endif " has("autocmd") | |
" Convenient command to see the difference between the current buffer and the | |
" file it was loaded from, thus the changes you made. | |
" Only define it when not defined already. | |
if !exists(":DiffOrig") | |
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis | |
\ | wincmd p | diffthis | |
endif | |
" My own additions | |
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
" No backups | |
set nobackup | |
" Line numbers | |
set number | |
" This will allow 5 lines for the cursor to see context | |
set scrolloff=5 | |
" Don't wrap lines | |
"set nowrap | |
"get out of insert mode more quickly | |
"you'd have to be really unlucky to | |
"have to type "kj" in a real world | |
"use case | |
inoremap kj <Esc> | |
"add a semicolon ';' at the end of the line | |
nnoremap ;; A;<Esc> | |
" some tab defaults | |
set tabstop=4 | |
set shiftwidth=4 | |
set smarttab | |
set smartindent | |
set expandtab | |
" use noexpandtab for tabs rather than spaces | |
"set noexpandtab | |
set softtabstop=4 | |
" Smart case | |
set ignorecase | |
set smartcase | |
" Mouse searching | |
set mousemodel=extend | |
" Spell checking | |
set spell spelllang=en | |
" Undotree | |
if has("persistent_undo") | |
set undodir=~/.undodir/ | |
set undofile | |
endif | |
" Editorconfig settings | |
let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] | |
" Airline settings | |
set laststatus=2 | |
let g:airline_powerline_fonts = 1 | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#ale#enabled = 1 | |
"let g:airline_theme='onehalfdark' | |
"let g:airline_theme='sonokai' | |
"let g:airline_theme='gruvbox' | |
" Folding | |
set foldmethod=indent | |
set nofoldenable | |
" Json issues | |
let g:vim_json_syntax_conceal = 0 | |
au BufRead,BufNewFile *.json set filetype=json | |
au BufRead,BufNewFile *.jsonp set filetype=jsonp | |
" NERDTree Mapping | |
map <C-n> :NERDTreeToggle<CR> | |
" ALE | |
let g:ale_linters_explicit = 1 | |
let g:ale_sign_error = '' | |
let g:ale_sign_warning = '' | |
let g:ale_javascript_eslint_executable = 'eslint_d' | |
let g:ale_typescript_eslint_executable = 'eslint_d' | |
let g:ale_fixers = { | |
\ 'javascript': ['eslint'], | |
\ 'typescript': ['eslint'] | |
\ } | |
map <Leader>ff :ALEFix<CR> | |
let g:ale_fix_on_save = 1 | |
nmap <silent> [c <Plug>(ale_previous_wrap) | |
nmap <silent> ]c <Plug>(ale_next_wrap) | |
" Syntastic | |
"set statusline+=%#warningmsg# | |
"set statusline+=%{SyntasticStatuslineFlag()} | |
"set statusline+=%* | |
"let g:syntastic_always_populate_loc_list = 1 | |
"let g:syntastic_auto_loc_list = 0 | |
"let g:syntastic_check_on_open = 1 | |
"let g:syntastic_check_on_wq = 0 | |
"let g:syntastic_java_checkers = [] | |
"let g:syntastic_javascript_checkers = ['eslint'] | |
"let g:syntastic_javascript_eslint_exec = 'eslint_d' | |
"let g:syntastic_typescript_checkers = ['eslint'] | |
"let g:syntastic_typescript_eslint_exec = 'eslint_d' | |
" Sonokai theme | |
" the configuration options should be placed before `colorscheme sonokai` | |
"let g:sonokai_style = 'atlantis' | |
"let g:sonokai_enable_italic = 1 | |
"let g:sonokai_disable_italic_comment = 0 | |
"let g:sonokai_transparent_background = 1 | |
" Gruvbox theme | |
" the configuration options should be placed before `colorscheme gruvbox` | |
let g:gruvbox_italic=1 | |
let g:gruvbox_italicize_strings=1 | |
let g:gruvbox_bold=1 | |
let g:gruvbox_underline=1 | |
let g:gruvbox_undercurl=1 | |
let g:gruvbox_contrast_dark='soft' | |
"let g:gruvbox_improved_strings=1 | |
let g:gruvbox_improved_warnings=1 | |
let g:gruvbox_guisp_fallback='fg' | |
" Color scheme | |
set background=dark | |
"colorscheme onehalfdark | |
"colorscheme sonokai | |
colorscheme gruvbox | |
"colorscheme darkspectrum | |
"colorscheme wombat256grf | |
" gitgutter | |
"let g:gitgutter_use_colorscheme = 1 | |
"highlight clear SignColumn | |
"highlight GitGutterAdd guifg=#009900 ctermfg=2 | |
"highlight GitGutterChange guifg=#bbbb00 ctermfg=3 | |
"highlight GitGutterDelete guifg=#ff2222 ctermfg=1 | |
" Auto pairs | |
let g:AutoPairsMultilineClose = 0 " Don't close on next line | |
" youcompleteme | |
let g:ycm_autoclose_preview_window_after_completion = 1 | |
let g:ycm_use_clangd = 1 | |
let g:ycm_confirm_extra_conf = 0 | |
let g:ycm_auto_trigger = 1 | |
let g:ycm_collect_identifiers_from_tags_files = 1 | |
"let g:ycm_register_as_syntastic_checker = 1 | |
let g:ycm_seed_identifiers_with_syntax = 0 | |
let g:ycm_always_populate_location_list = 1 | |
let g:ycm_error_symbol = '' | |
let g:ycm_warning_symbol = ' ' | |
" clangd setup: sudo apt install clang-tools-8; | |
" and sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-8 100 | |
" Let clangd fully control code completion | |
let g:ycm_clangd_uses_ycmd_caching = 0 | |
" Use installed clangd, not YCM-bundled clangd which doesn't get updates. | |
let g:ycm_clangd_binary_path = exepath("clangd") | |
nnoremap <leader>gD :YcmCompleter GoToDeclaration<CR> | |
nnoremap <leader>gd :YcmCompleter GoToDefinitionElseDeclaration<CR> | |
" Gvim font | |
if has('gui_running') | |
set guifont=UbuntuMono\ Nerd\ Font\ 12 | |
endif | |
if has('unix') | |
let g:ycm_python_binary_path = '/usr/bin/python3' | |
"let g:syntastic_python_python_exec = '/usr/bin/python3' | |
"let g:syntastic_check_on_open = 0 | |
"let g:syntastic_check_on_open = 1 | |
"let g:syntastic_check_on_wq = 1 | |
"let g:syntastic_aggregate_errors = 1 | |
"let g:syntastic_python_checkers = ['pyflakes'] | |
"let g:syntastic_python_pyflakes_args = '--' | |
"let g:syntastic_javascript_checkers = ['ycm','eslint'] | |
"let g:syntastic_typescript_checkers = ['ycm','eslint'] | |
endif | |
" UltiSnips | |
let g:UltiSnipsExpandTrigger="<c-j>" | |
let g:UltiSnipsJumpForwardTrigger="<c-b>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-z>" | |
" Pyclewn | |
let g:pyclewn_python = 'python3' | |
" Indent guides | |
let g:indent_guides_enable_on_vim_startup = 1 | |
" Markdown syntax for other markdown files | |
autocmd BufNewFile,BufReadPost *.md set filetype=markdown | |
" Conque shell get it here: https://code.google.com/p/conque/downloads/detail?name=conque_2.3.vmb open with vim and :so % | |
let g:ConqueTerm_StartMessages = 0 | |
" fzf setup | |
nnoremap <C-p> :Files<CR> | |
nnoremap <Leader>b :Buffers<CR> | |
nnoremap <Leader>h :History<CR> | |
nnoremap <Leader>t :BTags<CR> | |
nnoremap <Leader>T :Tags<CR> | |
" cscope setup | |
if has("cscope") | |
set csprg=/usr/bin/cscope | |
set csto=0 | |
set cst | |
set nocsverb | |
" add any database in current directory | |
if filereadable("cscope.out") | |
cs add cscope.out | |
" else add database pointed to by environment | |
elseif $CSCOPE_DB != "" | |
cs add $CSCOPE_DB | |
endif | |
set csverb | |
set cscopequickfix=s-,c-,d-,i-,t-,e-,a- | |
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR> | |
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> | |
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>a :cs find a <C-R>=expand("<cword>")<CR><CR> | |
endif | |
" vebugger setup | |
let g:vebugger_leader='<Leader>d' | |
" vimux setup | |
" " Run the current file with rspec | |
" TODO map <Leader>rb :call VimuxRunCommand("clear; rspec " . bufname("%"))<CR> | |
" Prompt for a command to run | |
map <Leader>vp :VimuxPromptCommand<CR> | |
" Run last command executed by VimuxRunCommand | |
map <Leader>vl :VimuxRunLastCommand<CR> | |
" Inspect runner pane | |
map <Leader>vi :VimuxInspectRunner<CR> | |
" Close vim tmux runner opened by VimuxRunCommand | |
map <Leader>vq :VimuxCloseRunner<CR> | |
" Interrupt any command running in the runner pane | |
map <Leader>vx :VimuxInterruptRunner<CR> | |
" Zoom the runner pane (use <bind-key> z to restore runner pane) | |
map <Leader>vz :call VimuxZoomRunner()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment