-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
181 lines (143 loc) · 4.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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
" Vundle
" Install Vundle using the following command:
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Efficiency
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'scrooloose/nerdtree.git'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'ludovicchabant/vim-gutentags'
Plugin 'junegunn/fzf.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-obsession'
" Language Plugins
"" Javascript
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
"" PHP
Plugin 'StanAngeloff/php.vim'
Plugin '2072/PHP-Indenting-for-VIm'
Plugin 'rayburgemeestre/phpfolding.vim'
Plugin 'vim-syntastic/syntastic'
Plugin 'ajh17/VimCompletesMe.git'
Plugin 'vim-vdebug/vdebug'
Plugin 'scrooloose/nerdcommenter'
" Themes
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
call vundle#end()
" Appearance
set background=dark
" - Cursor
if exists('$TMUX')
let &t_SI = "\ePtmux;\e\e[5 q\e\\"
let &t_EI = "\ePtmux;\e\e[2 q\e\\"
else
let &t_SI = "\e[5 q"
let &t_EI = "\e[2 q"
endif
" Editting
set ai
" - For Syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" - PHP Folding
map <F7> <Esc>:DisablePHPFolds<Cr>
" Files
set autoread
set autowrite
" -FZF
map <C-P>p :Files<CR>
map <C-P>a :Ag<CR>
map <C-P>d :Buffers<CR>
map <C-P>f :Lines<CR>
" Misc Settings
set nocompatible
filetype plugin on
syntax on
set path=$PWD/**
" Movement
" -Between splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
:set ignorecase
:set smartcase
" NERDTree
map <C-n> :NERDTreeToggle<CR>
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 | endif
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Check if NERDTree is open or active
function! IsNERDTreeOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
" Call NERDTreeFind iff NERDTree is active, current window contains a modifiable
" file, and we're not in vimdiff
function! SyncTree()
if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff
NERDTreeFind
wincmd p
endif
endfunction
" Highlight currently open buffer in NERDTree
autocmd BufEnter * call SyncTree()
"--------------------------------MY EDITS ABOVE----------------------------------"
" A few sane defaults for use in ArchLabs
" load Arch Linux defaults
runtime! archlinux.vim
" yank text to system clipboard (requires +clipboard)
set clipboard^=unnamedplus
" enable line numbers
set number
" ask confirmation for certain things like when quitting before saving
" set confirm
" enable tab completion menu when using colon command mode (:)
set wildmenu
set shortmess+=aAcIws " Hide certain messages like 'Search Hit Bottom' etc.
set expandtab " Tab inserts Spaces not Tabs '\t'
set softtabstop=4 " Amount of spaces to enter when Tab is pressed
set shiftwidth=4 " 4 space indentation
" enable mouse, sgr is better but not every term supports it
set mouse=a
if has('mouse_sgr')
set ttymouse=sgr
endif
" bracketed paste while in insert mode, bracketed paste preserves indentation
inoremap <silent><C-v> <Esc>:set paste<CR>a<C-r>+<Esc>:set nopaste<CR>a
" better defaults
nnoremap 0 ^
nnoremap Y y$
" nnoremap n nzzzv
" nnoremap N Nzzzv
" better motions with wrapped text while preserving numbered jumps
for g:key in ['k', 'j', '<Up>', '<Down>']
execute 'noremap <buffer> <silent> <expr> ' .
\ g:key . ' v:count ? ''' .
\ g:key . ''' : ''g' . g:key . ''''
execute 'onoremap <silent> <expr> ' .
\ g:key . ' v:count ? ''' .
\ g:key . ''' : ''g' . g:key . ''''
endfor
augroup file_load_change_and_position
" clear this group so they don't pile up
autocmd!
" when quitting, save position in file
" when re-opening go to last position
autocmd BufReadPost * call setpos(".", getpos("'\""))
" Reload changes if file changed outside of vim
" requires autoread (enabled by default)
autocmd FocusGained,BufEnter * if mode() !=? 'c' | checktime | endif
autocmd FileChangedShellPost * echo "Changes loaded from file"
augroup END