Skip to content

Commit

Permalink
Cleanup Vimrc
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Apr 8, 2017
1 parent 820e0de commit c377939
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 139 deletions.
2 changes: 1 addition & 1 deletion vim/.vim/bundle/editorconfig-vim
2 changes: 1 addition & 1 deletion vim/.vim/bundle/vim-javacomplete2
2 changes: 1 addition & 1 deletion vim/.vim/bundle/vim-test
186 changes: 50 additions & 136 deletions vim/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,11 @@ augroup VimRc
autocmd!
augroup END

" Enable filetype plugins
filetype plugin on
filetype indent on
" Enable some default plugins
runtime defaults.vim
runtime macros/matchit.vim
let loaded_matchparen = 1 " disable matchparen, can be really slow

" Sets how many lines of history VIM has to remember
set history=200

" time out for key codes
set ttimeout
set ttimeoutlen=100 " wait up to 100ms after Esc for special key

" We are fast
set ttyfast

" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowritebackup
Expand All @@ -36,15 +25,6 @@ try
catch
endtry

" Use faster grep alternatives if possible
if executable('rg')
set grepprg=rg\ --vimgrep\ --no-heading
set grepformat^=%f:%l:%c:%m
elseif executable('ag')
set grepprg=ag\ --nogroup\ --nocolor\ --vimgrep
set grepformat^=%f:%l:%c:%m
endif

" Use system clipboard
if has('clipboard')
set clipboard=unnamedplus
Expand All @@ -54,23 +34,15 @@ endif

" User interface {{{

" Set 5 lines to the cursor - when moving vertically using j/k
" and also when you click at top or bottom of the creen with mouse
set scrolloff=5

" display completion matches in a status line
set wildmenu
set wildmode=list:longest,list:full
" Faster screen redrawing
set ttyfast

" after leaving buffer set it as hidden (so we can open buffer without saving
" previous buffer)
set hidden

" Show what command we are writing
set showcmd

" Show what mode we are in
set showmode
" display completion matches in a status line
set wildmode=list:longest,list:full

" Ignore compiled files
set wildignore=*.o,*~,*.pyc,*.class
Expand All @@ -85,27 +57,26 @@ if has('nvim')
" visible incremental command replace
set inccommand=nosplit
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
elseif exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[5 q\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
else
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[5 q\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
else
let &t_SI = "\e[5 q"
let &t_EI = "\e[2 q"
endif
let &t_SI = "\e[5 q"
let &t_EI = "\e[2 q"
endif

" Less annoying error messages
set shortmess=at
" Search down into subfolders
" Provides tab-completion for all file-related tasks
set path+=**

"Always show current position
set ruler
" Include spelling completion when spelling enabled
set complete+=kspell

" Height of the command bar
set cmdheight=1
" Includes completion is super slow, disable it
set complete-=i

" Configure backspace so it acts as it should act
set backspace=eol,start,indent
" Better completion menu
set completeopt=longest,menuone

" Ignore case when searching
set ignorecase
Expand All @@ -116,28 +87,19 @@ set smartcase
" Highlight search results
set hlsearch

" Makes search act like search in modern browsers
set incsearch

" Don't redraw while executing macros (good performance config)
set lazyredraw

" For regular expressions turn magic on
set magic

" Show matching brackets when text indicator is over them
set showmatch

" No annoying sound on errors
" Less annoying errors
set shortmess=at
set noerrorbells
set novisualbell
set t_vb=
set timeoutlen=500

" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright

" Always show the status line
set laststatus=2

Expand All @@ -162,32 +124,41 @@ set cursorline
" Disable text wrap
set nowrap

" Use old regexpengine (maybe better performance)
set regexpengine=1

" Limit horizontal and vertical syntax rendering (for better performance)
syntax sync minlines=256
set synmaxcol=256

" Automatically rebalance windows on vim resize
autocmd VimRc VimResized * :wincmd =

" }}}
" use syntax complete if nothing else available
autocmd VimRc Filetype *
\ if &omnifunc == ""
\| setlocal omnifunc=syntaxcomplete#Complete
\| endif

" Colors and Fonts {{{
" Use faster grep alternatives if possible
if executable('rg')
set grepprg=rg\ --vimgrep\ --no-heading
set grepformat^=%f:%l:%c:%m
elseif executable('ag')
set grepprg=ag\ --nogroup\ --nocolor\ --vimgrep
set grepformat^=%f:%l:%c:%m
endif

" }}}

" Enable syntax highlighting
syntax enable
" Colors {{{

" Enable 256 color mode
set t_Co=256

" Set dark background
set background=dark

" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8

" Use Unix as the standard file type
set fileformats=unix,dos,mac

" Limit horizontal and vertical syntax rendering
syntax sync minlines=256
set synmaxcol=256

" Adjust syntax highlighting
autocmd VimRc BufEnter * call AdjustHighlighting()
function! AdjustHighlighting()
Expand All @@ -209,22 +180,6 @@ endfunction

" Text, tab and indent related {{{

" Search down into subfolders
" Provides tab-completion for all file-related tasks
set path+=**

" Include spelling completion when spelling enabled
set complete+=kspell

" Use old regexpengine (maybe better performance)
set regexpengine=1

" Includes completion is super slow, disable it
set complete-=i

" Better completion menu
set completeopt=longest,menuone

" Use spaces instead of tabs
set expandtab

Expand All @@ -242,53 +197,11 @@ set textwidth=80
set autoindent
set smartindent

" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
autocmd VimRc BufReadPost *
\ if &ft !~ '^git\c' && ! &diff && line("'\"") > 0 && line("'\"") <= line("$")
\| exe 'normal! g`"zvzz'
\| endif

" use syntax complete if nothing else available
autocmd VimRc Filetype *
\ if &omnifunc == ""
\| setlocal omnifunc=syntaxcomplete#Complete
\| endif

" }}}
" For regular expressions turn magic on
set magic

" GUI related {{{

if has('gui_running')
" Set extra options when running in GUI mode
set mouse=a
set guitablabel=%M\ %t
autocmd VimRc GUIEnter * set vb t_vb=
autocmd VimRc GUIEnter * set guioptions-=e

" Disable scrollbars (real hackers don't use scrollbars for navigation!)
set guioptions-=r
set guioptions-=R
set guioptions-=l
set guioptions-=L

" Disable tabs from gui
set guioptions-=e
set guioptions-=T

" Set font according to system
if has('mac') || has('macunix')
set guifont=Terminus:h12,Source\ Code\ Pro:h12,Menlo:h12
elseif has('win16') || has('win32')
set guifont=Terminus:h12,Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11
elseif has('gui_gtk2')
set guifont=Terminus\ 12,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11
elseif has('linux')
set guifont=Terminus\ 12,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11
elseif has('unix')
set guifont=Monospace\ 11
endif
endif
" Use Unix as the standard file type
set fileformats=unix,dos,mac

" }}}

Expand Down Expand Up @@ -385,6 +298,7 @@ nnoremap <silent> <leader>gr :Gremove<CR>
nmap <silent> <leader>mf :SyntasticCheck<CR>
nmap <silent> <leader>mF :make<CR>
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_check_on_wq = 0
set statusline+=%#warningmsg#%{SyntasticStatuslineFlag()}%*

" Vim Test
Expand Down

0 comments on commit c377939

Please sign in to comment.