-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
175 lines (157 loc) · 5.54 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
packadd minpac
call minpac#init()
set nocompatible
let mapleader = ','
set backspace=2
set noswapfile
set history=50
set ruler
set guifont=Droid_Sans_Mono:h8:cANSI
set shiftwidth=2
set softtabstop=2
set laststatus=2
set autowrite
colorscheme Tomorrow-Night " awesome colorscheme elflord pablo
syntax enable " enable syntax processing
syntax on
set tabstop=2 " number of visual spaces per TAB
set shiftround
set expandtab
set number " show line numbers
set numberwidth=5
set showcmd " show command in bottom bar
set cursorline " highlight current line
filetype plugin indent on " load filetype-specific indent files
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw only when we need to.
set showmatch " highlight matching [{()}]
set incsearch " search as characters are entered
set hlsearch " highlight matches
nnoremap <leader><space> :nohlsearch<CR> " turn off search highlight
set foldenable " enable folding
set foldlevelstart=10 " open most folds by default
set foldnestmax=10 " 10 nested fold max
nnoremap <space> za " space open/closes folds
set foldmethod=indent " fold based on indent level
nnoremap gV `[v`] " highlight last inserted text
" toggle gundo
nnoremap <leader>u :GundoToggle<CR>
" Always use vertical diffs
set diffopt+=vertical
" Go to tab by number
noremap <leader>1 1gt
noremap <leader>2 2gt
noremap <leader>3 3gt
noremap <leader>4 4gt
noremap <leader>5 5gt
noremap <leader>6 6gt
noremap <leader>7 7gt
noremap <leader>8 8gt
noremap <leader>9 9gt
:set smartcase
:set ignorecase
" Persistent undo
set undodir=~/.vim/undo/
set undofile
set undolevels=1000
set undoreload=10000
" Display extra whitespace
set list listchars=tab:»·,trail:·,nbsp:·
" Use one space, not two, after punctuation.
set nojoinspaces
" Habit keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('tpope/vim-unimpaired')
"call minpac#add('tpope/vim-scriptease', {'type': 'opt'})
call minpac#add('scrooloose/nerdtree')
call minpac#add('Xuyuanp/nerdtree-git-plugin')
call minpac#add('scrooloose/nerdcommenter')
call minpac#add('vim-syntastic/syntastic')
call minpac#add('tpope/vim-surround')
call minpac#add('austintaylor/vim-indentobject')
call minpac#add('tpope/vim-dispatch')
"call minpac#add('tpope/vim-rails')
call minpac#add('tpope/vim-fugitive')
call minpac#add('tmhedberg/matchit')
call minpac#add('kana/vim-textobj-user')
call minpac#add('nelstrom/vim-textobj-rubyblock')
call minpac#add('vim-scripts/JSON.vim')
call minpac#add('pangloss/vim-javascript')
"call minpac#add('chemzqm/vim-jsx-improve')
call minpac#add('mxw/vim-jsx')
call minpac#add('junegunn/fzf')
call minpac#add('mhinz/vim-grepper')
call minpac#add('BurntSushi/ripgrep')
call minpac#add('vim-airline/vim-airline')
call minpac#add('neoclide/coc.nvim', {'do': 'call coc#util#install()'})
"call minpac#add('StanAngeloff/php.vim')
"call minpac#add('andymass/vim-matchup')
" mappings
map <C-n> :NERDTreeToggle<CR>
" NERDTree settings
" auto-open nerdtree?
"autocmd vimenter * NERDTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" " Toggle nerdtree with F10
map <F10> :NERDTreeToggle<CR>
" Current file in nerdtree
map <F9> :NERDTreeFind<CR>
" fuzzy find
nnoremap <C-p> :<C-u>FZF<CR>
" grep
:set grepprg=rg\ -H\ --no-heading\ --vimgrep
:set grepformat=$f:$l:%c:%m
nnoremap <Leader>g :Grepper -tool rg<CR>
" javascript
let g:javascript_plugin_jsdoc = 1
augroup configgroup
autocmd!
autocmd VimEnter * highlight clear SignColumn
"autocmd BufWritePre *.php,*.py,*.js,*.txt,*.hs,*.java,*.md
"\:call <SID>StripTrailingWhitespaces()
autocmd FileType java setlocal noexpandtab
autocmd FileType java setlocal list
autocmd FileType java setlocal listchars=tab:+\ ,eol:-
autocmd FileType java setlocal formatprg=par\ -w80\ -T4
autocmd FileType ruby setlocal tabstop=2
autocmd FileType ruby setlocal shiftwidth=2
autocmd FileType ruby setlocal softtabstop=2
autocmd FileType ruby setlocal commentstring=#\ %s
autocmd FileType python setlocal commentstring=#\ %s
autocmd BufEnter *.cls setlocal filetype=java
autocmd BufEnter *.zsh-theme setlocal filetype=zsh
autocmd BufEnter Makefile setlocal noexpandtab
autocmd BufEnter *.sh setlocal tabstop=2
autocmd BufEnter *.sh setlocal shiftwidth=2
autocmd BufEnter *.sh setlocal softtabstop=2
autocmd Filetype html setlocal ts=2 sts=2 sw=2
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2
autocmd Filetype markdown setlocal ts=2 sts=2 sw=2
augroup END
augroup vimrcEx
autocmd!
" When editing a file, always jump to the last known cursor position.
" " Don't do it for commit messages, when the position is invalid, or
" when
" " inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Set syntax highlighting for specific file types
autocmd BufRead,BufNewFile Appraisals set filetype=ruby
autocmd BufRead,BufNewFile *.md set filetype=markdown
autocmd BufRead,BufNewFile .{jscs,jshint,eslint}rc set
"filetype=json
augroup END
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
syntax on
" Enable fzf
source /usr/share/doc/fzf/examples/fzf.vim