dotfiles/vim/.vimrc

63 lines
1.9 KiB
VimL

""Basic stuff
set number
""Colors
colorscheme synthwave
set t_Co=256
""Misc
set clipboard=unnamedplus
set nofoldenable
""Spaces instead of tabs
set expandtab
set tabstop=2
set shiftwidth=2
""Keybindings
set pastetoggle=<F2>
map <Space> :noh<CR>
"" Mail
au FileType mail
\ if expand('%p') =~ '^/tmp/neomutt-' |
\ set ft=markdown |
\ endif
"" Markdown
au FileType markdown Goyo
let g:markdown_fenced_languages = ['cpp', 'python', 'java']
let g:vim_markdown_math=1
"" Pandoc
autocmd FileType markdown nnoremap <silent> <F3> :<c-u>!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template eisvogel --listings &<cr>
autocmd FileType markdown nnoremap <silent> <F4> :<c-u>!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template handout &<cr>
autocmd FileType markdown nnoremap <silent> <F5> :<c-u>!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template assignment &<cr>
autocmd FileType markdown nnoremap <silent> <F6> :<c-u>!zathura %:p:r:S.pdf &<cr>
autocmd FileType markdown nnoremap <silent> <F7> :<c-u>!rm %:p:r:S.pdf &<cr>
"" Snippets
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
"" Vim-plug
call plug#begin('~/.vim/plugged')
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
Plug 'junegunn/goyo.vim', { 'on': 'Goyo' }
Plug 'SirVer/ultisnips', { 'for': 'markdown' }
Plug 'tpope/vim-fugitive', { 'on': 'Goyo' }
Plug 'tpope/vim-surround'
Plug 'Raimondi/delimitMate'
call plug#end()
"" Quitting whether Goyo is active or not
function! g:Goyo_before()
let b:quitting = 0
let b:quitting_bang = 0
autocmd QuitPre <buffer> let b:quitting = 1
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
endfunction
function! g:Goyo_after()
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
if b:quitting_bang
qa!
else
qa
endif
endif
endfunction
let g:goyo_callbacks = [function('g:Goyo_before'), function('g:Goyo_after')]