set nocompatible syn on " Because Konsole font size " https://github.com/neovim/neovim/issues/6798 set guicursor= set nocscopeverbose set ignorecase set smartcase set modeline set modelines=5 set wildmode=longest:full set wildmenu set hlsearch set pastetoggle= set tw=0 set backspace=eol,indent,start set number "set mouse=a "Disabled "set grepprg=grep\ -nH\ $* set grepprg=rg\ --vimgrep\ $* let g:tex_flavor = "latex" setglobal formatoptions+=j " so that :find and :tabfind work set path=$PWD/** " in visual mode, show count set showcmd set scrolloff=3 " persistent-undo set undodir=~/.vim/undodir set undofile set runtimepath+=~/.vim/bundle/neobundle.vim/ " remove toolbar set guioptions-=T " remove menu set guioptions-=m set formatoptions+=j " Delete comment character when joining commented lines set history=1000 set tabpagemax=50 let mapleader="\" "if has("autocmd") && exists("+omnifunc") "autocmd Filetype * "\ if &omnifunc == "" | "\ setlocal omnifunc=syntaxcomplete#Complete | "\ endif "endif call neobundle#begin(expand('~/.vim/bundle/')) " Let NeoBundle manage NeoBundle NeoBundleFetch 'Shougo/neobundle.vim' " Recommended to install " After install, turn shell ~/.vim/bundle/vimproc, (n,g)make -f your_machines_makefile "NeoBundle 'Shougo/vimproc' NeoBundle 'hashivim/vim-terraform' NeoBundle 'CoatiSoftware/vim-sourcetrail' nnoremap sr :SourcetrailRefresh nnoremap sa :SourcetrailActivateToken "NeoBundle 'elixir-lang/vim-elixir' let g:ack_default_options = " -i --vimgrep" let g:ackprg = "rg -i --vimgrep" NeoBundle 'mileszs/ack.vim.git' noremap a :Ack! -t rust -t cpp -t c -t py noremap A :Ack! NeoBundle 'tpope/vim-fugitive' "Show + - ~ in the margin for vim modification NeoBundle "airblade/vim-gitgutter" let g:gitgutter_eager = 0 " only update on read/write NeoBundle 'kien/ctrlp.vim' "amazing search with ctrl p NeoBundle 'JazzCore/ctrlp-cmatcher' let g:ctrlp_match_func = {'match' : 'matcher#cmatch' } " Also search tags let g:ctrlp_extensions = ['tag'] noremap p :CtrlP noremap b :CtrlPBuffer "let g:ctrlp_working_path_mode = 'a' " Ignore some folders and files for CtrlP indexing let g:ctrlp_custom_ignore = { 'dir': '\.git$\|\CODENAME_Data' } NeoBundle 'git-time-lapse' NeoBundle 'Valloric/YouCompleteMe.git' let g:ycm_extra_conf_globlist = ['~/dab/*', '~/*'] let g:ycm_always_populate_location_list = 1 let g:ycm_rust_src_path = '/home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src' noremap y :YcmDiags noremap Y :YcmRestartServer noremap F :YcmCompleter FixIt:ccl let g:rust_recommended_style = 0 NeoBundle 'rust-lang/rust.vim' au FileType rust nmap m :make build NeoBundle 'tpope/vim-surround.git' NeoBundle 'taglist.vim' NeoBundle 'majutsushi/tagbar' noremap t :TagbarToggle NeoBundle 'ifdef-highlighting' NeoBundle 'ciaranm/detectindent' "adapts tabstop and this shit automagically NeoBundle "scrooloose/nerdtree" " Nice tabulation NeoBundle 'godlygeek/tabular' "http://vimcasts.org/episodes/aligning-text-with-tabular-vim/ let g:Powerline_symbols = 'unicode' function! ToggleFullScreen() call system("wmctrl -i -r ".v:windowid." -b toggle,fullscreen") redraw endfunction colorscheme bramwombat if has("nvim") set termguicolors set noincsearch tnoremap let g:terminal_color_0 = '#2e3436' let g:terminal_color_1 = '#cc0000' let g:terminal_color_2 = '#4e9a06' let g:terminal_color_3 = '#c4a000' let g:terminal_color_4 = '#4475b4' let g:terminal_color_5 = '#75507b' let g:terminal_color_6 = '#0b939b' let g:terminal_color_7 = '#d3d7cf' let g:terminal_color_8 = '#555753' let g:terminal_color_9 = '#ef2929' let g:terminal_color_10 = '#8ae234' let g:terminal_color_11 = '#fce94f' let g:terminal_color_12 = '#729fcf' let g:terminal_color_13 = '#ad7fa8' let g:terminal_color_14 = '#00f5e9' let g:terminal_color_15 = '#eeeeec' elseif has("gui_running") set guifont="Source Code Pro Medium 15" nnoremap :call ToggleFullScreen() if has("gui_win32") set guifont=Lucida_Console:h10:cANSI endif else set t_Co=256 endif set cursorline "set a sudo vim cmap w!! w !sudo tee % > /dev/null hi scalaNew gui=underline hi scalaMethodCall gui=italic hi scalaValName gui=underline hi scalaVarName gui=underline "folding set foldcolumn=2 set foldmethod=marker " tabs are 4 space by default set shiftwidth=4 set tabstop=4 set expandtab "What highlighting group is the current cursor on ? function! SyntaxItem() return synIDattr(synID(line("."),col("."),1),"name") endfunction "Nice statusbar set laststatus=2 set statusline= set statusline+=%-3.3n\ " buffer number set statusline+=%f\ " file name set statusline+=%h%m%r%w " flags set statusline+=\[%{strlen(&ft)?&ft:'none'}, " filetype set statusline+=%{&fileencoding}, " encoding set statusline+=%{&fileformat}, " file format set statusline+=%{((exists(\"+bomb\")\ &&\ &bomb)?\"B,\":\"\")}]\ " BOM set statusline+=%{strftime('%a\ %b\ %e\ %H:%M')}\ " hour "set statusline+=%{SyntaxItem()} " syntax highlight group under cursor set statusline+=%= " right align if !empty(glob("$HOME/.vim/bundle/vim-fugitive/plugin/fugitive.vim")) set statusline+=%{fugitive#statusline()}\ " git branch endif set statusline+=0x%-8B\ " current char set statusline+=%-14.(%l,%c%V%)\ %<%P " offset "tags set tags=tags,./tags,../tags,../../tags "C syntax for ellisys files autocmd BufNewFile,BufRead *.usbs set filetype=c "C syntax for ARM Scatterfiles autocmd BufNewFile,BufRead *.scat set filetype=c "ARM Assembler for .s files autocmd BufNewFile,BufRead *.s set filetype=armasm "Markdown, not modula2 autocmd BufNewFile,BufRead *.md set filetype=markdown set nostartofline "Leader-f switches from C source .c to header .h file "It automatically detects .cpp <-> .h " .c <-> .h " .cpp <-> .hpp function! MPB_Flip_Ext() python << endpython import vim import os.path def loadfile(filename): vim.command("e {}".format(filename)) currentfile = vim.eval('expand("%")') c_exts = ["c", "cpp", "cc"] h_exts = ["h", "hpp"] currentfile_split = currentfile.split(".") if len(currentfile_split) > 0: ext = currentfile_split[-1] basename = currentfile[:-(1+len(ext))] if ext in c_exts: for h_ext in h_exts: h_filename = basename + "." + h_ext if os.path.exists(h_filename): loadfile(h_filename) elif ext in h_exts: for c_ext in c_exts: c_filename = basename + "." + c_ext if os.path.exists(c_filename): loadfile(c_filename) endpython endfun noremap :call MPB_Flip_Ext() noremap f :call MPB_Flip_Ext() " Added for QSO logging function! MPB_Prepend_Time() python << endpython import vim import datetime now = datetime.datetime.utcnow() vim.current.line = now.strftime("%Y%m%d %H%M ") + vim.current.line endpython endfun noremap :call MPB_Prepend_Time() noremap m :make -j4 "Show trailing whitespace highlight ExtraWhitespace ctermbg=darkgreen guibg=#344011 autocmd BufEnter * exe ':2match ExtraWhitespace /\s\+$\| \+\ze\t\|\t\+\ze /' " F5 sets the search register to the word under cursor, without moving " the cursor noremap :let @/ = expand(''):3match none " F6: Highlight the word under cursor in darkcyan highlight ManualHighlight ctermbg=darkcyan guibg=darkcyan noremap :exe printf('match ManualHighlight /%s/', escape(expand(''), '/\')) "if has("gui_running") " " auto highlight word under cursor " highlight WordUnderCursor ctermbg=darkred guibg=#552211 " autocmd CursorMoved * exe printf('3match WordUnderCursor /\V\<%s\>/', escape(expand(''), '/\')) "endif "Show tabs set listchars=tab:›\ ,trail:␣ set list "clang_complete options set completeopt=menu,menuone,longest "let g:clang_complete_copen=1 noremap R :cscope reset:CtrlPClearAllCaches "some CScope maps noremap fs :cscope f s if has("cscope") " 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 endif "short tag and tselect noremap [ :tselect noremap ] :tag "I use bnext and bprev a lot noremap [b :bprev noremap ]b :bnext "Same for location list noremap [l :lprev noremap ]l :lnext "Error list noremap [e :cNext noremap ]e :cnext noremap [h :GitGutterPrevHunk noremap ]h :GitGutterNextHunk "GIT stuff noremap gt :call TimeLapse() noremap gb :Gblame noremap e :NERDTreeToggle noremap T :set expandtab! " Vim. Live it. noremap noremap noremap noremap inoremap inoremap inoremap inoremap "very magic search noremap / /\v call neobundle#end() filetype plugin indent on NeoBundleCheck