-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
123 lines (107 loc) · 2.76 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
source $VIMRUNTIME/defaults.vim
set number
set mouse=a
noremap <C-Left> :bprev<CR>
noremap <C-Right> :bnext<CR>
colorscheme elflord
filetype indent on
filetype plugin on
filetype on
syntax on
set wildmenu
set ignorecase
set smartcase
set autoindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set smarttab
set nocompatible
set cursorline
set wildmenu
set wildmode=list:longest
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
set scrolloff=5
set hlsearch
set showmatch
set showmode
set showcmd
set history=1000
set nowrap
set t_Co=256
let g:Powerline_symbols = "fancy"
set laststatus=2
set showtabline=2
set list
set listchars=tab:\|\ ,trail:·
function! GitBranch()
let b:branchValid=1
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
endfunction
function! IsBranchValid()
return get(b:, 'branchValid', 0)
endfunction
function! CachedGitBranch()
let b:branchname = IsBranchValid() ? b:branchname : GitBranch()
return b:branchname
endfunction
function! StatuslineGit()
let l:branchname = CachedGitBranch()
return strlen(l:branchname) > 0 ? ' '.l:branchname.' ' : ''
endfunction
function! HasBranch()
let l:branchname = CachedGitBranch()
return strlen(l:branchname) > 0
endfunction
function SetupStatusLine()
hi User1 ctermfg=none ctermbg=darkgray cterm=reverse
set statusline=
set statusline+=%#CursorColumn#
set statusline+=%{StatuslineGit()}
set statusline+=%1*%{HasBranch()?'':''}
set statusline+=%#StatusLine#
set statusline+=\ %.40F\
set statusline+=%{&modified?'🖉\ ':''}
set statusline+=%{&readonly?'\ ':''}
set statusline+=%=
set statusline+=\ %{&filetype!=#''?&filetype:'none'}\
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}\
set statusline+=\ %{&fileformat}\
set statusline+=%1*
set statusline+=%#CursorColumn#
set statusline+=\ %l:%c\ \ %L
set statusline+=\
endfunction
function! GetTabLine()
let s = ''
let tabcounter=0
for i in range(bufnr('$'))
let tabnbr = i + 1
if !buflisted(tabnbr)
continue
endif
let tabcounter = tabcounter + 1
if tabnbr == bufnr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
let s .= '%' . (tabnbr) . 'T'
let s .= ' %{GetTabLabel(' . (tabnbr) . ',' . (tabcounter) . ')} '
endfor
let s .= '%#TabLineFill#%T'
if tabpagenr('$') > 1
let s .= '%=%#TabLine#%999Xclose'
endif
return s
endfunction
function! GetTabLabel(n, c)
return a:c . ":" . bufname(a:n)
endfunction
function SetupTabLine()
set tabline=
set tabline=%!GetTabLine()
endfunction
call SetupStatusLine()
call SetupTabLine()