From 69e4261cb33c74b81cbfc2d7320c8c276cf7cb8d Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sun, 11 Nov 2018 00:52:12 +0800 Subject: vim: More tweaks * Improve statusline: - Add virtual column number - Reorder file type and encoding - Shorten the paste mode indicator * Highlight current line * Disable cursor blinking * No need to set ruler * Tweak formatoptions and textwidth --- _vimrc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/_vimrc b/_vimrc index 2d87832..941ccb6 100644 --- a/_vimrc +++ b/_vimrc @@ -48,9 +48,6 @@ set wildmenu set wildignore=*.o,*~,*.pyc set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store -"Always show current position -set ruler - " Height of the command bar set cmdheight=1 @@ -86,6 +83,9 @@ endif " Add a bit extra margin to the left set foldcolumn=1 +" Highlight the current line +set cursorline + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Colors and Fonts @@ -114,6 +114,7 @@ if has("gui_running") set guioptions-=R " No right scrollbar set guifont=IBM\ Plex\ Mono\ Medium\ 11 set guitablabel=%M\ %t + set guicursor+=a:blinkoff0 " Disable cursor blinking endif @@ -137,14 +138,14 @@ set smarttab set tabstop=8 set shiftwidth=4 -" Linebreak on 500 characters -set linebreak -set textwidth=500 - set autoindent set smartindent set wrap +set linebreak +set textwidth=75 +set formatoptions+=m " Break at multi-byte characters (e.g., CJK) + """""""""""""""""""""""""""""" " => Visual mode related @@ -158,7 +159,6 @@ vnoremap # :call VisualSelection('', '')?=@/ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Moving around, tabs, windows and buffers """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Map to / (search) and Ctrl- to ? (backwards search) map / map ? @@ -213,9 +213,17 @@ autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "norm " Always show the status line set laststatus=2 +" Returns true if paste mode is enabled +function! HasPaste() + if &paste + return '[PASTE] ' + endif + return '' +endfunction + " Format the status line -set statusline=\ %{HasPaste()}%f%m%r%h\ %w -set statusline+=\ %=%y\ %{&fileencoding?&fileencoding:&encoding}\ %l:%c\ %P +set statusline=\ %{HasPaste()}%f%m%r%h\ %w\ %= +set statusline+=%{&fileencoding?&fileencoding:&encoding}\ %y\ %l,%c%V\ %P set statusline+=\ " blank space @@ -285,14 +293,6 @@ imap """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Helper functions """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Returns true if paste mode is enabled -function! HasPaste() - if &paste - return 'PASTE MODE ' - endif - return '' -endfunction - " Don't close window, when deleting a buffer command! Bclose call BufcloseCloseIt() function! BufcloseCloseIt() -- cgit v1.2.2