-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
167 lines (124 loc) · 4.1 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
set encoding=utf-8
set nocompatible " be iMproved
"set nowrap
set paste
set nospell
filetype off " required!
set textwidth=90
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/vundle' " vim package management
Plugin 'tpope/vim-bundler'
"Plugin 'python-mode/python-mode'
Plugin 'psf/black' " format python code
Plugin 'nvie/vim-flake8' " lint python code
Plugin 'ctrlp.vim' " fuzzy search through subdirectories
Plugin 'DirDiff.vim' " diff entire directories of files
Plugin 'commentary.vim' " easily comment blocks of code
"Plugin 'mhinz/vim-signify' " show version control diffs
"Plugin 'tpope/vim-dispatch'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-endwise' " easily find end of if, do, and def blocks https://github.com/tpope/vim-endwise
"Plugin 'easymotion/vim-easymotion' "https://github.com/easymotion/vim-easymotion
Plugin 'preservim/tagbar' " list outline of classes in file https://github.com/preservim/tagbar
Plugin 'christoomey/vim-tmux-navigator'
" syntax highlight support
Plugin 'tpope/vim-markdown'
Plugin 'ekalinin/Dockerfile.vim'
Plugin 'hashivim/vim-terraform'
Plugin 'tsandall/vim-rego'
Plugin 'LnL7/vim-nix'
Plugin 'fisadev/vim-isort'
Plugin 'jalvesaq/Nvim-R'
Plugin 'kamykn/spelunker.vim'
call vundle#end()
filetype plugin indent on
set paste
" display relative line numbers
set number
set numberwidth=3
" enable syntax highlighting
syntax on
" underline the current line
set cursorline
" case insensitive search
set ignorecase
" highlight searches
set hlsearch
set vi+=n
set backspace=indent,eol,start
"""""""""""""""""""""""""""""""""""""
" file type associations
"""""""""""""""""""""""""""""""""""""
autocmd BufNewFile,BufReadPost *.md,*.markdown set filetype=markdown
autocmd BufNewFile,BufReadPost *.jbuilder set filetype=ruby
autocmd BufNewFile,BufReadPost *.py.tpl set filetype=python
"""""""""""""""""""""""""""""""""""""
" indentation: use spaces instead of tabs
"""""""""""""""""""""""""""""""""""""
"set smartindent
"set tabstop=4 shiftwidth=4 softtabstop=4 showtabline=4 expandtab
set tabstop=4 shiftwidth=4 expandtab
" set tabstop=2 shiftwidth=2 expandtab
" set 2 space tabs when appropriate
autocmd FileType go,r,R,yml,yaml,json,markdown,ruby,javascript,Rakefile setlocal shiftwidth=2 tabstop=2 softtabstop=2 showtabline=2
" set 4 space tabs when appropriate
autocmd FileType python,*.py.tpl setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4 showtabline=4
" Remove end of line whitespace on save
autocmd BufWritePre * :%s/\s\+$//e
" format python code with Black on save
"autocmd BufWritePre * :Black
" Better diff highlighting
highlight! link DiffText MatchParen
"""""""""""""""""""""""""""""""""""""
" NERDtree config
"""""""""""""""""""""""""""""""""""""
" default larger window width
let g:NERDTreeWinSize = 40
"""""""""""""""""""""""""""""""""""""
" highlight characters past column 80
" http://unlogic.co.uk/2013/02/08/vim-as-a-python-ide/
"""""""""""""""""""""""""""""""""""""
" augroup vimrc_autocmds
" autocmd!
" autocmd FileType python highlight OverLength ctermfg=white ctermbg=red guibg=#592929
" autocmd FileType python match OverLength /\%81v.\+/
" "autocmd FileType python set nowrap
" augroup END
""""""""""""""""""""""""""""""""""""""
" Terraform formatting
""""""""""""""""""""""""""""""""""""""
let g:terraform_align=1
let g:terraform_fmt_on_save=1
""""""""""""""""""""""""""""""""""""""
" Leader keyboard shortcuts
""""""""""""""""""""""""""""""""""""""
"set timeoutlen=500
let mapleader = ","
" close file
nnoremap <leader>q :q<cr>
" save file
nnoremap <leader>s :w<cr>
" new tab
nnoremap <leader>t :Tex<cr>
" horizontal split
nnoremap <leader>h :sp<cr>
" vertical split
nnoremap <leader>v :vsp<cr>
" insert date
nnoremap <leader>d :put =strftime('%Y-%m-%d')<CR>
" Go to tab by number
noremap <leader>1 1gt
noremap <leader>2 2gt
noremap <leader>3 3gt
noremap <leader>4 4gt
noremap <leader>5 5gt
noremap <leader>6 6gt
" navigation with control keys
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
nmap <F8> :TagbarToggle<CR>