-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
276 lines (224 loc) · 7.63 KB
/
vimrc
File metadata and controls
276 lines (224 loc) · 7.63 KB
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
if filereadable(expand("~/.vim/vimrc.plugins"))
source ~/.vim/vimrc.plugins
endif
set encoding=utf-8
set history=1000
set clipboard=unnamed
set clipboard+=unnamedplus
set scrolloff=5
syntax enable
set backspace=indent,eol,start
let mapleader = ','
set nonumber
set noshowmode
set autoindent
set smarttab
set tabstop=4 " Set tabstop to tell vim how many columns a tab counts for. Linux kernel code expects each tab to be eight columns wide.
set expandtab " When expandtab is set, hitting Tab in insert mode will produce the appropriate number of spaces.
set softtabstop=4 " Set softtabstop to control how many columns vim uses when you hit Tab in insert mode. If softtabstop is less than tabstop and expandtab is not set, vim will use a combination of tabs and spaces to make up the desired spacing. If softtabstop equals tabstop and expandtab is not set, vim will always use tabs. When expandtab is set, vim will always use the appropriate number of spaces.
set shiftwidth=4 " Set shiftwidth to control how many columns text is indented with the reindent operations (<< and >>) and automatic C-style indentation.
set wildmenu
set hidden
set nocompatible
set showcmd
"set ls=2 " This makes Vim show a status line even when only one window is shown
"filetype plugin on " This line enables loading the plugin files for specific file types
"setlocal foldmethod=indent " Set folding method
"set nocp " This changes the values of a LOT of options, enabling features which are not Vi compatible but really really nice
"set cindent " This turns on C style indentation
"set si " Smart indent
"set nowrap " Don't Wrap lines!
"set showmatch " Show matching brackets
"set noswapfile " Avoid swap files
"set mouse= " Mouse Integration
"-------------------- Visuals --------------------"
if !has('gui_running')
set t_Co=256
endif
set background=dark
colorscheme solarized8_high
if (has("termguicolors"))
set termguicolors
endif
let base16colorspace=256
let g:solarized_termcolors=256
let g:solarized_diffmode = 'high'
let g:solarized_old_cursor_style = 1
set guifont=Fira_Code:h17
set linespace=15
set guioptions-=e
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
hi LineNr guibg=bg
set foldcolumn=2
hi foldcolumn guibg=bg
hi vertsplit guifg=bg guibg=bg
"-------------------- Search --------------------"
set hlsearch
set incsearch
set ignorecase
set smartcase
"-------------------- Split Management --------------------"
set splitbelow
set splitright
nmap <C-J> <C-W><C-J>
nmap <C-K> <C-W><C-K>
nmap <C-H> <C-W><C-H>
nmap <C-L> <C-W><C-L>
"-------------------- Mappings --------------------"
nmap <Leader>ev :tabedit ~/.vim/vimrc<cr>
nmap <Leader><space> :nohlsearch<cr>
nnoremap <Up> :echomsg "use k"<cr>
nnoremap <Down> :echomsg "use j"<cr>
nnoremap <Left> :echomsg "use h"<cr>
nnoremap <Right> :echomsg "use l"<cr>
nnoremap <silent> #3 :tabprevious<cr> " switch to previous tab with F3
nnoremap <silent> #2 :tabnext<cr> " switch to next tab with F2
nmap <Leader>f :tag<space>
noremap x "_x
vnoremap p "_dP
nmap Y y$
nmap 0 ^
"-------------------- Plugins --------------------"
"/
"/ LiteLine
"/
"let g:lightline = {
" \ 'colorscheme': 'solarized',
" \ 'active': {
" \ 'left':[ [ 'mode', 'paste' ],
" \ [ 'gitbranch', 'readonly', 'filename', 'modified' ]
" \ ]
" \ },
" \ 'component': {
" \ 'lineinfo': ' %3l:%-2v',
" \ },
" \ 'component_function': {
" \ 'gitbranch': 'fugitive#head',
" \ }
" \ }
"let g:lightline.separator = {
" \ 'left': '', 'right': ''
" \}
"let g:lightline.subseparator = {
" \ 'left': '', 'right': ''
" \}
"let g:lightline.tabline = {
" \ 'left': [ ['tabs'] ],
" \ 'right': [ ['close'] ]
" \ }
"set showtabline=2 " Show tabline
"/
"/ Aireline
"/
let g:airline#extensions#tabline#enabled = 1 " showing tabs
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline_powerline_fonts = 1
let g:Powerline_symbols = 'fancy'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_theme='luna'
let g:airline_symbols.space = "\ua0"
let g:airline#extensions#clock#format = '%H:%M:%S'
let g:airline#extensions#clock#updatetime = 1000
let g:airline#extensions#tabline#left_sep = "\ue0b0 "
let g:airline#extensions#tabline#left_alt_sep = "\ue0b1"
"Overriding the inactive statusline
function! Render_Only_File(...)
let builder = a:1
let context = a:2
call builder.add_section('file', '!! %F')
return 0 " the default: draw the rest of the statusline
return -1 " do not modify the statusline
return 1 " modify the statusline with the current contents of the builder
endfunction
call airline#add_inactive_statusline_func('Render_Only_File')
"Human readable Line number (with thousands separators)
function! MyLineNumber()
return substitute(line('.'), '\d\@<=\(\(\d\{3\}\)\+\)$', ',&', 'g'). '|'.
\ substitute(line('$'), '\d\@<=\(\(\d\{3\}\)\+\)$', ',&', 'g')
endfunction
call airline#parts#define('linenr', {'function': 'MyLineNumber', 'accents': 'bold'})
let g:airline_section_z = airline#section#create(['%3p%%: ', 'linenr', ':%3v'])
"Add the window number in front of the mode
function! WindowNumber(...)
let builder = a:1
let context = a:2
call builder.add_section('airline_b', '%{tabpagewinnr(tabpagenr())}')
return 0
endfunction
call airline#add_statusline_func('WindowNumber')
call airline#add_inactive_statusline_func('WindowNumber')
"/
"/ NERDTree
"/
"open a NERDTree automatically when vim starts up if no files were specified
"autocmd StdinReadPre * let s:std_in=1
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"autocmd vimenter * NERDTree
nmap <C-n> :NERDTreeToggle<CR>
let NERDTreeHijackNetrw = 0
let NERDTreeMapOpenInTab='<c-t>'
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
"/
"/ fzf
"/
nmap <c-P> :Files<cr>
"nmap <c-R> :Buffers<cr>
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" Default fzf layout
" - down / up / left / right
let g:fzf_layout = { 'down': '~40%' }
" In Neovim, you can set up fzf window using a Vim command
let g:fzf_layout = { 'window': 'enew' }
let g:fzf_layout = { 'window': '-tabnew' }
let g:fzf_layout = { 'window': '10split enew' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Enable per-command history.
" CTRL-N and CTRL-P will be automatically bound to next-history and
" previous-history instead of down and up. If you don't like the change,
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
let g:fzf_history_dir = '~/.local/share/fzf-history'
"/
"/ Colorizer
"/
let g:colorizer_maxlines = 1000
"/
"/ Rainbow
"/
" :RainbowToggle --you can use it to toggle this plugin.
let g:rainbow_active = 0
"/
"/ vim-search-pulse
"/
let g:vim_search_pulse_mode = 'pattern'
"let g:vim_search_pulse_color_list = [22, 28, 34, 40, 46]
"-------------------- Auto-Commands --------------------"
augroup autosourcing
autocmd!
autocmd BufWritePost vimrc source %
augroup END