-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
66 lines (52 loc) · 1.62 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
" auto install vimplug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
" Plugins
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'w0rp/ale'
Plug 'tpope/vim-commentary'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'mhinz/vim-startify'
Plug 'mhinz/vim-signify'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
" Initialize plugin system
call plug#end()
" Global configuration
" apply theme
syntax on
color dracula
" show line numbers
set number
" enable mouse
set mouse=a
" tabs
set tabstop=4
set shiftwidth=4
" set expandtab
" fix backspace
set backspace=indent,eol,start
" cycle through buffers
:nnoremap <Tab> :bnext<CR>
:nnoremap <S-Tab> :bprevious<CR>
" auto source changes to .vimrc
autocmd! bufwritepost $MYVIMRC source $MYVIMRC
" set auto chdir to the current buffer working directory
autocmd BufEnter * silent! lcd %:p:h
" Plugin specific configurations
"
" NerdTree
" maps nerdtree to ctrl-n
map <C-n> :NERDTreeToggle<CR>
" closes nerdtree if its the last open window
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" opens nerdtree on opening a folder
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif