-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
186 lines (141 loc) · 5.07 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
" How to use Plug plugin manager
" if you haven't installed plug yet, enter the following in the command line:
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" Run the following command to install plugins after adding plugin line to .vimrc
" :PlugInstall
" Run the following command to update plugins
" :PlugUpdate
" Run the following command to delete plugins after removing line from .vimrc
" :PlugClean
set nocompatible
call plug#begin()
" toggles comments with gc
Plug 'tpope/vim-commentary'
" Easy Motion
Plug 'easymotion/vim-easymotion'
" All of your Plugins must be added before the following line
call plug#end()
filetype plugin indent on
set backspace=2 "make it work like other aps(?)
set shiftwidth=4
set tabstop=4
set softtabstop=4
set smarttab
set expandtab
" autocompletion of file browsing
set wildmenu
set wildmode=longest:list
set title " show name of file in tab
" show white space?
set list
set listchars=tab:>.,trail:.,extends:#,nbsp:.
" avoid hitting Esc so much
" C-[ is better than Esc, not clear why
inoremap jk <C-[>
" ability to move down one displayed line of wrapped code vs. one actual line of code
imap <silent> <Down> <C-o>gj
imap <silent> <Up> <C-o>gk
nmap <silent> <Down> gj
nmap <silent> <Up> gk
" make sure that the text doesn't wrap as I'm typing long lines of code that I
:set tw=0
" show line numbers when vim starts
set number
" toggle line numbers on and off with F2
nnoremap <F2> :set nonumber!<CR>
" Paste toggle, to paste text from other sources and not have indenting screwed up (from insert mode)
set pastetoggle=<F2>
" tab movement between tabs ctrl-i goes left and ctrl-o goes right
nnoremap <C-I> :tabprev<CR>
nnoremap <C-O> :tabnext<CR>
" split movement move between splits with ctrl+ navigation keys (j,k,l,h)
nmap <C-K> <C-w><Up>
nmap <C-J> <C-w><Down>
nmap <C-L> <C-w><Right>
nmap <C-H> <C-w><Left>
" make it so that :sp automatically puts the split below not above
set splitbelow
" make it so that the :vsp command automatically puts the split to the right not the left
set splitright
" make windows bigger or smaller with + and -
nnoremap <silent> + :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <silent> - :exe "resize " . (winheight(0) * 2/3)<CR>
" set the vertical grey line that shows how much code will fit in a word doc w/ 1" margins
set colorcolumn=104
" easy way to make vertical splits bigger
nnoremap <C-n> <C-w>>
"---------------------Made it to here looking through .vimrc-------------------------------------------
" Jump to anywhere you want with minimal keystrokes, with just one key binding
nmap <Space> <Plug>(easymotion-s)
" s2 also an option
" JK motions: Line motions
" somehow these get over written
nmap <Leader>j <Plug>(easymotion-j)
nmap <Leader>k <Plug>(easymotion-k)
" search options
set incsearch
set hlsearch
" get rid of highlighting
nnoremap <silent><CR> :nohlsearch<CR><CR>
" not sure if these are needed
" highlight NonText guibg=#060606
" highlight Folded guibg=#0A0A0A guifg=#9090D0
" complete options (what does this set?)
set completeopt=menu,menuone
" leader key
let mapleader=","
" Spellcheck trigger
nmap <silent> <leader>sp :set spell!<CR>
" Key mapping for simple .vimrc editing
nmap <silent> <leader>ev :tabe $MYVIMRC<CR>
" Source .vimrc file
map <leader>sv :source $MYVIMRC<CR>
" Open tag bar
map <silent> <leader>l :TagbarToggle<CR>
" Open taglist, does multiple buffers
map <silent> <leader>; :TlistToggle<CR>
" Run ctags - read by YCM
map <leader>tg :! ctags -R .<CR>
map <leader>fp :PymodeLintAuto<CR>
" file types to recognize
au BufNewFile,BufRead SCons* set filetype=scons
au BufNewFile,BufRead CMake* set filetype=cmake
au BufNewFile,BufRead *.i set filetype=swig
au BufNewFile,BufRead *.swig set filetype=swig
au bufnewfile,bufread *.ino set filetype=c " arduino files
autocmd BufRead,BufNewFile *.launch setfiletype roslaunch
autocmd FileType scons set commentstring=#\ %s
autocmd FileType cmake set commentstring=#\ %s
autocmd FileType cpp set commentstring=//\ %s
autocmd FileType swig set commentstring=//\ %s
autocmd FileType c set commentstring=//\ %s
" a.vim settings
" prevent opening file if not found
let g:alternateNoDefaultAlternate=1
" allow sudo write
cmap w!! w !sudo tee > /dev/null %
" close menu (doesn't work on everything)
autocmd CursorMovedI * if pumvisible() == 0|silent! pclose|endif
autocmd InsertLeave * if pumvisible() == 0|silent! pclose|endif
" Execution
nnoremap fd :exec 'w' <cr> :exec '! python %' <cr>
nnoremap <buffer> ! :exec '! python %' <cr>
nnoremap <buffer> @ :exec 'w' <cr>
nnoremap <buffer> > <C-w>>
nnoremap <buffer> < <C-w><
command R !./%
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>
map <leader>a oassert(False)<ESC>
map <leader>p oprint<ESC>
map <leader>w oraw_input("break")<ESC>
command! -nargs=1 SS let @/ = '\V'.escape(<q-args>, '\')
syntax enable
set background=dark
let g:solarized_termcolors=256
colorscheme solarized
" Added to make it so can cut and paste from different terminals must have
" vim-gnome installed
set clipboard=unnamedplus