-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvimrc
156 lines (122 loc) · 3.82 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
" don't want no vi support
set nocompatible
" using vundle to load all plugins
if filereadable(expand("~/.vim/plug"))
source ~/.vim/plug
endif
" enable syntax highlighting and file type detection
" fix colors in gnome-terminal
if $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
" ---------------------------------------------------------------------------
" BASIC SETTINGS
" ---------------------------------------------------------------------------
" Colorscheme options
autocmd vimenter * colorscheme daves-tomorrow-transparent
" Other Options
set wildmode=longest,list,full
set wildmenu
set ruler
set nuw=4
set number
set backspace=indent,eol,start
set laststatus=2
set showmode
set showmatch
set ignorecase
set ignorecase smartcase
set tabstop=4
set expandtab
set softtabstop=4
set shiftwidth=4
set nowrap
set hlsearch
set nobackup
set nowritebackup
set noswapfile
set list listchars=tab:··,trail:·
set autoread
set splitright
set splitbelow
set showcmd
set textwidth=100
set modeline
set nojoinspaces
" toggle paste mode with F2
set pastetoggle=<F2>
" Include user's local vim config
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
" --------------------------------------------------------------------------
" CUSTOM AUTOCMDS
" --------------------------------------------------------------------------
augroup vimrcEx
" clear all autocmds in the group
autocmd!
" go to the last cursor position in the file
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
autocmd FileType ruby setlocal sw=2 sts=2 ts=2
autocmd FileType yaml setlocal ts=2 sts=2 sw=2
autocmd FileType javascript setlocal sw=2 sts=2
augroup END
" ---------------------------------------------------------------------------
" PLUGIN SETTINGS
" ---------------------------------------------------------------------------
" turn on vim-airline
let g:airline_powerline_fonts = 1
" set the snippets directory
let g:snippets_dir="~/.vim/snippets"
" map Ctrl-p to FzF Files
nmap <C-P> :Files<CR>
" turn on rainbow parentheses
let g:rainbow_active = 1
let g:rainbow_conf = {'separately': {'nerdtree': 0}} " don't use on nerdtree window
" ignore pyc files
let NERDTreeIgnore = ['\.pyc$', '_site', '__pycache__']
set wildignore+=*.pyc,*/_site/**,*/__pycache__/**
let g:html_indent_inctags = "p,li"
" fix strange escape char sequences that appear with devicons and vim-airline
" https://github.com/ryanoasis/vim-devicons/issues/359
set t_RV=
let g:ale_fixers = {"python": ["black", "isort"]}
" let g:ale_fix_on_save = 1
" ---------------------------------------------------------------------------
" MAPPINGS
" ---------------------------------------------------------------------------
" use arrow keys to navigate splits
nnoremap <silent> <Right> <c-w>l
nnoremap <silent> <Left> <c-w>h
nnoremap <silent> <Up> <c-w>k
nnoremap <silent> <Down> <c-w>j
" Set map leader to , instead of \
let mapleader = ","
" Show vim-which-key after timeout
nnoremap <silent> <leader> :<c-u>WhichKey ','<CR>
" Nerd Tree commands and options
map <Leader>d :NERDTreeToggle<CR>
" remove the Windows line endings (^M)
map <Leader>m mz:%s/\r$//g<cr>`z
" get rid of highlighting
noremap <silent> <c-l> :noh<cr><c-l>
" run ALEFix
map <Leader>f :ALEFix<CR>
" ---------------------------------------------------------------------------
" SPELLING
" ---------------------------------------------------------------------------
map <Leader>s :setlocal spell! spelllang=en_us<cr>
iab defintion definition
iab Defintion Definition
iab enviornment environment
iab Enviornment Environment
iab fitler filter
iab Fitler Filter
iab teh the
iab Teh The
" spell check git commit messages and markdown
autocmd BufNewFile,BufRead COMMIT_EDITMSG setlocal spell spelllang=en_us
autocmd BufNewFile,BufRead *.md setlocal spell spelllang=en_us