-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_vimrc.tmpl
189 lines (175 loc) · 6.03 KB
/
dot_vimrc.tmpl
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
syntax enable
set background=dark
set termguicolors
colorscheme gruvbox
"============= Settings =============
set nocompatible "Necessary for cool vim things
set number relativenumber "Line numbers relative to the present line
set colorcolumn=88
set cursorline
set scrolloff=5
let g:mapleader=" "
filetype off " required
" =========== Set up Vundle ========
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Solid
{{- if eq .chezmoi.hostname "p180380" }}
Plugin 'davidhalter/jedi-vim'
{{- end }}
Plugin 'junegunn/fzf.vim'
Plugin 'ervandew/supertab'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-commentary'
Plugin 'nvie/vim-flake8'
Plugin 'itchyny/lightline.vim'
Plugin 'lervag/vimtex'
" Plugin 'Valloric/YouCompleteMe'
Plugin 'psf/black'
Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'conornewton/vim-pandoc-markdown-preview'
Plugin 'kovetskiy/sxhkd-vim'
Plugin 'morhetz/gruvbox'
Plugin 'sillybun/vim-repl'
" Use it
Plugin 'mechatroner/rainbow_csv'
Plugin 'ledger/vim-ledger'
Plugin 'scrooloose/nerdtree'
Plugin 'plytophogy/vim-virtualenv'
" Barely use
Plugin 'tpope/vim-surround'
Plugin 'szw/vim-tags'
Plugin 'tpope/vim-repeat'
Plugin 'michaeljsmith/vim-indent-object'
" Consider changing
Plugin 'ctrlpvim/ctrlp.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
" ==================================
" using soft tabs
set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4
set hlsearch " Switch on highlighting the last used search pattern.
" Press F4 to toggle highlighting on/off, and show current value.
noremap <F4> :set hlsearch! hlsearch?<CR>
set spell spelllang=en_gb
noremap <F5> :set spell! spell?<CR>
set backup " keep a backup file (restore to previous version)
if has('persistent_undo')
set undofile " keep an undo file (undo changes after closing)
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
autocmd BufWritePre * %s/\s\+$//e " remove trailing whitespaces on save
autocmd BufWritePre *.py %s/\n\n# In\[[0-9]\+]:\n\n//e " remove IPython breadcrumbs
autocmd BufWritePre *.py execute ':Black'
" How can I open NERDTree automatically when vim starts up on opening a
" directory?
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
autocmd FileType python setlocal completeopt-=preview
autocmd BufWritePost *sxhkdrc !killall sxhkd; setsid sxhkd &
autocmd BufWritePost *.config/polybar/*conf* !~/.config/polybar/launch.sh
autocmd BufWritePost *.config/compton.conf !pkill compton && compton &
au! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
" Ledger
au FileType ledger noremap { ?^\d<CR>
au FileType ledger noremap } /^\d<CR>
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Add optional packages.
"
" The matchit plugin makes the % command work better, but it is not backwards
" compatible.
" The ! means the package won't be loaded right away but when plugins are
" loaded during initialization.
if has('syntax') && has('eval')
packadd! matchit
endif
set undodir=~/.vim/.undo//
set backupdir=~/.vim/.backup//
set directory=~/.vim/.swp//
" Setting Lightline
let g:lightline = {
\ 'colorscheme': 'seoul256',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ],
\ [ 'venv' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead',
\ 'venv': 'virtualenv#statusline'
\ },
\ }
set laststatus=2
let g:tex_flavor = 'latex'
" Setting up NERDTree
map <C-n> :NERDTreeToggle<CR>
" Black
" let g:black_linelength=79 " PEP8
noremap <F6> :Black<CR>
" Dispatch
nnoremap <leader>mh :Make! html<CR>
" Pandoc preview
nnoremap <leader>pp :StartMdPreview<CR>
let g:md_pdf_viewer="zathura"
" Copy full path to system register
:nmap <leader>cfp :let @+ = expand("%:p")<CR>
" Ledger
nnoremap <leader>ts :call ledger#transaction_state_toggle(line('.'), ' *')<CR>
" for the following the cursor must be above the number strictly
nnoremap <leader>aa :call ledger#align_amount_at_cursor()<CR>
nnoremap <leader>rc :6new<bar>read !hledger bal assets liabilities -2 -C<CR>
let g:ledger_default_commodity="EUR"
let g:ledger_commodity_sep=" "
let g:ledger_commodity_before=0
" let g:ledger_align_at=55
" Need to disable YouCompleteMe for account completion to work :shrug:
if exists('g:ycm_filetype_blacklist')
call extend(g:ycm_filetype_blacklist, { 'ledger': 1 })
endif
map <leader>ca oAssets:Checking<ESC>
map <leader>cc oLiabilities:CreditCard<ESC>
" Pandoc
let g:pandoc#biblio#bibs=['~/Documents/bib/mri.bib']
if !exists('g:ycm_semantic_triggers')
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers.pandoc = ['@']
let g:ycm_filetype_blacklist = {}
let g:pandoc#modules#disabled = ["folding"]
let g:pandoc#formatting#mode = "hA"
let g:pandoc#formatting#smart_autoformat_on_cursormoved = 1
let g:pandoc#folding#level = 2
let g:pandoc#folding#mode = "relative"
let g:pandoc#after#modules#enabled = ["nrrwrgn", "tablemode"]
let g:pandoc#completion#bib#mode = 'citeproc'
let g:pandoc#syntax#colorcolumn = 1
nnoremap <leader>md :Pandoc pdf -F pandoc-xnos<CR>
nnoremap <leader>pp :StartMdPreview<CR>
" REPL
nnoremap <leader>rt :REPLToggle<CR>
let g:repl_program = {
\ 'python': ['/usr/bin/env ipython'],
\ 'default': ['bash']
\ }
" vim:ft=vim