-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
201 lines (149 loc) · 4.86 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
""" Excellent resources used for setting many of the settings below:
" https://github.com/amix/vimrc
" http://learnvimscriptthehardway.stevelosh.com/chapters/17.html
" http://vimcasts.org/
""" Vim-Plug managed plugins
" (list plugins and install from Vim with :PlugInstall)
" (update plugins from Vim with :PlugUpdate. View diff with :PlugDiff)
" (uninstall plugins by removing them below, and from Vim running :PlugClean)
call plug#begin('~/.vim/bundle')
Plug 'itchyny/lightline.vim'
Plug 'joshdick/onedark.vim'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/nerdcommenter'
Plug 'vim-syntastic/syntastic'
Plug 'sheerun/vim-polyglot'
Plug 'easymotion/vim-easymotion'
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
call plug#end()
" Configure lightline plugin to display current git branch via fugitive plugin
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'fugitive#head'
\ },
\ }
" Hide '-- INSERT --' status, as lightline plugin displays it
set noshowmode
" Change color scheme
colorscheme onedark
" Increase update time, so gitgutter plugin is more responsive (default: 4000)
set updatetime=250
" Automatically open NERDTree when Vim opens
" autocmd vimenter * NERDTree
" Map 'Ctrl n' to toggle NERDTree
nmap <C-n> :NERDTreeToggle<CR>
" Map 'Ctrl p' to toggle FZF
nmap <C-p> :FZF<CR>
" Turn off auto backups
set noswapfile
set nobackup
set nowb
" Set number of lines above and below the cursor
set scrolloff=1
" Enable the wildmenu (shown in tab completion)
set wildmenu
" Show current cursor position
set ruler
" Give more space for displaying status line messages
" set cmdheight=2
" Opening a new file hides current file, instead of closing it
" (View open files with :ls and then :b[N], where N is buffer number)
set hidden
" Allow backspacing over everything in insert mode
" (macOS sets this, but explicitly setting here for cross-OS compat)
set backspace=indent,eol,start
" Navigate to next line when at end of line
set whichwrap+=<,>,h,l
" Ignore case when searching...
set ignorecase
" ...except when the pattern contains an uppercase letter
set smartcase
" Highlight all search matches
set hlsearch
" Move cursor to first matched string as you type
set incsearch
" Buffer screen updates instead of updating all the time
set lazyredraw
" Show matching brackets as you close them
set showmatch
" Blink matched brackets for (2) tenths of a second
set mat=2
" Enable syntax highlighting
syntax on
" Ensure encoding is set to utf8 and file types are Unix
set encoding=utf8
set ffs=unix,dos,mac
" Ensure tab indents go to next indent level (if in between tab indent levels)
set smarttab
" Use spaces instead of tabs
set expandtab
" Set default tab width to 4 spaces
set shiftwidth=4
set softtabstop=4
set tabstop=4
" If Vim was compiled with autocommands
if has("autocmd")
" Enable filetype detection
filetype plugin on
" Enable omnicompletion
set omnifunc=syntaxcomplete#Complete
" Strict language specific indentation settings
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Style-guide language specific indentation settings
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType javascript setlocal ts=2 sts=2 sw=2 expandtab
endif
" Enable soft wrap (display long text strings on multiple lines)
set wrap
set linebreak
" Enable auto indenting
set autoindent
set smartindent
" Always show the status line
set laststatus=2
" Vertical split window down
set splitbelow
" Horizontal split window right
set splitright
" Format the status line
set statusline=\ " (space)
set statusline+=%F " Full path to file
set statusline+=%= " (align everything that follows to the right)
set statusline+=%l " Current line
set statusline+=: " :
set statusline+=%c " Current column
set statusline+=\ " (space)
set statusline+=/ " /
set statusline+=\ " (space)
set statusline+=%L " Total lines
set statusline+=\ " (space)
" Display typed characters in the status line
" set showcmd
" Show title in terminal window
set title
" Clear terminal title upon exiting Vim
set titleold=
" Show line numbers
set number
" Highlight line the cursor is on
set cursorline
" Show hidden characters
set listchars=eol:¬,space:·,tab:▸\ ,trail:~,extends:>,precedes:<
set list
" Shortcut to toggle `set list`
nmap <leader>l :set list!<CR>
" Enable spell checking
" set spell
" Enable completion for words as well, but only if spelling is enabled
set complete+=kspell
" Enable mouse (easier scrolling)
set mouse=a