-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
225 lines (179 loc) · 5.69 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
217
218
219
220
221
222
223
224
225
"OBTAIN:
"TODO Latex Plugin
"TODO Python IDE
"TODO Salt
"TODO tags? tagbar
"TODO blockit
"TODO tab completion? Supertab?
"TODO ctrlp, file finder? command_T? nerd tree?
"TODO vim templates for LATEX
"TODO Surround.vim
"TODO Commentary? comment out?
"TODO repeat.vim?
"TODO relatedde
"TODO install virtualenv support https://realpython.com/blog/python/vim-and-python-a-match-made-in-heaven/
"TODO
" Reference: https://www.youtube.com/watch?v=YhqsjUUHj6g&t=6s
"POLISH:
"TODO python.vim - get most current version?
"
"PRACTICE:
""""""""""""""""""""""""""""""""""
"BEFORE YOU DO ANYTHING WITH VIM:"
" open and work through vimtutor "
" & read the help files with "
" <ESC> :help user-manual "
""""""""""""""""""""""""""""""""""
set nocompatible
" VIM PLUG:
" Specify a directory for plugins
" Avoid using standard Vim directory names like 'plugins'
call plug#begin('~/.vim/plugged')
"Tmux
Plug 'christoomey/vim-tmux-navigator'
"Sane Defaults
Plug 'tpope/vim-sensible'
"Formatting
Plug 'ntpeters/vim-better-whitespace'
Plug 'junegunn/vim-easy-align' "TODO tutorial
Plug 'tmhedberg/SimpylFold' "TODO find if compatable with python-mode, TODO do I need this?
"Syntax
Plug 'scrooloose/syntastic' "TODO tutorial, do I need this?
"Filesystem
Plug 'scrooloose/nerdtree' "TODO tutorial, TODO do I need this?
"Git
Plug 'tpope/vim-fugitive' "TODO tutorial
"Python
" Plug 'Valloric/YouCompleteMe' "TODO tutorial, install
" Plug 'vim-scripts/indentpython.vim' "TODO tutorial
" Plug 'nvie/vim-flake8' "TODO tutorial
Plug 'python-mode/python-mode'
Plug 'stevefan/vim-ipython'
"Disabled ipy_completefunc
"Color
Plug 'jnurmine/Zenburn'
Plug 'altercation/vim-colors-solarized'
Plug 'tomasr/molokai'
" Initialize plugin system
call plug#end()
" Vim-Plug automatically execuits 'filetype plugin indent on'
" filetype plugin on
" ENABLE SYNTAX HIGHLIGHTING:
" https://stackoverflow.com/questions/33380451/is-there-a-difference-between-syntax-on-and-syntax-enable-in-vimscript
if !exists("g:syntax_on")
syntax enable
endif
" RELOAD VIMRC ON WRITE:
" use :so % while editing .vimrc
" vim auto-reloads configuration
augroup myvimrchooks
au!
autocmd bufwritepost .vimrc source ~/.vimrc
augroup END
" VIM EDITOR:
set number "Showing line numbers and length
" set ruler
set relativenumber
set mouse=a " Mouse
set bs=2 " backspace
set encoding=utf-8
set cursorline " show a visual line under the cursor's current line
set showmatch " show the matching part of the pair for [] {} and ()
set noswapfile
set tw=79 " width of document (used by gd)
set nowrap " don't automatically wrap on load
set fo-=t " dont' automatically wrap text when typing
set colorcolumn=80
highlight ColorColumn ctermbg=233
" PASTING:
set pastetoggle=<F2> " Better Copy and Paste
" Use "+yy to yank to plus register for pasting wuth xterm_clipboard
set clipboard=unnamedplus
" Toggle Relative/Nonrelative on Focus/NoFocus
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
" COLOR SCHEME:
if has('gui_running')
set background=dark
colorscheme zenburn_high_Contrast
else
let g:zenburn_high_Contrast=0
colorscheme zenburn
endif
" NAVAGATION COMMANDS:
" using vim-tmux-navigation plugin
" LEADER:
let mapleader=","
" Tab Navagation
map <Leader>n <esc>:tabprevious<CR>
map <Leader>m <esc>:tabnext<CR>
" CODE BLOCK INDENTENTATION:
vnoremap < <gv " better indentation
vnoremap > >gv " better indentation
" FOLDING:
" Plug SimplyFold
set foldmethod=indent
set foldlevel=99
nnoremap <space> za " Enable folding with the spacebar
" FILE BROWSING:
" Tweaks for browsing
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
" Search down into subfolders
" Provides tab-competion for all file-related tasks
set path+=**
" Display all mathcing files when we tab complete
set wildmenu
" - Hit tab to :find by partial match
" - Use * to make it fuzzy
" - :b lets you autocomplete any open buffer
"TODO ADD nerdtree integration
" CUSTOM KEY MAPPINGS:
" map sort function to a key
" vnoremap <Leader>s :sort<CR>
" Default File Editing:
" TODO determine and add contents
" Begin Python Development:
" -------------------------
set tabstop=4
set softtabstop=4
set shiftwidth=4 " for using >> or << commands
set shiftround
set expandtab
set autoindent "redundant for sensible
set fileformat=unix
autocmd BufRead,BufNewFile *.py let python_highlight_all=1
let g:ycm_python_binary_path = 'python' " active virtual_env aware
" PYTHON MODE NON DEFAULT OPTIONS:
let g:pymode_python = 'python3'
source ~/.vim/plugged/vim-ipython/ftplugin/python/ipy.vim
" -----------------------
" End Python Development:
" Full Stack Development:
" TODO: https://realpython.com/blog/python/vim-and-python-a-match-made-in-heaven/
" Other Tricks:
" TAG JUMPING:
" Create 'tags' file, requires pkg 'ctags'
" command! MakeTags !ctags -R .
" - Use ^] to jump to tag under cursor
" - Use g^] for ambiguous tags
" - Use ^t to jump back up tag stack
" AUTOCOMPLETE:
" The good stuff is documented in |ins-completion|
" HIGHLIGHTS:
" - ^x^n for JUST this file
" - ^x^f for filenames (works with our path trick!)
" - ^x^] for tags only
" - ^n for anything specified by the 'complete' option
" NOW WE CAN
" - Use ^n and ^p to go back and forth in the suggestion list
" SNIPPETS:
" Read an empty HTML template and move cursor to title
" nnoremap ,html :-1read $HOME/.vim/.skeleton.html<CR>3jwf>a