Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "standard vim settings
- :set nocompatible
- filetype off
- :set backupcopy=yes
- :set encoding=utf-8
- :set showcmd
- :set modelines=0
- :nmap <F1> <nop>
- set mouse=a
- set exrc
- "colorscheme
- syntax on
- let g:nord_italic_comments = 1
- let g:nord_comment_brightness = 20
- colorscheme nord
- "Get rid of TODO highlighting
- hi Todo guibg=NONE
- " nvim-specific settings
- if has('nvim')
- " Use system clipboard
- set clipboard=unnamed
- set clipboard+=unnamedplus
- else
- " Use system clipboard
- :set clipboard=unnamedplus
- set t_Co=256
- highlight Normal ctermbg=233 "fix background colors
- highlight NonText ctermbg=233 "fix background colors
- highlight LineNr ctermbg=234
- highlight Cursorline ctermbg=234
- highlight SignColumn ctermbg=234
- endif
- let g:SignatureMarkTextHL = "SignColumn"
- "tab settings
- set softtabstop=4
- set shiftwidth=4
- set tabstop=4
- set hidden
- set expandtab
- set cursorline
- set backspace=indent,eol,start
- set showmode!
- set undofile
- set ruler
- set colorcolumn=80
- set lazyredraw
- let mapleader = "\<Space>"
- "search settings -- NOTE: because of EnchantedVim we are always running in \v
- set ignorecase
- set smartcase
- set gdefault
- set incsearch
- set showmatch
- set hlsearch
- nnoremap <leader>/ :noh<cr> "<leader>/ to clear highlighting
- "repetition settings
- vnoremap . :normal .<CR>
- nnoremap ' `
- nnoremap ` @a
- vnoremap ` :normal @a<CR>
- "hotkeys
- nnoremap , ;
- vnoremap , ;
- nnoremap ; %
- nnoremap <silent> tt :tabnew<CR>
- nnoremap <silent> [g :tabprevious<CR>
- nnoremap <silent> ]g :tabnext<CR>
- nnoremap <silent> vv :vsp<CR>
- nnoremap <silent> ss :sp<CR>
- "splitting
- :set splitright
- :set splitbelow
- "add multi-line movement to jump list
- nnoremap <expr> k (v:count > 1 ? "m'" . v:count : '') . 'k'
- nnoremap <expr> j (v:count > 1 ? "m'" . v:count : '') . 'j'
- "hi Normal guibg=NONE ctermbg=NONE "Transparency
- :set number
- :set relativenumber
- set ttimeoutlen=0 "NOTE: if this causes issues, set to 5; reduces time to esc
- set timeoutlen=1000
- "vim-plug setup and plugins
- call plug#begin('~/.vim/plugged')
- " Settings
- Plug 'tpope/vim-sensible' "Sensible basic options
- Plug 'coot/EnchantedVim' "Persistent verymagic searches
- " Basic editing
- Plug 'ntpeters/vim-better-whitespace' "Whitespace stripping on save
- Plug 'Raimondi/delimitMate' "Autocomplete parentheses, etc
- " Aesthetics
- Plug 'mhinz/vim-signify' "Git changes displayed in gutter and statusline, faster
- Plug 'kshenoy/vim-signature' "Mark display
- Plug 'vim-airline/vim-airline' "Status line
- Plug 'vim-airline/vim-airline-themes' "Themes for airline
- Plug 'arcticicestudio/nord-vim' "Nord colorscheme
- Plug 'kien/rainbow_parentheses.vim' "Colorful nested parentheses
- " Hotkeys (small)
- Plug 'scrooloose/nerdcommenter' "Enables commenting commands
- Plug 'tpope/vim-surround' "adds ds (delete surrounding x), cs, yss (place) commands
- Plug 'tpope/vim-unimpaired' "Smarter mapping pairs (]b, etc)
- Plug 'easymotion/vim-easymotion' "Letter-jump motion upgrades
- Plug 'christoomey/vim-tmux-navigator' "Navigate tabs with C-l, etc
- Plug 'qpkorr/vim-bufkill' "Close buffers without closing windows
- " Tools (big)
- Plug 'scrooloose/nerdtree' "File viewer panel
- Plug 'tpope/vim-fugitive' "Git integration
- Plug 'ctrlpvim/ctrlp.vim' "Fuzzy file finder
- Plug 'sjl/gundo.vim' "Graphical undo tree
- Plug 'majutsushi/tagbar' "Displays tag data, display with <leader>b
- Plug 'vimwiki/vimwiki' "Personal wiki for note-taking
- Plug 'w0rp/ale' "Asynch linting
- " Completion and snippets
- Plug 'ncm2/ncm2' "More powerful completion engine
- Plug 'Shougo/neosnippet' "Faster snippet engine
- Plug 'honza/vim-snippets' "Snippet database
- Plug 'Shougo/neosnippet-snippets'
- Plug 'Shougo/neoinclude.vim' "Include autocompletion
- Plug 'Shougo/neco-syntax' "Syntax autocompletion
- " Completion sources
- Plug 'ncm2/ncm2-bufword' "Words in buffer
- Plug 'ncm2/ncm2-path' "Path
- Plug 'ncm2/ncm2-tagprefix' "Tags
- Plug 'ncm2/ncm2-syntax' "Language syntax
- Plug 'ncm2/ncm2-neoinclude' "Includes
- Plug 'ncm2/ncm2-jedi' "Python
- Plug 'ncm2/ncm2-pyclang' "C/C++
- Plug 'ncm2/ncm2-vim' "Vimscript
- " Language-specific
- Plug 'Shougo/neco-vim' "Vim syntax autocompletion
- Plug 'roxma/ncm-clang' "C/C++ autocompletion
- Plug 'Vimjas/vim-python-pep8-indent' "Python indentation
- " Dependencies / Fixes
- Plug 'coot/CRDispatcher' "Utility plugin used by enchantedvim
- Plug 'jistr/vim-nerdtree-tabs' "Makes nerdtree work across tabs
- Plug 'tpope/vim-repeat' "Repetition for various plugins
- Plug 'xolox/vim-misc' "Dependency of easytags
- Plug 'xolox/vim-easytags' "Generates tag files
- Plug 'skywind3000/asyncrun.vim' "Asynch run shell commands; NOTE: nvim-specific
- Plug 'roxma/nvim-yarp' "Remote plugin framework
- " Disabled
- " Plug 'zxqfl/tabnine-vim' "ML-sourced autocomplete: TODO: Make work with ncm2
- " Plug 'mileszs/ack.vim'
- " Plug 'maxbrunsfeld/vim-yankstack'
- " Plug 'ap/vim-css-color'
- call plug#end()
- " configure ncm2
- autocmd BufEnter * call ncm2#enable_for_buffer()
- set completeopt=noinsert,menuone,noselect
- " NOTE: select and use shift-k to see function documentation in python!
- set shortmess+=c "Remove completion menu messages
- let ncm2#popup_delay = 5 "make ncm2 faster
- " let ncm2#complete_length = [[1,1]]
- " let g:ncm2#matcher = 'substrfuzzy'
- " Use tab to select menu
- inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
- inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
- inoremap <silent> <expr> <CR> (pumvisible() && empty(v:completed_item)) ? "\<c-y>\<cr>" : "\<CR>"
- " integrate neosnippet
- imap <c-k> <Plug>(neosnippet_expand_or_jump)
- vmap <c-k> <Plug>(neosnippet_expand_or_jump)
- smap <c-k> <Plug>(neosnippet_expand_or_jump)
- inoremap <silent> <c-u> <c-r>=cm#sources#neosnippet#trigger_or_popup("\<Plug>(neosnippet_expand_or_jump)")<cr>
- vmap <c-u> <Plug>(neosnippet_expand_target)
- " expand parameters
- let g:neosnippet#enable_completed_snippet=1
- " interval before computing calculation to make typing faster
- " let g:cm_complete_start_delay=0
- " Configure neosnippet
- autocmd InsertLeave * NeoSnippetClearMarkers "Delete markers when we leave insert mode
- let g:neosnippet#snippets_directory='~/.vim/snippets'
- " Configure sources
- let g:ncm2_pyclang#library_path = '/usr/lib'
- "Gundo setup
- nnoremap <leader>h :GundoToggle<CR>
- "Ctrlp setup
- let g:ctrlp_switch_buffer = 0 "Allow opening the same buffer twice
- " let g:ctrlp_custom_ignore = '\v(doxygen)|(\.(swp|git|gitkeep))$'
- if executable('rg')
- set grepprg=ag\ --nogroup\ --nocolor
- let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
- endif
- "Git setup
- let g:airline#extensions#hunks#non_zero_only = 1 "Only display 'hunks' if diff is nonzero
- " Signify (git diff in sign column) setup
- let g:signify_vcs_list = ['git']
- let g:signify_line_highlight = 0
- let g:signify_sign_change = '~'
- highlight clear DiffAdd "Signify colors: currently none
- highlight clear DiffChange
- highlight clear DiffDelete
- highlight clear SignifySignAdd
- highlight clear SignifySignChange
- highlight clear SignifySignDelete
- "vim-airline setup
- let g:airline_powerline_fonts = 1 "Preload powerline fonts
- set laststatus=2 "Always show statusline
- let g:airline_theme='nord'
- let g:airline#extensions#tabline#enabled = 1
- let g:airline#extensions#ale#enabled = 1
- let g:airline#extensions#tagbar#enabled = 0
- let g:airline_detect_paste=0
- "vim-better-whitespace setup
- autocmd BufEnter * EnableStripWhitespaceOnSave
- autocmd BufEnter * DisableWhitespace
- "vim-sensible setup
- runtime! plugin/sensible.vim
- "delimitmate setup
- let delimitMate_expand_cr = 1
- augroup mydelimitMate
- au!
- au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
- au FileType tex let b:delimitMate_quotes = ""
- au FileType tex let b:delimitMate_matchpairs = "(:),{:},`:'"
- au FileType python let b:delimitMate_nesting_quotes = ['"', "'"]
- augroup end
- "nerdtree setup
- :map <leader>nt :NERDTreeTabsToggle<CR>
- let NERDTreeIgnore = ['\.pyc$', '__pycache__$[[dir]]']
- "NERD commenter setup
- let g:NERDSpaceDelims = 1 " Space after comment delimiters
- let g:NERDTrimTrailingWhitespace = 1
- let g:NERDDefaultAlign = 'left'
- " Ale setup
- let g:ale_lint_on_enter = 1
- let g:ale_lint_on_text_changed = 'always' "Set to 'never' for moar speed
- let g:ale_lint_on_insert_leave = 0
- let g:ale_lint_on_save = 1
- " let g:ale_set_loclist = 0
- " let g:ale_set_quickfix = 1
- let g:ale_open_list = 'never'
- let g:ale_list_vertical = 0
- let g:ale_linters = {
- \ 'python': ['flake8', 'prospector', 'mypy'],
- \ 'c': ['clang', 'clangtidy', 'gcc']
- \}
- let g:ale_echo_msg_format = '%linter%: %s'
- " pylint setup
- let g:ale_python_pylint_options = '--rcfile /home/whillikers/.pylintrc'
- " Close preview window when autocompletion is finished
- autocmd CompleteDone * pclose
- " Continuously make latex files on save
- autocmd BufWritePost *.tex :AsyncRun pdflatex *.tex
- "rainbowparentheses setup
- let g:rbpt_max = 3
- " au VimEnter * RainbowParenthesesToggle
- " au Syntax * RainbowParenthesesLoadRound
- " au Syntax * RainbowParenthesesLoadSquare
- " au Syntax * RainbowParenthesesLoadBraces
- "easytags setup
- set tags=./tags;,~/.vimtags
- let g:easytags_events = ['BufReadPost', 'BufWritePost']
- let g:easytags_async = 1
- let g:easytags_dynamic_files = 2
- let g:easytags_resolve_links = 1
- let g:easytags_suppress_ctags_warning = 1
- "tagbar setup
- nmap <silent> <leader>b :TagbarToggle<CR>
- "vimwiki setup
- let g:vimwiki_list = [
- \{'path': '~/doc/notes/vimwiki/index.wiki'},
- \]
- " C/C++ setup
- autocmd BufNewFile,BufRead *.h if !empty(globpath('.', '*.c')) | setlocal ft=c | endif
- let g:ale_c_clangtidy_checks = ['*', '-llvm-include-order', '-google-readability-todo', '-clang-diagnostic-error', '-header-filter']
- let g:ale_c_clang_options = '-std=c11 -Wall'
- " Avoid redrawing on every entered character by turning off arabic shaping
- if has('arabic')
- set noarabicshape
- endif
- " Ocaml setup
- set wildignore+=*.cmi,*.cmo,*.dta,*.dat
- "end-of-file stuff
- filetype plugin indent on
- " ## added by OPAM user-setup for vim / base ## 93ee63e278bdfc07d1139a748ed3fff2 ## you can edit, but keep this line
- let s:opam_share_dir = system("opam config var share")
- let s:opam_share_dir = substitute(s:opam_share_dir, '[\r\n]*$', '', '')
- let s:opam_configuration = {}
- function! OpamConfOcpIndent()
- execute "set rtp^=" . s:opam_share_dir . "/ocp-indent/vim"
- endfunction
- let s:opam_configuration['ocp-indent'] = function('OpamConfOcpIndent')
- function! OpamConfOcpIndex()
- execute "set rtp+=" . s:opam_share_dir . "/ocp-index/vim"
- endfunction
- let s:opam_configuration['ocp-index'] = function('OpamConfOcpIndex')
- function! OpamConfMerlin()
- let l:dir = s:opam_share_dir . "/merlin/vim"
- execute "set rtp+=" . l:dir
- endfunction
- let s:opam_configuration['merlin'] = function('OpamConfMerlin')
- let s:opam_packages = ["ocp-indent", "ocp-index", "merlin"]
- let s:opam_check_cmdline = ["opam list --installed --short --safe --color=never"] + s:opam_packages
- let s:opam_available_tools = split(system(join(s:opam_check_cmdline)))
- for tool in s:opam_packages
- " Respect package order (merlin should be after ocp-index)
- if count(s:opam_available_tools, tool) > 0
- call s:opam_configuration[tool]()
- endif
- endfor
- " ## end of OPAM user-setup addition for vim / base ## keep this line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement