-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
143 lines (113 loc) · 4.8 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Keep Plugin commands between vundle#begin/end.
Plugin 'tpope/vim-fugitive' " git integration
Plugin 'itchyny/lightline.vim'
" Configure lightline plugin
let g:lightline = {
\ 'active': {
\ 'left': [['mode', 'paste'], ['gitbranch', 'readonly', 'filename', 'modified']]
\ },
\ 'component_function': {
\ 'gitbranch': 'LightLineGitBranchName'
\ },
\ }
function! LightLineGitBranchName()
" add this cool symbol before git branch name
return exists('*fugitive#head') ? (' ' . fugitive#head()) : ''
endfunction
Plugin 'jiangmiao/auto-pairs' " parens created in pairs
Plugin 'scrooloose/nerdtree' " file directory in vim
" Configure NERDTree plugin
map <C-N> :NERDTreeToggle<CR> " map toggle NERDTree to Ctrl + n
let NERDTreeShowHidden=1 " show hidden files by default
Plugin 'tpope/vim-surround' " add 'surround' functionality, to modify a 'surrounding' object
Plugin 'Xuyuanp/nerdtree-git-plugin' " display Git status flags beside files in NERDTree
Plugin 'airblade/vim-gitgutter' " shows git diff symbols in gutter
" Configure vim-gitguttter plugin
set updatetime=100 " update diff markers in 100ms
"let g:gitgutter_override_sign_column_highlight = 0
"highlight clear SignColumn
"highlight GitGutterAdd ctermfg=2
"highlight GitGutterChange ctermfg=3
"highlight GitGutterDelete ctermfg=1
"highlight GitGutterChangeDelete ctermfg=4
Plugin 'tpope/vim-commentary' " easy comments
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" vim theme
set background=dark " dark background
colorscheme solarized
" enable syntax higlighting
syntax on
" always display status line
set laststatus=2
" disable -- INSERT --, -- VISUAL LINE -- indicators since lightline already
" displays them
set noshowmode
" turn on line numbers
set nu
" turn on relative line numbers for lines other than current cursor line
set relativenumber
" line length guide configurations
if exists('+colorcolumn')
set colorcolumn=80
" change line length guide to grey
highlight ColorColumn ctermbg=0 guibg=lightgrey
endif
" tab settings
set tabstop=4 " width that a <TAB> character displays as
set expandtab " convert <TAB> key-presses to spaces
set shiftwidth=4 " number of spaces to use for each step of (auto) indent
set softtabstop=4 " backspace after pressing <TAB> will remove up to this many spaces
set autoindent " copy indent from current line when starting a new line
set smartindent " smart autoindent (e.g. add indent after '{')
set encoding=utf-8
set showmatch " jump to matching braces upon closing (for visual confirmation)
set matchtime=3 " time in tenth of a second to showmatch above
" search settings
set incsearch " search as characters are entered
set hlsearch " highlight matches
set ignorecase " case-insensitive search
set smartcase " if case is used, only find case-matching
set cursorline " highlight current line
set autoread " autoreload file if file was changed outside vim
" leader settings
let mapleader = ","
set showcmd " display cmd inputs, for visual confirmation of leader cmds
" highlight trailing whitespace
" https://vim.fandom.com/wiki/Highlight_unwanted_spaces
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
" fix backspace for brew vim (not required on macvim)
set backspace=indent,eol,start
" display various whitespace characters
set list
set listchars=
set listchars+=trail:⋅
" bind key to remove highlights ("redraw terminal screen")
" search and replace highlights linger even after completion
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>