multiple changes in vimrc
* added vim-repeat plugin * added clause to change cursor shape based on current editing mode * added augroup to automatically toggle relative numbers on focus * added augroup to highlight line number part of cursorline * added whitespace stripping mechanism * several other minor sensible improvements
This commit is contained in:
parent
b5297836ea
commit
c236b33c09
142
vimrc
142
vimrc
@ -94,6 +94,7 @@ endif
|
|||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug 'drewtempelmeyer/palenight.vim'
|
Plug 'drewtempelmeyer/palenight.vim'
|
||||||
Plug 'https://tpope.io/vim/surround.git'
|
Plug 'https://tpope.io/vim/surround.git'
|
||||||
|
Plug 'https://github.com/tpope/vim-repeat.git'
|
||||||
Plug 'https://github.com/tpope/vim-fugitive.git'
|
Plug 'https://github.com/tpope/vim-fugitive.git'
|
||||||
Plug 'https://github.com/suan/vim-instant-markdown', {'for': 'markdown'}
|
Plug 'https://github.com/suan/vim-instant-markdown', {'for': 'markdown'}
|
||||||
"Plug 'plasticboy/vim-markdown', {'for': 'markdown'}
|
"Plug 'plasticboy/vim-markdown', {'for': 'markdown'}
|
||||||
@ -110,42 +111,67 @@ let g:instant_markdown_autostart = 1
|
|||||||
|
|
||||||
""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
set softtabstop=4
|
" change cursor shape for different editing modes, neovim does this by default
|
||||||
set tabstop=4
|
if !has('nvim')
|
||||||
set shiftwidth=4
|
if exists('$TMUX')
|
||||||
set expandtab
|
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[5 q\<Esc>\\"
|
||||||
set smarttab
|
let &t_SR = "\<Esc>Ptmux;\<Esc>\e[4 q\<Esc>\\"
|
||||||
|
let &t_EI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
|
||||||
|
else
|
||||||
|
let &t_SI = "\e[6 q"
|
||||||
|
let &t_SR = "\e[4 q"
|
||||||
|
let &t_EI = "\e[2 q"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
set errorformat+=%.%#PHP:\ %m\ \(in\ %f\ on\ line\ %l\)%.%#,
|
command! W execute 'silent w !sudo tee % >/dev/null' | edit!
|
||||||
\%E%[0-9]%#.%m:%f?rev=%.%##L%l\ %.%#,%C%.%#
|
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead svn-commit.*tmp :0r $SVN_COMMIT_TEMPLATE
|
" open a terminal in $PWD
|
||||||
|
nnoremap <silent> <Leader>tt :terminal<CR>
|
||||||
|
|
||||||
set nocompatible
|
" ------ autocmd ------
|
||||||
set tags=tags;/
|
|
||||||
|
|
||||||
set incsearch " incrimental search
|
" Reload changes if file changed outside of vim requires autoread
|
||||||
set hlsearch " highlighting when searching
|
augroup load_changed_file
|
||||||
|
autocmd!
|
||||||
|
autocmd FocusGained,BufEnter * if mode() !=? 'c' | checktime | endif
|
||||||
|
autocmd FileChangedShellPost * echo "Changes loaded from source file"
|
||||||
|
augroup END
|
||||||
|
|
||||||
filetype indent plugin off
|
" when quitting a file, save the cursor position
|
||||||
set autoindent
|
augroup save_cursor_position
|
||||||
set backspace=2
|
autocmd!
|
||||||
|
autocmd BufReadPost * call setpos(".", getpos("'\""))
|
||||||
|
augroup END
|
||||||
|
|
||||||
set nolist " show/hide tabs and EOL chars (hidden characters)
|
" when not running in a console or a terminal that doesn't support 256 colors
|
||||||
set number " show/hide line numbers (nu/nonu)
|
" enable cursorline in the currently active window and disable it in inactive ones
|
||||||
set scrolloff=5 " scroll offset, min lines above/below cursor
|
if $DISPLAY !=? '' && &t_Co == 256
|
||||||
"set scrolljump=5 " jump 5 lines when running out of the screen - NO
|
augroup cursorline
|
||||||
set sidescroll=10 " minimum columns to scroll horizontally
|
autocmd!
|
||||||
set showcmd " show command status
|
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
|
||||||
set showmatch " flashes matching parenthese when cursor over the other one
|
autocmd WinLeave * setlocal nocursorline
|
||||||
set showmode " show editing mode in status (-- INSERT --)
|
augroup END
|
||||||
set ruler " show cursor position
|
endif
|
||||||
set errorbells " bells in terminal
|
|
||||||
set undolevels=1000 " number of undos stored
|
|
||||||
set viminfo='50,"50 " '=marks for x files, "=registers for x files
|
|
||||||
|
|
||||||
set nofoldenable
|
" when entering insert mode, relative line
|
||||||
"set foldmethod=indent " indent based folding
|
" numbers are turned off, leaving absolute line numbers turned on
|
||||||
|
augroup numbertoggle
|
||||||
|
autocmd!
|
||||||
|
autocmd BufEnter,FocusGained,InsertLeave * set number relativenumber
|
||||||
|
autocmd BufLeave,FocusLost,InsertEnter * set number norelativenumber
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
hi clear CursorLine
|
||||||
|
augroup CLClear
|
||||||
|
autocmd! ColorScheme * hi clear CursorLine
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
hi CursorLineNR cterm=bold
|
||||||
|
augroup CLNRSet
|
||||||
|
set cursorline
|
||||||
|
autocmd! ColorScheme * hi CursorLineNR cterm=bold
|
||||||
|
augroup END
|
||||||
|
|
||||||
" define indent-based folding, after loading a file switch to manual folding
|
" define indent-based folding, after loading a file switch to manual folding
|
||||||
augroup vimrc
|
augroup vimrc
|
||||||
@ -168,9 +194,61 @@ au BufNewFile,BufRead *.c,*.h,*.cpp
|
|||||||
\ setlocal tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab autoindent
|
\ setlocal tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab autoindent
|
||||||
\ textwidth=79 fileformat=unix
|
\ textwidth=79 fileformat=unix
|
||||||
|
|
||||||
|
" ------ adv maps ------
|
||||||
|
|
||||||
|
" strip trailing whitespace, ss (strip space)
|
||||||
|
nnoremap <silent> <Leader>ss
|
||||||
|
\ :let b:_p = getpos(".") <Bar>
|
||||||
|
\ let b:_s = (@/ != '') ? @/ : '' <Bar>
|
||||||
|
\ %s/\s\+$//e <Bar>
|
||||||
|
\ let @/ = b:_s <Bar>
|
||||||
|
\ nohlsearch <Bar>
|
||||||
|
\ unlet b:_s <Bar>
|
||||||
|
\ call setpos('.', b:_p) <Bar>
|
||||||
|
\ unlet b:_p <CR>
|
||||||
|
|
||||||
|
|
||||||
|
set softtabstop=4
|
||||||
|
set tabstop=4
|
||||||
|
set shiftwidth=4
|
||||||
|
set expandtab
|
||||||
|
set smarttab
|
||||||
|
|
||||||
|
set errorformat+=%.%#PHP:\ %m\ \(in\ %f\ on\ line\ %l\)%.%#,
|
||||||
|
\%E%[0-9]%#.%m:%f?rev=%.%##L%l\ %.%#,%C%.%#
|
||||||
|
|
||||||
|
autocmd BufNewFile,BufRead svn-commit.*tmp :0r $SVN_COMMIT_TEMPLATE
|
||||||
|
|
||||||
|
set tags=tags;/
|
||||||
|
|
||||||
|
set incsearch " incrimental search
|
||||||
|
set hlsearch " highlighting when searching
|
||||||
|
|
||||||
|
filetype indent plugin off
|
||||||
|
set autoindent
|
||||||
|
set backspace=2
|
||||||
|
|
||||||
|
set nolist " show/hide tabs and EOL chars (hidden characters)
|
||||||
|
set number " show/hide line numbers (nu/nonu)
|
||||||
|
set relativenumber " use relative number
|
||||||
|
set confirm " ask confirmation like save before quit.
|
||||||
|
set wildmenu " Tab completion menu when using command mode
|
||||||
|
set scrolloff=5 " scroll offset, min lines above/below cursor
|
||||||
|
"set scrolljump=5 " jump 5 lines when running out of the screen - NO
|
||||||
|
set sidescroll=10 " minimum columns to scroll horizontally
|
||||||
|
set showcmd " show command status
|
||||||
|
set showmatch " flashes matching parenthese when cursor over the other one
|
||||||
|
set showmode " show editing mode in status (-- INSERT --)
|
||||||
|
set ruler " show cursor position
|
||||||
|
set errorbells " bells in terminal
|
||||||
|
set undolevels=1000 " number of undos stored
|
||||||
|
set viminfo='50,"50 " '=marks for x files, "=registers for x files
|
||||||
|
|
||||||
|
set nofoldenable
|
||||||
|
"set foldmethod=indent " indent based folding
|
||||||
|
|
||||||
set encoding=utf-8 " important for powerline besides others
|
set encoding=utf-8 " important for powerline besides others
|
||||||
set smartcase " override 'ignorecase' when pattern has upper case characters
|
set smartcase " override 'ignorecase' when pattern has upper case characters
|
||||||
set relativenumber " use relative number
|
|
||||||
|
|
||||||
|
|
||||||
vmap gb :<C-U>!git blame % -L<C-R>=line("'<") <CR>,<C-R>=line("'>") <CR><CR>
|
vmap gb :<C-U>!git blame % -L<C-R>=line("'<") <CR>,<C-R>=line("'>") <CR><CR>
|
||||||
@ -179,10 +257,6 @@ nmap gb :!git blame %<CR>
|
|||||||
colo palenight " new fav highlighting
|
colo palenight " new fav highlighting
|
||||||
set mouse=a " enable mouse in n,v,i,c,h modes
|
set mouse=a " enable mouse in n,v,i,c,h modes
|
||||||
|
|
||||||
":set cursorline " Enable cursor line position tracking
|
|
||||||
":highlight clear CursorLine " Remove the underline from enabling cursorline
|
|
||||||
":highlight CursorLineNR ctermbg=darkgrey " Set line numbering to red background
|
|
||||||
|
|
||||||
set laststatus=2 " show powerline status bar
|
set laststatus=2 " show powerline status bar
|
||||||
set t_Co=256
|
set t_Co=256
|
||||||
let g:Powerline_symbols = "fancy" " sth like this probably set as a default but won't hurt here
|
let g:Powerline_symbols = "fancy" " sth like this probably set as a default but won't hurt here
|
||||||
|
Loading…
Reference in New Issue
Block a user