-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
143 lines (105 loc) · 2.69 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
colorscheme embark
let g:airline_theme='embark'
let g:airline_powerline_fonts = 1
let g:netrw_banner=0
let g:netrw_winsize=10
let g:netrw_browse_split=4
let g:netrw_altv=1
let g:netrw_liststyle=3
let g:NetrwIsOpen=0
function! ToggleNetrw()
if g:NetrwIsOpen
let i = bufnr("$")
while (i >= 1)
if (getbufvar(i, "&filetype") == "netrw")
silent exe "bwipeout " . i
endif
let i-=1
endwhile
let g:NetrwIsOpen=0
else
let g:NetrwIsOpen=1
silent Lexplore
endif
endfunction
augroup ProjectDrawer
autocmd!
if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in")
silent exe "bwipeout " . bufnr("$")
exe 'cd '.argv()[0]
autocmd VimEnter * :call ToggleNetrw()
else
autocmd VimEnter * :call ToggleNetrw()
autocmd VimEnter * wincmd p
endif
augroup END
" Quit netrw with the file buffer
autocmd WinEnter * if winnr('$') == 1 && getbufvar(winbufnr(winnr()), "&filetype") == "netrw" || &buftype == 'quickfix' |q|endif
" Split Screen
function! OpenBeside()
:normal v
let g:path=expand('%:p')
:q!
execute 'belowright vnew' g:path
:normal <C-l>
endfunction
function! OpenBelow()
:normal v
let g:path=expand('%:p')
:q!
execute 'belowright new' g:path
:normal <C-l>
endfunction
" END Split Screen
function! NetrwMappings()
noremap <silent> <C-f> :call ToggleNetrw()<CR>
" Shift + v: Split Vertically
noremap <buffer> V :call OpenBeside()<CR>
" Shift + h: Split Horizontally
noremap <buffer> H :call OpenBelow()<CR>
endfunction
augroup netrw_mappings
autocmd!
autocmd filetype netrw call NetrwMappings()
augroup END
" Mouse Visual Mode
if has('mouse')
if &term =~ 'xterm'
set mouse=a
else
set mouse=nvi
endif
endif
" Bi-directional Support
set termbidi
set clipboard^=unnamed,unnamedplus
set number
syntax on
set cursorline
set cursorcolumn
highlight CursorColumn cterm=NONE term=NONE ctermbg=black guibg=NONE
highlight CursorLine cterm=NONE term=NONE ctermbg=black guibg=NONE
highlight CursorLineNR cterm=NONE term=NONE ctermbg=black guibg=NONE
" Highlight all search pattern matches
set hlsearch
nnoremap <CR> :nohlsearch<CR><CR>
" Ctrl + a: select all
noremap <C-a> ggVG
set autochdir
set autoindent
filetype plugin indent on
" Autocompletion
set completeopt=longest,menuone
inoremap <C-@> <C-n><Down>
" Automatically wrap left and right
set whichwrap+=<,>,h,l,[,]
" Shift + Tab: reverse tab
inoremap <S-Tab> <C-d>
" Ctrl + Backspace: delete word
inoremap <C-h> <C-w>
" Set tabs to 4 spaces
set tabstop=8
set softtabstop=0
set expandtab
set shiftwidth=4
set smarttab