-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
85 lines (76 loc) · 2.65 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
" basics:
set nocompatible
filetype off
syntax on
set number
" put backups and swaps out of the current dir
set backupdir=~/.vim/tmp//,.
set directory=~/.vim/tmp//,.
set undodir=~/.vim/tmp//,.
" abbreviations:
abbr _email [email protected]
" non-recursive key mappings:
" use space to scroll down
noremap <SPACE> <C-F>
" use tab to move to next sentence
noremap <TAB> )
" vim plugins/plugin managers:
filetype plugin indent on
" vim-plug
call plug#begin('~/.vim/plugged')
Plug 'https://github.com/Valloric/YouCompleteMe'
Plug 'mattn/emmet-vim'
call plug#end()
" pathogen
execute pathogen#infect()
"NERDTree settings
" start NERDTree automatically if no file is specified with `vim`
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" tab, space, and backspace settings:
" set autoindenting for new code blocks
set autoindent
set cindent
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" on pressing tab, insert 4 spaces
set expandtab
" set backspace <Del> to work as it does in other text editors
set backspace=indent,eol,start
" autocompletion:
" close autocomplete help window if you exit insert mode or select a prompt
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" redefine emmet command as ',,'
let g:user_emmet_leader_key=','
" add autocomplete for css files
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
" custom code-snippets;
" react class component boilerplate
inoremap _rc <Esc>:.-1r ~/.vim/boilerplate/react/class_component.js<cr>:%s/___/\=expand('%:r')/g<cr>jdd8ki<Tab><Tab><Tab><Tab>
" react functional component boilerplate
inoremap _rfc <Esc>:.-1r ~/.vim/boilerplate/react/functional_component.js<cr>:%s/___/\=expand('%:r')/g<cr>jdd7ki<Tab><Tab><Tab>
" editing/comparing multiple files:
" set vim window splits to be equal in width
set ead=hor ea noea
" command to equalize screen spacings
command Fvs :set ead=hor ea noea
" set vsplit to open new window to the right
set splitright
" show diffs side by side
set diffopt+=vertical
" vim stylings:
" set colorscheme
colorscheme znake
" vim system settings:
" saves previous undoes from before file was closed
if has("vms")
set nobackup
else
set backup
if has('persistent_undo')
set undofile
endif
endif