-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_vimrc
143 lines (123 loc) · 3.76 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
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
" ~/.vimrc
" for initial setup see https://github.com/junegunn/vim-plug
set autoindent
set backspace=indent,eol,start
set cursorline
set errorbells
set history=1000
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set modelines=1
set mousehide
set nowrap
set number
set scrolloff=5
set showbreak="+++ "
set showmatch
set smartcase
set termguicolors
set wildignore=*.jpg,*.png,*.gif,*.pdf,*.pyc
set wildmenu
set wildmode=list:longest,full
set wrapmargin=0
" gui options & font
set antialias
set enc=utf-8
set guifont=Monaco:h13
" keyboard mappings
map V {!}par}jz.
map <F2> /\(^>.*\\|\.\.\.\\|:\.\.\\|\.\.:\)/<CR>
map <F3> mtj!?:$<CR>register-time<CR>'t
map <F4> :r!now<CR>
" make shift-insert work like in xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
" enable filetype includes & syntax
filetype on
filetype plugin on
filetype indent on
syntax on
" language preferences
autocmd FileType py setlocal tabstop=4 shiftwidth=4 expandtab smarttab
autocmd FileType css setlocal tabstop=2 shiftwidth=2 expandtab smarttab
autocmd FileType html setlocal tabstop=2 shiftwidth=2 expandtab smarttab
" language abbreviations
autocmd FileType python iabbrev pdb breakpoint()
" highlight columns 80+
highlight rightMargin term=bold ctermfg=blue guifg=blue
match rightMargin /.\%>81v/
" install and run vim-plug on first run
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
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" plugins
call plug#begin()
Plug 'airblade/vim-gitgutter'
Plug 'chriskempson/base16-vim'
Plug 'dense-analysis/ale'
Plug 'editorconfig/editorconfig-vim'
Plug 'itchyny/lightline.vim'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
Plug 'lstwn/broot.vim'
Plug 'preservim/nerdtree'
Plug 'ruanyl/vim-gh-line'
Plug 'othree/html5.vim'
Plug 'pangloss/vim-javascript'
Plug 'evanleck/vim-svelte'
Plug 'liuchengxu/vim-which-key'
call plug#end()
" which-key integration
nnoremap <silent> <leader> :<c-u>WhichKey '<leader>'<CR>
set timeoutlen=500
" goyo & limelight integration
" see https://github.com/junegunn/limelight.vim
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!
" set base16 colors, see https://github.com/FabioAntunes/base16-fish-shell
function s:Base16Colors()
if filereadable(expand("~/.vimrc_background"))
let base16colorspace=256
source ~/.vimrc_background
endif
endfunction
" base16 colors
call s:Base16Colors()
" highlight 'overflow', see https://superuser.com/a/519629
highlight OverLength ctermbg=darkred guibg=#592929
call matchadd('OverLength', '\%>80v.\+')
" fzf plugin shortcuts, see https://github.com/junegunn/fzf
nnoremap <C-t> :Files<CR>
nnoremap ; :Rg<CR>
" nerdtree integration, see https://github.com/preservim/nerdtree
nnoremap <leader>n :NERDTreeToggle<CR>
nnoremap <leader>f :NERDTreeFind<CR>
" fzy integration, see https://github.com/jhawthorn/fzy#use-with-vim
function! FzyCommand(choice_command, vim_command)
try
let output = system(a:choice_command . " | fzy ")
catch /Vim:Interrupt/
" Swallow errors from ^C, allow redraw! below
endtry
redraw!
if v:shell_error == 0 && !empty(output)
exec a:vim_command . ' ' . output
endif
endfunction
" fzy integration
nnoremap <leader>e :call FzyCommand("ag . --silent -l -g ''", ":e")<cr>
nnoremap <leader>v :call FzyCommand("ag . --silent -l -g ''", ":vs")<cr>
nnoremap <leader>s :call FzyCommand("ag . --silent -l -g ''", ":sp")<cr>
" broot integration
if filereadable(expand('~/.config/broot/conf.hjson'))
let g:broot_default_conf_path = expand('~/.config/broot/conf.hjson')
nnoremap <silent> <leader>b :BrootHomeDir<CR>
nnoremap <silent> - :BrootCurrentDir<CR>
endif