-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
216 lines (172 loc) · 6.98 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
let mapleader="," " change the leader to be a comma vs slash
set nocompatible " be iMproved
set laststatus=2 " Always show the statusline
set encoding=utf-8 " Necessary to show Unicode glyphs
set hidden " makes vim work like every other multiple-file editor
set title " show title in console title bar
set number " Display line numbers
set numberwidth=1 " using only 1 column (and 1 space) while possible
set wildmenu " Menu completion in command mode on <Tab>
set wildmode=list:longest,full " <Tab> cycles between all matching choices.
set ruler " show the cursor position all the
set backspace=indent,eol,start " Allow backspacing over autoindent, EOL, and BOL
set autoindent " always set autoindenting on
set smartindent " use smart indent if there is no indent file
set tabstop=4 " <tab> inserts 4 spaces
set shiftwidth=4 " but an indent level is 2 spaces wide.
set softtabstop=4 " <BS> over an autoindent deletes both spaces.
set expandtab " Use spaces, not tabs, for autoindent/tab key.
set modifiable " set modifiable for argdo replace
set autowriteall " changed buffers are automatically saved when required
set ruler
set shiftround " rounds indent to a multiple of shiftwidth
set matchpairs+=<:> " show matching <> (html mainly) as well
set lazyredraw " do not redraw while running macros (muchfaster) (LazyRedraw)
set textwidth=80 " used by gqq or <VISUAL>gq command to format lines PEP8 :D
set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:.
set ff=unix
" Removes trailing spaces
function TrimWhiteSpace()
%s/\s*$//
''
endfunction
autocmd FileWritePre * call TrimWhiteSpace()
autocmd FileAppendPre * call TrimWhiteSpace()
autocmd FilterWritePre * call TrimWhiteSpace()
autocmd BufWritePre * call TrimWhiteSpace()
nnoremap R "_d " remove default behaviour of copy with d
nnoremap R "_dd " remove default behaviour of copy with dd
set buftype: "" " remove buf shit
set noswapfile " remove .swp files from being created
set term=builtin_beos-ansi
filetype plugin indent on " get current file indentation
syntax on
set ffs=unix,dos " removing 0xD as ^M
set nu " Display number of lines
set hlsearch " highlight patterns
set autoread " Automatically refresh changed files
set modifiable " make a buffer modifiable
highlight Normal ctermfg=grey ctermbg=Black
nnoremap <silent> <C-l> :nohl<CR><C-l> " ctrl + l unhighlight
" ctrl + r for replace shortcut
vnoremap <C-r> "hy:.,$s/<C-r>h//gc<left><left><left>
"set autochdir
" autocmd BufEnter * silent! lcd %:p:h "same as autochdir but with exceptions to run some plugins
set clipboard^=unnamed,unnamedplus
" set go+=a
set paste "allow pasting on terminal at insert mode"
" fuzzy again to refresh
" reload all opened files pressing F5
nmap <F5> :tabdo windo edit<CR>
nnoremap <c-p> :GitFiles<cr>
nnoremap <c-t> :Tags<cr>
nnoremap <c-a> :Ag<cr>
nnoremap <c-b> :Buffers<cr>
execute pathogen#infect()
" 80-th column limit
set textwidth=79
set colorcolumn=+1
highlight ColorColumn term=reverse cterm=reverse gui=reverse
set makeprg=python3\ %
" removing whitespaces on :w
" autocmd BufWritePre * %s/\s\+$//e " trying to remove for performance purposes
" skipping backpup tmp vim
set backupskip=/tmp/*,/private/tmp/*"
" webpack https://webpack.github.io/docs/troubleshooting.html
set backupcopy=yes
" more colors!
let &t_Co=256
set t_Co=256
" The Silver Searcher configs https://github.com/mileszs/ack.vim
" let g:ag_prg="ag --vimgrep"
let g:ag_working_path_mode="r"
"Ag word under the cursor
noremap <leader>a :Ag! <C-r>=expand('<cword>')<CR>
" format SQL text
noremap <leader>s :%!sqlformat --reindent --keywords upper --identifiers lower -<CR>
" format JSON
noremap <leader>j :%!python -m json.tool<CR>
" reload all opened files pressing F5
nmap <F5> :tabdo windo edit<CR>
" ----------------------------------------------------------------
" lint
" let g:syntastic_mode_map = { 'mode': 'active',
" \ 'active_filetypes': ['python', 'javascript'],
" \ 'passive_filetypes': [] }
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*
"
" let g:syntastic_always_populate_loc_list = 1
" let g:syntastic_loc_list_height = 5
" let g:syntastic_auto_loc_list = 0
" let g:syntastic_check_on_open = 1
" let g:syntastic_check_on_wq = 1
" let g:syntastic_aggregate_errors = 1
" let g:syntastic_javascript_checkers = ['eslint']
"
" let local_eslint = finddir('node_modules', '.;') . '/.bin/eslint'
" if matchstr(local_eslint, "^\/\\w") == ''
" let local_eslint = getcwd() . "/" . local_eslint
" endif
" if executable(local_eslint)
" let g:syntastic_javascript_eslint_exec = local_eslint
" endif
autocmd BufNewFile *.py 0r ~/.vim/templates/skeleton.py
" ----------------------------------------------------------------
" STATUSLINE
" set statusline=
" set statusline +=%2*/%L%* "total lines
" set statusline +=%1*\ %n\ %* "buffer number
" set statusline +=%5*%{&ff}%* "file format
" set statusline +=%3*%y%* "file type
" set statusline +=%4*\ %<%F%* "full path
" set statusline +=%2*%m%* "modified flag
" set statusline +=%1*%=%5l%* "current line
" set statusline +=%1*%4v\ %* "virtual column number
" set statusline +=%2*0x%04B\ %* "character under cursor
" dunno what laststatus does :/
" set laststatus=2
"These are to cancel the default behavior of d, D, c, C
" to put the text they delete in the default register.
" Note that this means e.g. "ad won't copy the text into
" register a anymore. You have to explicitly yank it.
" nnoremap d "_d
" vnoremap d "_d
" nnoremap D "_D
" vnoremap D "_D
" nnoremap c "_c
" vnoremap c "_c
" nnoremap C "_C
" vnoremap C "_C
" Folding
" set foldmethod=indent
" set foldlevel=1
" set foldclose=all
" zo - opens folds
" zc - closes fold
" zm - increases auto fold depth
" zr - reduces auto fold depth
colorscheme badwolf
set term=screen-256color
" ---- FZF ----
" If installed using git
set rtp+=~/.fzf
" If installed using Homebrew
" set rtp+=/usr/local/opt/fzf
" -------------
" noremap <F3> :Autoformat<CR>
" let g:formatdef_sql = '"sqlformat --reindent --keywords upper - identifiers lower -"'
" let g:formatters_sql = ['sql']
" let g:netrw_localrmdir="rm -r"
" ctags
set tags=tags
let ropevim_vim_completion=1
let ropevim_extended_complete=1
" let g:netrw_liststyle=3
" let g:netrw_keepdir=0
nnoremap <silent><leader>h :ArgWrap<CR>
if has("autocmd")
augroup templates
autocmd BufNewFile *.sh 0r ~/.vim/templates/skeleton.sh
augroup END
endif