Repository navigation
Expand file tree
/
Copy pathdot_vimrc
More file actions
145 lines (108 loc) · 3.76 KB
/
Copy pathdot_vimrc
File metadata and controls
145 lines (108 loc) · 3.76 KB
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
let data_dir = '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
Plug 'junegunn/vim-easy-align'
Plug 'ycm-core/YouCompleteMe'
Plug 'cespare/vim-toml', { 'branch': 'main' }
let g:fzf_install = 'yes | ./install'
Plug 'junegunn/fzf', { 'do': g:fzf_install }
call plug#end()
set encoding=utf-8
set ffs=unix,dos,mac
set nobackup
set nowb
set noswapfile
set expandtab
set smarttab
set nocompatible
set lazyredraw
set showcmd
set ruler
set number
" Open new split panes to right and bottom
set splitbelow
set splitright
" Spell Check
autocmd BufRead,BufNewFile *.md set filetype=markdown
" Spell-check Markdown files
autocmd FileType markdown setlocal spell
" Spell-check Git messages
autocmd FileType gitcommit setlocal spell
" Set spellfile to location that is guaranteed to exist,
" can be symlinked to Dropbox or kept in Git
" and managed outside of thoughtbot/dotfiles using rcm.
set spellfile=$HOME/.vim-spell-en.utf-8.add
" Autocomplete with dictionary words when spell check is on
set complete+=kspell
" Set to auto read when a file is changed from the outside
set autoread
let mapleader = ","
" Quick save
nmap <leader>w :w!<cr>
" sudo save
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
set wildignore=*.o,*~,*.pyc
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
:fixdel
" For regular expressions turn magic on
set magic
" Switch between the last two files
nnoremap <Leader><Leader> <C-^>
" Map Ctrl + p to open fuzzy find (FZF)
nnoremap <c-p> :Files<cr>
" Window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Visual mode pressing * or # searches for the current selection
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" 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
" Git commits
au FileType gitcommit setlocal spell spelllang=en
" Go
au FileType go setlocal noexpandtab nolist shiftwidth=4 softtabstop=4 tabstop=4
" HTML
au FileType html setlocal expandtab noautoindent indentexpr= shiftwidth=2 softtabstop=2 tabstop=2
" Javascript
au FileType javascript setlocal expandtab keywordprg=cq\ -s shiftwidth=2 softtabstop=2 tabstop=8
" Make
au FileType make setlocal softtabstop=8 shiftwidth=8 tabstop=8
" Perl
au FileType perl setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8
" Python
au FileType python setlocal expandtab softtabstop=0 shiftwidth=4 tabstop=8 smarttab
au FileType toml setlocal expandtab softtabstop=2 shiftwidth=2 tabstop=2 smarttab
" SQL
au FileType sql setlocal expandtab shiftwidth=8 softtabstop=8 tabstop=8
" Shell
"" When the type of shell script is /bin/sh, assume a POSIX-compatible
" shell for syntax highlighting purposes.
let g:is_posix = 1
au FileType bash setlocal expandtab shiftwidth=2 softtabstop=2 tabstop=2
au FileType zsh setlocal expandtab shiftwidth=2 softtabstop=2 tabstop=2
" Display extra whitespace
set list listchars=tab:»·,trail:·,nbsp:·
set nojoinspaces
" https://github.com/ggreer/the_silver_searcher
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in fzf for listing files
let $FZF_DEFAULT_COMMAND = 'ag --literal --files-with-matches --nocolor --hidden -g ""'
" vim: set filetype=vim: