-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
197 lines (151 loc) · 4.46 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
"separates vim from vi, allowing the many customizations found in vim
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
" run :PluginInstall to ... duh.
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'gmarik/vundle'
Plugin 'kien/ctrlp.vim'
Plugin 'thoughtbot/vim-rspec'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-endwise'
Plugin 'Lokaltog/vim-distinguished'
Plugin 'mkitt/tabline.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'slim-template/vim-slim'
Plugin 'elixir-lang/vim-elixir'
Plugin 'posva/vim-vue'
Plugin 'digitaltoad/vim-pug'
Plugin 'slime-lang/vim-slime-syntax'
call vundle#end()
filetype plugin indent on
au BufNewFile,BufRead *.prawn set filetype=ruby
au BufNewFile,BufRead *.json.jbuilder set filetype=ruby
au BufNewFile,BufRead *.axlsx set filetype=ruby
"In the bottom of the screen, it will show me the XY coordinates of my cursor
set ruler
set rulerformat='%60(%f:%l\ of\ %L%)'
"Highlight cursor line
set cursorline
"New panes should open below and to the right, which is more intuitive
set splitbelow
set splitright
"prevents vim from creating a separate backup file.
set nobackup
set nowritebackup
"prevents vim from creating a separate swap file, which tends to get in the way of git.
set noswapfile
set history=50
"shows relevant information at bottom of screen when you are using commands.
set showcmd
"live searching as you type
set incsearch
"search terms stay highlighted after you hit enter
set hlsearch
map <space> <leader>
"get rid of highlighting after you are done with searching
map <leader>h :nohlsearch<cr>
"search ignores case iff all letters in search field are lower case.
"otherwise, it will be case-sensitive
set ignorecase
set smartcase
"there will always be X lines of context above and below your cursor.
set scrolloff=10
"tab increments by two spaces
set tabstop=2
set shiftwidth=2
set expandtab
"hit tab for vim to autocomplete you file name. Hit tab again to cycle to next option.
set wildmode=full
" 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
" Display extra whitespace
set list listchars=tab:··,trail:·
"Text does not wrap at edge of file
set nowrap
"Create ruler, with width of 1
set numberwidth=1
"create function that turns line numbers on and off
function! ToggleLineNumbers()
if(&relativenumber == 1)
set norelativenumber
else
if(&number == 1)
set nonumber
else
set relativenumber
endif
endif
endfunction
"set toggle line numbers
map <leader>p :call ToggleLineNumbers()<cr>
"set line numbers to be relative by default
set relativenumber
"create function that switches between relative and absolute line numbers
function! RelativeNumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
map <leader>r :call RelativeNumberToggle()<cr>
"set auto indentation
set autoindent
"set smartindent <- This has been set off because it interferes with the endwise plugin
"movement keys always move cursor to start of a line.
set startofline
"set default explorer style to be tree
let g:netrw_liststyle=3
"map <leader>k :NERDTreeToggle<cr>
"let NERDTreeShowHidden=1
map <leader>k :Ex<cr>
set t_Co=256
color distinguished
set noerrorbells
"mapping for vim-rspec
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
"open up todo file
map <Leader>o :e .todo<CR>
"backspace deletes characters
map <backspace> X
"switch splits and make full-screen
map <leader>q <c-w>w<c-w>\|
"make current split full-screen
map <leader>w <c-w>\|
"make current screens equal size
map <leader>e <c-w>=
"open new vertical split
map <leader>v :Vex<cr><c-w>=
"open new horizontal split
map<leader>c :Sex<cr><c-w>=
"enter a new line without going into insert mode
map<leader><cr> o<esc>
"Insert tabs without going into insert mode
"map<tab> >>
"map<s-Tab> <<
"being typing shell commands
map<leader>i :!<cr>
"Common mistaken keys for saving and quitting
map :W<cr> :w<cr>
map :Q<cr> :q<cr>
map :WQ<cr> :wq<cr>
map :Wq<cr> :wq<cr>
map :wQ<cr> :wq<cr>
"vim tab management
map<S-Tab> gT
map<tab> gt
map<leader><tab> :Texplore<cr>
" Easy access to beginning of line and end of line
map<leader>B ^
map<leader>E $
"allow vim-rspec to run with spring
let g:rspec_command = "!bundle exec rspec {spec}"
" Ignore certains directories for ctrl-p
let g:ctrlp_custom_ignore= 'deps\|node_modules'