-
Notifications
You must be signed in to change notification settings - Fork 5
/
steven.vim
203 lines (157 loc) · 4.28 KB
/
steven.vim
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
"""""""""""""""""""""""""""""""""""""""""""""""{{{
" Steven Kneiser's dope .vimrc
"
" Inspired by:
" https://github.com/amix/vimrc
"
" Raw version:
" https://raw.githubusercontent.com/theshteves/dotfiles/master/.vimrc
"
" Navigating this .vimrc w/folds:
" I provided manual fold markers so you can shrink and expand this file at
" your pleasure so first enable folding in you current buffer:
"
" :set foldmethod=marker
"
" Now you can press "za" within any Section to shrink/expand multiple lines
"
" Sections:
" -> General
" -> User Interface
" -> Colors & Fonts
" -> Text, Tab, & Indent-related
" -> Tabs, Windows, & Buffers
" -> Status Line
" -> Mapping Edits
" -> Files & Backups
" -> Macros
"
"""""""""""""""""""""""""""""""""""""""""""""""}}}
"
" GENERAL
"
"""""""""""""""""""""""""""""""""""""""""""""""{{{
" sets number of lines for vim to remember
set history=200
" Enable auto-indenting based on filetype
filetype indent on
" :W sudo saves the file
" (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
" Brutally murder 'Ex mode'
noremap Q <nop>
"""""""""""""""""""""""""""""""""""""""""""""""}}}
"
" USER INTERFACE
"
"""""""""""""""""""""""""""""""""""""""""""""""{{{
" avoid messy non-english characters
let $LANG='en'
set langmenu=en
" Enable command-line auto-completions
set wildmenu
set wildmode=longest:list,full
" Ignore files (compiled, etc.)
set wildignore=*.o,*~,*.pyc,.git\*
" Always show current position
set ruler
" Make backspace work like it should
set backspace=indent,eol,start
" Allow Arrow keys to continue between lines
" set whichwrap+=<,>,h,l,[,]
" Ignore case in search
set ignorecase
" Makes search case-sensitive only when search-term has an uppercase
set smartcase
" Highlight search results
set hlsearch
" Updates search on each keypress
set incsearch
" Prevent redrawing while executing macros (good performace config)
set lazyredraw
" Show matching brackets when text indicator is over them
set showmatch
" Remove annoying system error alerts (I've grown to like them tho...)
" set noerrorbells
" set novisualbell
" set t_vb=
" set tm=500
"""""""""""""""""""""""""""""""""""""""""""""""}}}
" COLORS & FONTS
"
"""""""""""""""""""""""""""""""""""""""""""""""{{{
" Enable syntax highlighting
syntax on
" Sets the background theme (most prefer 'dark')
set bg=light
" Sets UTF-8 as standard encoding
set encoding=utf8
"""""""""""""""""""""""""""""""""""""""""""""""}}}
"
" TEXT, TAB, & INDENT-RELATED
"
"""""""""""""""""""""""""""""""""""""""""""""""{{{
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
"""""""""""""""""""""""""""""""""""""""""""""""}}}
"
" TABS, WINDOWS, & BUFFERS
"
"""""""""""""""""""""""""""""""""""""""""""""""{{{
" 'up' & 'down' no longer skip long lines that overflow
map j gj
map k gk
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
map <space> /
map <C-space> ?
"""""""""""""""""""""""""""""""""""""""""""""""}}}
" STATUS LINE
"
"""""""""""""""""""""""""""""""""""""""""""""""{{{
" Always show the status line
set laststatus=2
" Format the status line
" set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
" function! HasPaste()
" if &paste
" return 'PASTE MODE '
" endif
" return ''
" endfunction
"""""""""""""""""""""""""""""""""""""""""""""""}}}
" MAPPING EDITS
"
"""""""""""""""""""""""""""""""""""""""""""""""{{{
" Smart way to move between windows
" map <C-j> <C-W>j
" map <C-k> <C-W>k
" map <C-h> <C-W>h
" map <C-l> <C-W>l
"""""""""""""""""""""""""""""""""""""""""""""""}}}
" FILES & BACKUPS
"
"""""""""""""""""""""""""""""""""""""""""""""""{{{
" Turns backups off (which have saved my life a couple times)
" set nobackup
" set nowp
" set noswapfile
" Opens .json files as if they were a javascript filetype
autocmd BufNewFile,BufRead *.json set ft=javascript
"""""""""""""""""""""""""""""""""""""""""""""""}}}
"
" HELPFUL MACROS
"
"""""""""""""""""""""""""""""""""""""""""""""""{{{
"h - turns word into html tags
let @h="yiWi<pa></Ea>Bf<"
"c - compute arithmetic and paste after equals sign
let @c="yt=f=a =0"
"q - surround word in quotes
let @q="viwa\"hbi\"lel"
"p - wrap text in python print statement
let @p="0yEiprint(\"A: \" + str(pA))"