-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot-vimrc
89 lines (78 loc) · 2.59 KB
/
dot-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
set nocompatible
" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
" vim-plug
call plug#begin()
Plug 'ap/vim-css-color' " Colorize hex characters
Plug 'tpope/vim-fugitive' " Git plugin
Plug 'tpope/vim-rhubarb' " GitHub plugin for fugitive
Plug 'shumphrey/fugitive-gitlab.vim' " GitLab plugin for fugitive
Plug 'editorconfig/editorconfig-vim' " Editorconfig plugin
Plug 'preservim/nerdtree' " File browser plugin
Plug 'hashivim/vim-hashicorp-tools' " Hashicorp plugins (Packer, Terraform, etc.)
Plug 'szw/vim-maximizer' " Maximize Vim windows
Plug 'kristijanhusak/vim-carbon-now-sh'
Plug 'itspriddle/vim-shellcheck'
let g:carbon_now_sh_options =
\{
\'t': 'monokai',
\'bg': '#F5A623',
\'wt': 'none',
\'wc': 'false',
\'fm': 'Hack',
\'fs': '18px',
\'ln': 'false',
\'ds': 'true',
\'dsyoff': '20px',
\'dsblur': '68px',
\'wa': 'true',
\'lh': '133%',
\'pv': '48px',
\'ph': '32px',
\'si': 'false',
\'wm': 'false',
\'es': '2x'
\}
call plug#end()
set path+=**
set wildmenu
" Enable line numbers
set number
set relativenumber
" Enable undo history
set undofile
set undodir=~/.vim/undo
" Disable arrow keys (easier for Ducky mini which has arrows as Fn keys at
" kl;o)
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" NERDTree shortcuts
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
" Markdown preview generator using pandoc (via STDIN) and xdg-open
" Essentially: `cat <tmp_markdown> | pandoc > <tmp_html>; xdg-open <tmp_html>`
function MarkdownPreview()
:let TMPIN = systemlist("mktemp --suffix .md")[0]
:let TMPOUT = systemlist("mktemp --suffix .html")[0]
:execute "w! " . TMPIN
:silent execute "!cat " . TMPIN . " | pandoc -s -f markdown -t html 2>/dev/null 1> " . TMPOUT
:silent execute "!xdg-open " . TMPOUT . " &>/dev/null"
:redraw!
endfunction
:nmap <Leader>p :call MarkdownPreview()<CR>
" Create vertical split terminal to the right (and below if applicable)
nnoremap <silent> <Leader>t :rightbelow vertical terminal<CR>
" Resize vertical splits
nnoremap <silent> <Leader>+ :exe "vertical resize " . (winwidth(0) * 3/2)<CR>
nnoremap <silent> <Leader>- :exe "vertical resize " . (winwidth(0) * 2/3)<CR>