-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdotvimrc
141 lines (114 loc) · 3.54 KB
/
dotvimrc
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
" ONE TIME SETUP
" 1. install the vim-plug plugin manager for vim. https://github.com/junegunn/vim-plug
" 2. in vim command line run :PlugInstall
set nocompatible
set noswapfile
set enc=utf-8 " UTF-8 Default encoding
set history=10000
set ruler
set rulerformat=%l:%c ruler " Display current column/line
set ignorecase
set smartcase
set incsearch
set hlsearch
set backspace=indent,eol,start
set scrolloff=6
set laststatus=2
noremap <space> :
set whichwrap=h,l,~,[,]
" press 'u' key for undo, 'U' key for redo
nnoremap U <c-r>
" remove the <esc> delay from insert mode
set timeoutlen=1000 ttimeoutlen=0
" these are github repos that vim-plug automatically installs
" uncomment any you don't need, or add more!
call plug#begin('~/.vim/plugged')
Plug 'Vimjas/vim-python-pep8-indent'
Plug 'kien/ctrlp.vim'
Plug 'altercation/vim-colors-solarized'
Plug 'tpope/vim-surround'
Plug 'mxw/vim-jsx'
Plug 'jason0x43/vim-js-indent'
Plug 'christoomey/vim-tmux-navigator'
Plug 'editorconfig/editorconfig-vim'
call plug#end()
set background=dark
colorscheme solarized
set ttyfast
set lazyredraw " Don't update while in macro
set autoindent " auto indent
set smarttab " tab and backspace are smart
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
noremap - :nohls<cr>
map Y y$
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
cnoremap <C-A> <Home>
cnoremap <C-E> <End>
set magic
" make /, ?, s/ (and %s/) very magic
" :nnoremap / /\v
" :nnoremap ? ?\v
" :cnoremap %s/ %s/\v
" :ca ss %s/\v
" Set > and < to not use operator-pending mode
" noremap > >>
" noremap < <<
" automatically trim whitespace at the end of lines on save
autocmd BufWritePre * :%s/\s\+$//e
set textwidth=0
set wrap
set number
set titlestring=%f title " Display filename in terminal window
set showcmd " Show commands at bottom right
set showmatch " Show matching brackets.
if has("wildmenu")
set wildmenu
set wildmode=longest:list,full
set wildignore+=*.a,*.o
set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png
set wildignore+=.DS_Store,.git,.hg,.svn
set wildignore+=*~,*.swp,*.tmp
set infercase
endif
" Make sure that unsaved buffers that are to be put in the background are
" allowed to go in there (ie. the "must save first" error doesn't come up)
set hidden
" Show the current mode
set showmode
" Disable syntax highlight for files larger than 50 MB
autocmd BufWinEnter * if line2byte(line("$") + 1) > 50000000 | syntax clear | endif
augroup vimrc_autocmds
" non-annoyingly highlight everything past the 100 character mark
autocmd BufEnter,WinEnter * highlight OverLength ctermbg=236 guibg=#592929
autocmd BufEnter,WinEnter * let w:m1=matchadd('OverLength', '\%>100v.\+', -1)
autocmd BufEnter,WinEnter * highlight ExtraWhitespace ctermbg=red guibg=red
" highlight tabs
autocmd BufEnter,WinEnter * let w:m3=matchadd('ExtraWhitespace', '\t\+', -1)
augroup END
function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
endfunction
function! StatuslineGit()
let l:branchname = GitBranch()
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
endfunction
set statusline=
set statusline+=%#PmenuSel#
set statusline+=%{StatuslineGit()}
set statusline+=%#LineNr#
set statusline+=\ %f
set statusline+=%m\
set statusline+=%=
set statusline+=%#CursorColumn#
set statusline+=\ %y
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
set statusline+=\[%{&fileformat}\]
set statusline+=\ %p%%
set statusline+=\ %l:%c
set statusline+=\