From faa32035b41f6d6016ddf22cf71e47336be42090 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Sun, 20 Aug 2017 14:09:25 +0200 Subject: huge refactoring --- vimrc-full | 206 ++++++++++++++++++++++++++----------------------------------- 1 file changed, 86 insertions(+), 120 deletions(-) (limited to 'vimrc-full') diff --git a/vimrc-full b/vimrc-full index 6cba120..8a5cb9e 100644 --- a/vimrc-full +++ b/vimrc-full @@ -128,7 +128,7 @@ if has("gui_running") set guioptions+=m | " remove menu set guioptions-=e | " do not display tabs set guioptions-=L | " do not show left scrollbar - set guioptions-=r | " do not show right 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) " 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 @@ -136,7 +136,7 @@ if has("gui_running") " its possible to define alternative fonts (order matters) set guifont= - set guifont+=Droid\ Sans\ Mono\ for\ Powerline + set guifont+=Droid\ Sans\ Mono\ for\ Powerline\ 10 set guifont+=Source\ Code\ Pro\ for\ Powerline\ SemiBold\ 10 set guifont+=Dejavu\ Sans\ Mono\ for\ Powerline\ Semibold set guifont+=Meslo\ LG\ M\ for\ Powerline\ 10 @@ -182,8 +182,6 @@ 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 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 scrolloff=3 | " keeps cursor centered set splitbelow | " open new windows below the current one (i find that more intuitive) @@ -208,20 +206,13 @@ set equalalways | " do not evenly size windows when opening new or set nocursorline | " turn visual cursor line off (improves performance) "======================================================================================================================= -if has('autocmd') - " autocmd VimEnter * let &t_EI .= "\[0 q" - " autocmd VimEnter * let &t_SI = "\]12;green\x7" - autocmd VimLeave * silent !echo -ne "\033]112\007" -endif - - - " NEOVIM_incompatible: " if has('nvim') " Neovim? autocmd TermOpen term://* set nobuflisted " use default ESC key to leave insert mode in the internal terminal emulator tnoremap +" set shada+=n~/.vim/shada | " shada file to use else " default Vim? autocmd VimLeave * call system("echo -n $'" . escape(getreg(), "'") . "' | xsel -ib") @@ -230,6 +221,7 @@ else " default Vim? set ttyfast | " improves speed for terminal vim (incomp. with nvim) set nottybuiltin | " use external termcaps " set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incomp. with nvim + set restorescreen | " restores the console after exiting vim (intentionally not in nvim) " let g:loaded_ruby_provider = 1 " disable ruby support let g:loaded_python_provider = 1 " disable pthon3 @@ -245,18 +237,6 @@ if has("autocmd") " set default completion function in case YouCompleteMe cannot help set omnifunc=syntaxcomplete#Complete - " automatically reload this file when it gets edited - if !exists("*OnConfigChange") - function OnConfigChange() - autocmd! |" Remove all vimrc autocommands - source $MYVIMRC - exec lightline#colorscheme() - exec lightline#update() - " AirlineRefresh - endfunction - autocmd BufWritePost $MYVIMRC call OnConfigChange() - endif - augroup set_window_title " { " autocmd BufWinEnter quickfix setl statusline=%t " autocmd BufEnter * let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]" @@ -275,6 +255,35 @@ if has("autocmd") endif 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 + + " Fix terminal title ================================================================================================= + " autocmd VimEnter * let &t_EI .= "\[0 q" + " autocmd VimEnter * let &t_SI = "\]12;green\x7" + autocmd VimLeave * silent !echo -ne "\033]112\007" + + " highlight word under the cursor ==================================================================================== + let w:m1 = 0 + function! HighlightWordUnderCursor() + if(exists('w:m1') && w:m1 > 0) + silent! call matchdelete(w:m1) + let w:m1 = 0 + endif + let l:currentword = escape(expand(''), '.') + if(strlen(l:currentword) > 0) + let w:m1=100 + silent! call matchadd('BoldItalic', '\<'.l:currentword.'\>', -1, w:m1) + endif + endfunction + autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() + " hitting K over a keyword shows a help in a buffer. " Here we define the commands used to look those keywords up " as per file type... @@ -292,6 +301,7 @@ if has("autocmd") " Alt-Up : Move cursor up one tag " Alt-Down: Move cursor down one tag " leader-=: tidies currently selected tag and subtags and sorts attributes by name (alphabetically) + autocmd Filetype html,markdown,xml iabbrev autocmd Filetype html,htmldjango,xml \ :nnoremap \ @@ -304,15 +314,6 @@ if has("autocmd") \ vat:'<,'>!tidy -xml --wrap 0 --sort-attributes alpha 2>/dev/nullvat= 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 - " autocmd BufNewFile set nobuflisted " use the shada/viminfo file to return the cursor to where it was... function! ReturnCursor() @@ -347,23 +348,13 @@ if has("autocmd") endif endfunction + nmap