-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_vimrc
More file actions
244 lines (201 loc) · 6.89 KB
/
Copy path_vimrc
File metadata and controls
244 lines (201 loc) · 6.89 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
"During this file you might find "TurtleOnATree" in some comments, that's
" cause the code is exactly like a turtle on a tree: I don't know who put it
" up there, I don't know why is he up there, but I might brake something if I
" try to took him out there, so I'll just leave the turtle up there
if has("win32") || has("win64") || has("win16")
set shell=$COMSPEC " If on windows, shell is cmd.exe
source $VIMRUNTIME/mswin.vim
behave mswin
else
set shell=/bin/bash
endif
runtime macros/matchit.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()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" git helper
Plugin 'tpope/vim-fugitive'
" syntastic MUST WORK UGH
Plugin 'scrooloose/syntastic.git'
" Surround words lines and blocks with { [ "' EVERYTHING
Plugin 'tpope/vim-surround.git'
"solarized
Plugin 'altercation/vim-colors-solarized.git'
" airline (powerline but lighter
Plugin 'bling/vim-airline.git'
" minimap on vim
Plugin 'severin-lemaignan/vim-minimap'
" easymotion (like vimium but for vim [???])
Plugin 'easymotion/vim-easymotion'
" autoformatter with lots of defaults (I want js-beautify) (:Autoformat)
Plugin 'Chiel92/vim-autoformat'
" Automatic insert the closing parameters
Plugin 'Raimondi/delimitMate'
" Use :CtrlP to search for files
Plugin 'ctrlpvim/ctrlp.vim'
" Just leave here to let vim work well with json
Plugin 'helino/vim-json'
" Better javascript syntax
Plugin 'pangloss/vim-javascript'
call vundle#end() " required
filetype plugin indent on " required
" Configurations for Syntastic
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_enable_signs = 1
let g:syntastic_auto_loc_list = 2
let g:syntastic_javascript_checkers = ['eslint'] "npm i -g eslint-plugin-openui5 && npm install -g eslint
let g:syntastic_haskell_checkers = ['ghc_mod', 'hlint']
" cabal update && cabal install ghc-mod and add /Libray/Haskell/bin to
" systemPath
let g:syntastic_c_checkers = ['gcc']
let g:syntastic_cpp_checkers = ['gcc']
let g:syntastic_python_checkers = ['python']
let g:syntastic_java_checkers = ['javac'] " comes with the jdk
let g:syntastic_vim_checkers = ['vint'] " pip install vim-vint
let g:syntastic_ruby_checkers = ['rubylint'] " gem install ruby-lint
let g:syntastic_error_symbol = 'X'
let g:syntastic_style_error_symbol = '>'
let g:syntastic_warning_symbol = '!'
let g:syntastic_style_warning_symbol = '>'
" "TurtleOnATree" it's actually for faster MacVim
set ttyfast
set lazyredraw
"autocompletion for filenames
set wildmode=longest,list,full
set wildmenu
:au FocusLost * :wa "Save on focus lost
" Sessions # "TurtleOnATree" let g:session_autoload = 'no'
" Leader Mappings
let mapleader = "\<Space>"
map <Leader> <Plug>(easymotion-prefix)
" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
let g:EasyMotion_use_upper = 1
let g:EasyMotion_keys = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ;'
" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>n :lnext<CR>
map <Leader>N :lprev<CR>
" Run current file as python
map <Leader>p :!python %<CR>
" My fat finger doesn't get out of shift in time, so I'll add this here
command! W :w
command! Q :q
" type jj to leave insert mode
:inoremap jj <Esc>
"" poweline support
set guifont=Inconsolata\ for\ Powerline:h14
set encoding=utf-8
set t_Co=256
"hide whitespace if there's a char after it
set fillchars+=stl:\ ,stlnc:\
" highlight vertical column of cursor #does this work?
au WinLeave * set nocursorline nocursorcolumn
au WinEnter * set cursorline
set cursorline
" airline configs
set laststatus=2 "makes the second line always visible
set encoding=utf-8
let g:airline_powerline_fonts = 1
" key to insert mode with paste using F2 key # "TurtleOnATree"
map <F2> :set paste<CR>i
" Leave paste mode on exit
au InsertLeave * set nopaste
" Command aliases
cabbrev tp tabprev
cabbrev tn tabnext
cabbrev tf tabfirst
cabbrev tl tablast
set backspace=2 " Backspace deletes like most programs in insert mode
set nocompatible " Use Vim settings, rather then Vi settings
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=500
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set hlsearch " highlight matches
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
" Fuzzy finder: ignore stuff that can't be opened, and generated files
let g:fuzzy_ignore = '*.png;*.PNG;*.JPG;*.jpg;*.GIF;*.gif;vendor/**;coverage/**;tmp/**;rdoc/**'
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has('gui_running')) && !exists('syntax_on')
syntax on
endif
if filereadable(expand('~/.vimrc.bundles'))
source ~/.vimrc.bundles
endif
" bind K to search word under cursor
"# I don't know why this doesn't work, I'll implement it myself
" nnoremap K :Ag "\b<C-R><C-W>\b"<CR>:cw<CR>
nnoremap K :/<C-R><C-W>/<CR>
" 4 spaces tabs
set tabstop=4
set shiftwidth=4
"set expandtab
" Display extra whitespace
"set list listchars=tab:»·,trail:·
:set smartcase
:set ignorecase
:set noantialias
" Color scheme
colorscheme solarized
set background=dark
set encoding=utf-8
" Highlight line number of where cursor currently is
hi CursorLineNr guifg=#050505
" Numbers "TurtleOnATree"
set number
set numberwidth=5
" Persistent undo
set undodir=~/.vim/undo/
set undofile
set undolevels=1000
set undoreload=10000
:nnoremap <expr> y (v:register ==# '"' ? '"+' : '') . 'y'
:nnoremap <expr> yy (v:register ==# '"' ? '"+' : '') . 'yy'
:nnoremap <expr> Y (v:register ==# '"' ? '"+' : '') . 'Y'
:xnoremap <expr> y (v:register ==# '"' ? '"+' : '') . 'y'
:xnoremap <expr> Y (v:register ==# '"' ? '"+' : '') . 'Y'
" Tab completion
" will insert tab at beginning of line,
" will use completion if not at beginning
set wildmode=list:longest,list:full
set complete=.,w,t
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
inoremap <Tab> <c-r>=InsertTabWrapper()<cr>
" Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Local config
if filereadable($HOME . '/.vimrc.local')
source ~/.vimrc.local
endif