-
Notifications
You must be signed in to change notification settings - Fork 1
/
neovimrc.txt
134 lines (123 loc) · 4.06 KB
/
neovimrc.txt
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
" Tabs as 4 spaces and auto indentation
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
filetype plugin indent on
" Powerline fonts sudo apt install fonts-powerline
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
" Show line numbers
set number
set background=dark
let g:airline_theme="gruvbox"
"let g:airline_solarized_bg='dark'
let g:gruvbox_termcolors=256
" Disable weird backspace
set backspace=indent,eol,start
set term=xterm-256color
" Map Ctrl + left/right to switch tabs
" map <C-Left> <Esc>:tabprev<CR>
" map <C-Right> <Esc>:tabnext<CR>
" Map Ctrl + N to new tab
" map <C-n> <Esc>:tabnew<space>
" Map Ctrl + left/right to switch buffers
map <C-Left> <Esc>:bp<CR>
map <C-Right> <Esc>:bn<CR>
" Map Ctrl + N to new buffer
map <C-n> <Esc>:edit<space>
" Ctrl+s to save
noremap <C-s> <Esc>:update<CR>
inoremap <C-s> <C-O>:update<CR>
" Plugins
call plug#begin()
" Airline themes
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Colorschemes
Plug 'flazz/vim-colorschemes'
Plug 'morhetz/gruvbox'
" Auto-completion plugin
Plug 'Valloric/YouCompleteMe'
" Auto brace matching
Plug 'LucHermitte/lh-vim-lib'
Plug 'LucHermitte/lh-style'
Plug 'LucHermitte/lh-brackets'
" Go plugin
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
call plug#end()
" Don't insert placeholder for brace matching
let b:usemarks = 0
colorscheme Chasing_Logic
" Don't confirm extra YCM conf file
let g:ycm_confirm_extra_conf = 0
set tabline=%!MyTabLine() " custom tab pages line
function! MyTabLine()
let s = '' " complete tabline goes here
" loop through each tab page
for t in range(tabpagenr('$'))
" set highlight
if t + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
" set the tab page number (for mouse clicks)
let s .= '%' . (t + 1) . 'T'
let s .= ' '
" set page number string
let s .= t + 1 . ' '
" get buffer names and statuses
let n = '' "temp string for buffer names while we loop and check buftype
let m = 0 " &modified counter
let bc = len(tabpagebuflist(t + 1)) "counter to avoid last ' '
" loop through each buffer in a tab
for b in tabpagebuflist(t + 1)
" buffer types: quickfix gets a [Q], help gets [H]{base fname}
" others get 1dir/2dir/3dir/fname shortened to 1/2/3/fname
if getbufvar( b, "&buftype" ) == 'help'
let n .= '[H]' . fnamemodify( bufname(b), ':t:s/.txt$//' )
elseif getbufvar( b, "&buftype" ) == 'quickfix'
let n .= '[Q]'
else
let n .= pathshorten(bufname(b))
endif
" check and ++ tab's &modified count
if getbufvar( b, "&modified" )
let m += 1
endif
" no final ' ' added...formatting looks better done later
if bc > 1
let n .= ' '
endif
let bc -= 1
endfor
" add modified label [n+] where n pages in tab are modified
if m > 0
let s .= '[' . m . '+]'
endif
" select the highlighting for the buffer names
" my default highlighting only underlines the active tab
" buffer names.
if t + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
" add buffer names
if n == ''
let s.= '[New]'
else
let s .= n
endif
" switch to no underlining and add final space to buffer list
let s .= ' '
endfor
" after the last tab fill with TabLineFill and reset tab page nr
let s .= '%#TabLineFill#%T'
" right-align the label to close the current tab page
if tabpagenr('$') > 1
let s .= '%=%#TabLineFill#%999Xclose'
endif
return s
endfunction