From 4d4cc837bbf0cbfe35ff4ec642d7c6bafb3a3fe6 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Mon, 20 Feb 2017 03:50:37 +0100 Subject: Improved and partly fixed autocompletion and added some shortcuts --- vimrc | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 110 insertions(+), 25 deletions(-) (limited to 'vimrc') diff --git a/vimrc b/vimrc index 1e38ac7..5ed666d 100644 --- a/vimrc +++ b/vimrc @@ -1,7 +1,14 @@ +" vim: textwidth=160 tabstop=2 shiftwidth=2 +" +if has('nvim') + runtime! python_setup.vim +endif + call plug#begin() + " Brilliant_Plugins_by_tpope: ========================. -Plug 'tpope/vim-sensible' | " a sane and modern default configuration +" Plug 'tpope/vim-sensible' | " a sane and modern default configuration # not required with nvim Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/= @@ -9,17 +16,30 @@ Plug 'mhinz/vim-signify' | " show changes in the cl " Colorschemes: ======================================. +Plug 'ryanoasis/vim-devicons' | " eye candy icons Plug 'chriskempson/base16-vim' | " map q :bpspbnbd. +" NETRW: =============================================. +let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot +let g:netrw_hide = 1 | " show not-hidden files only +let g:netrw_liststyle = 3 | " 3=tree +let g:netrw_banner = 0 | " display help messages? +let g:netrw_winsize = 20 | " window size in percent +let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors) +let g:netrw_keepdir = 0 +let g:netrw_browse_split = 4 | " 4=open in previous window +let g:netrw_preview = 0 | " +let g:netrw_alto = 0 | " open files on the right +let g:netrw_altv = 1 | " open files on the right + " NERDTree: ==========================================. Plug 'scrooloose/nerdtree' | " replace NetRW, which is kind of buggy let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use to create files in that included directory set winwidth=30 " keep NERDTreeWindow at least this size set winminwidth=30 " (and all other windows, so TODO: watch out) -autocmd BufEnter * lcd %:p:h " depending on if NERDTree has the focus: nnoremap \ @@ -33,6 +53,9 @@ nnoremap " close NERDTree if it is the last remaining window (taken from the official documentation) " autocmd bufenter * " \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif +" +" exec current line as a command, insert output of command (from: https://youtu.be/MquaityA1SM?t=35m45s) +nnoremap Q !!$SHELL " AIRLINE: ===========================================. @@ -86,20 +109,28 @@ let g:tagbar_foldlevel = 99 nnoremap l :TagbarToggle| " bind TagBar to Hotkey Ctrl+L + + " Autocompleter: =====================================. Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... Plug 'Valloric/YouCompleteMe' let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file +let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword let g:ycm_complete_in_comments = 1 " Completion in comments let g:ycm_complete_in_strings = 1 " Completion in string let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar let g:ycm_min_num_of_chars_for_completion = 1 -let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar +let g:ycm_confirm_extra_conf = 0 " security is overrated +let g:ycm_key_list_select_completion = [''] +let g:ycm_key_list_previous_completion = [''] " disable -key for YCM so that it can be used with ultisnips " let g:ycm_key_list_select_completion=[] " let g:ycm_key_list_previous_completion=[] +Plug 'rdnetto/YCM-Generator' + +" Plug 'ervandew/supertab' Plug 'scrooloose/syntastic' @@ -136,10 +167,25 @@ Plug 'SirVer/ultisnips' " replaces loremipsum (and "let g:UltiSnipsJumpForwardTrigger = ''| " \ "let g:UltiSnipsJumpBackwardTrigger = ''| " \ "let g:UltiSnipsListSnippets = ''| " YouCompleteMe includes those, so this isn't necessary -let g:UltiSnipsExpandTrigger = ''| " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. -let g:UltiSnipsJumpForwardTrigger = ''| " \ -let g:UltiSnipsJumpBackwardTrigger = ''| " \ -let g:UltiSnipsListSnippets = ''| " YouCompleteMe includes those, so this isn't necessary +" let g:UltiSnipsExpandTrigger = ''| " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. +" let g:UltiSnipsJumpForwardTrigger = ''| " \ +" let g:UltiSnipsJumpBackwardTrigger = ''| " \ +" let g:UltiSnipsListSnippets = ''| " YouCompleteMe includes those, so this isn't necessary + +" UltiSnips triggering +" let g:UltiSnipsExpandTrigger = "" +" let g:ulti_expand_or_jump_res = 0 +" function ExpandSnippetOrCarriageReturn() +" let snippet = UltiSnips#ExpandSnippetOrJump() +" if g:ulti_expand_or_jump_res > 0 +" return snippet +" else +" return "\" +" endif +" endfunction +" inoremap pumvisible() ? "\=ExpandSnippetOrCarriageReturn()\" : "\" +" set completeopt-=preview + " let g:UltiSnipsEditSplit = 'vertical' @@ -172,9 +218,25 @@ inoremap noremap :make +" default copy&paste insert key binding (just in insert mode, so it doesn't conflict +" with visual block mode). +inoremap + +inoremap :w + + + + +" spell checkers? +set spell spelllang=en,de | " enable spell checker +set dictionary=/usr/share/dict/cracklib-small +set complete+=k " make default completer respect the dictionary +let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell' " settings ============================================. +" +" autocmd BufEnter * lcd %:p:h +set autochdir | " When on, Vim will change the current working directory set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here " set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END " set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text @@ -204,17 +266,20 @@ set notimeout ttimeout | " improves performance but is known to cause pro set nowrap | " but do not (by default) wrap long lines around set number | " turn line numbers on/off (performance decreases when they are shown) set pumheight=8 | " Determines the maximum number of items to show in the popup menu for +set path+=** | " allow recursive searches for files set redrawtime=400 | " The time in milliseconds for redrawing the display. " set restorescreen | " restores the console after exiting vim +" set shada+=n~/.vim/shada | " shada file to use set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge -set spell spelllang=en,de | " enable spell checker set splitbelow | " open new windows below the current one (i find that more intuitive) +set shiftround | " indent/unindent snaps to multiple of shiftwidth +set showcmd | " essential: show keys of combined commands in the lower right corner " set t_Co=256 | " required on some ssh sessions " set textwidth=100 | " line length (80 used to be default, but...) set thesaurus+=/home/max/.vim/thesaurus/php.txt set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) set ttimeoutlen=10 | " set esc key timeout in ms- -set ttyfast | " improves speed for terminal vim +" set ttyfast | " improves speed for terminal vim (incomp. with nvim) set updatetime=1000 | " updates the screen more often " set ttyscroll=100 | " improves speed for terminal vim, incomp. with nvim set writedelay=0 @@ -243,6 +308,8 @@ if has("gui_running") " set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12 set guifont=Dejavu\ Sans\ Mono\ for\ Powerline\ 12 set guioptions-=e | " do not display tabs + set guioptions-=L | " do not show left scrollbar + set guioptions-=r | " do not show right scrollbar set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped) endif @@ -316,6 +383,21 @@ if has("autocmd") autocmd VimLeave * silent !echo -ne "\033]112\007" augroup END + augroup ChangeIcon + "if filereadable("/usr/bin/xseticon") + "if filereadable("~/.vim/nvim.png") + autocmd VimEnter * silent :execute "!xseticon -id $WINDOWID ~/.vim/nvim.png" + autocmd VimLeave * silent :execute "!xseticon -id $WINDOWID /usr/share/icons/gnome/32x32/apps/xfce-terminal.png" + "endif + "endif + augroup END + + if has('nvim') + else + augroup vimonly + autocmd VimLeave * call system("echo -n $'" . escape(getreg(), "'") . "' | xsel -ib") + augroup END + endif "set omnifunc=syntaxcomplete#Complete " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main " Enable omni completion. @@ -334,15 +416,29 @@ if has("autocmd") " endif endif - +let &t_Co=256 +set background=dark +" set termguicolors let base16colorspace=256 if filereadable(expand("~/.vimrc_background")) source ~/.vimrc_background - set background=light else colorscheme base16-phd - set background=dark endif + + + + +if !has('nvim') + set ttymouse=xterm2 +else + " shortcut \t opens a terminal in a horizontal split + nnoremap t :new +terminal +endif + + + + " colorscheme base16-embers " colorscheme base16-flat " colorscheme base16-summerfruit-dark @@ -380,16 +476,5 @@ endif " let g:miniBufExplShowBufNumbers = 0 " let g:miniBufExplSplitToEdge = 1 " let g:miniBufExplVSplit = 20 " column width in chars -" NETRW: =============================================. -" Plug 'tpope/vim-vinegar' | " Improves :Explore -" let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot -" let g:netrw_hide = 1 | " show not-hidden files only -" let g:netrw_liststyle = 3 | " 3=tree -" let g:netrw_banner = 0 | " display help messages? -" let g:netrw_winsize = 20 | " window size in percent -" let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors) -" let g:netrw_keepdir = 0 -" let g:netrw_browse_split = 4 | " 4=open in previous window -" let g:netrw_preview = 0 | " -" let g:netrw_alto = 0 | " open files on the right -" let g:netrw_altv = 1 | " open files on the right + + -- cgit v1.2.3