2018-06-24 13:25:59 +02:00
|
|
|
" Plugins
|
|
|
|
set nocompatible
|
|
|
|
filetype off
|
|
|
|
|
|
|
|
set rtp+=~/.vim/bundle/Vundle.vim
|
|
|
|
call vundle#begin()
|
2018-08-29 21:22:24 +02:00
|
|
|
Plugin 'VundleVim/Vundle.vim'
|
|
|
|
Plugin 'vim-pandoc/vim-pandoc'
|
|
|
|
Plugin 'vim-pandoc/vim-pandoc-syntax'
|
2018-06-24 13:25:59 +02:00
|
|
|
call vundle#end()
|
2018-11-20 15:13:51 +01:00
|
|
|
filetype plugin indent on
|
2018-06-24 13:25:59 +02:00
|
|
|
|
2018-08-29 21:22:24 +02:00
|
|
|
" Filetypes
|
|
|
|
au BufNewFile,BufRead *.md set filetype=md
|
|
|
|
au BufNewFile,BufRead *.tex set filetype=tex
|
|
|
|
au BufNewFile,BufRead config set filetype=config
|
2018-06-24 13:25:59 +02:00
|
|
|
" Functions
|
2018-08-29 21:22:24 +02:00
|
|
|
|
|
|
|
"" Move the swap file location to protect against CVE-2017-1000382
|
|
|
|
if exists('$XDG_CACHE_HOME')
|
|
|
|
let &g:directory=$XDG_CACHE_HOME
|
|
|
|
else
|
|
|
|
let &g:directory=$HOME . '/.cache'
|
|
|
|
endif
|
|
|
|
let &g:directory.='/vim/swap//'
|
|
|
|
"" Create swap directory if it doesn't exist
|
|
|
|
if ! isdirectory(expand(&g:directory))
|
|
|
|
silent! call mkdir(expand(&g:directory), 'p', 0700)
|
|
|
|
endif
|
2018-06-24 13:25:59 +02:00
|
|
|
|
|
|
|
" Basics
|
|
|
|
syntax on
|
2018-06-25 05:23:12 +02:00
|
|
|
filetype indent plugin on
|
2018-10-05 21:21:11 +02:00
|
|
|
set background=light
|
2018-10-03 18:39:19 +02:00
|
|
|
colorscheme PaperColor
|
2018-06-24 13:25:59 +02:00
|
|
|
set encoding=utf-8
|
|
|
|
set autowrite
|
2018-06-25 05:23:12 +02:00
|
|
|
set smartcase
|
2018-08-29 21:22:24 +02:00
|
|
|
set incsearch
|
|
|
|
set hlsearch
|
|
|
|
set nofoldenable
|
2018-06-25 05:23:12 +02:00
|
|
|
" Line Numbers
|
2018-08-29 21:22:24 +02:00
|
|
|
"set number
|
|
|
|
"set relativenumber
|
2018-06-25 05:23:12 +02:00
|
|
|
|
2018-06-24 13:25:59 +02:00
|
|
|
" Tab behavior
|
|
|
|
set expandtab
|
|
|
|
set tabstop=4
|
2018-06-25 05:23:12 +02:00
|
|
|
set shiftwidth=4
|
|
|
|
set softtabstop=4
|
|
|
|
|
2018-06-24 13:25:59 +02:00
|
|
|
"" New window positions
|
|
|
|
set splitbelow
|
|
|
|
set splitright
|
|
|
|
|
|
|
|
" Remaps
|
|
|
|
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>
|
2018-11-20 15:13:51 +01:00
|
|
|
nnoremap J :bn<Enter>
|
|
|
|
nnoremap K :bp<Enter>
|
2018-08-29 21:22:24 +02:00
|
|
|
nmap 0 ^
|
|
|
|
|
|
|
|
" Latex
|
2018-11-20 15:13:51 +01:00
|
|
|
"let g:tex_nospell=1
|
2018-06-24 13:25:59 +02:00
|
|
|
" Shortcuts
|
2018-08-29 21:22:24 +02:00
|
|
|
map <Space><Tab> <Esc>/<x_x><Enter>c5l
|
|
|
|
inoremap <Space><Tab> <Esc>/<x_x><Enter>c5l
|
|
|
|
vnoremap <Space><Tab> <Esc>/<x_x><Enter>c5l
|
2018-06-24 13:25:59 +02:00
|
|
|
inoremap ;; <x_x>
|
2018-10-05 21:21:11 +02:00
|
|
|
inoremap jj <Esc>
|
2018-08-29 21:22:24 +02:00
|
|
|
inoremap ;date <C-R>=strftime("%Y/%m/%d")<Enter>
|
|
|
|
inoremap ;time <C-R>=strftime("%H:%M:%S")<Enter>
|
|
|
|
" Diaeresis for e.g. german
|
|
|
|
inoremap "a ä
|
|
|
|
inoremap "o ö
|
|
|
|
inoremap "u ü
|
|
|
|
inoremap "A Ä
|
|
|
|
inoremap "U Ü
|
|
|
|
inoremap "O Ö
|
|
|
|
inoremap ;ss ß
|
|
|
|
inoremap ;euro €
|
2018-06-24 13:25:59 +02:00
|
|
|
|
2018-08-29 21:22:24 +02:00
|
|
|
" This callback will be executed when the entire command is completed
|
|
|
|
function! BackgroundCommandClose(channel)
|
|
|
|
" Read the output from the command into the quickfix window
|
|
|
|
unlet g:backgroundCommandOutput
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! RunBackgroundCommand(command)
|
|
|
|
" Make sure we're running VIM version 8 or higher.
|
|
|
|
if v:version < 800
|
|
|
|
echoerr 'RunBackgroundCommand requires VIM version 8 or higher'
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
if exists('g:backgroundCommandOutput')
|
|
|
|
echo 'Already running task in background'
|
|
|
|
else
|
|
|
|
echo 'Running task in background'
|
|
|
|
" Launch the job.
|
|
|
|
" Notice that we're only capturing out, and not err here. This is because, for some reason, the callback
|
|
|
|
" will not actually get hit if we write err out to the same file. Not sure if I'm doing this wrong or?
|
|
|
|
let g:backgroundCommandOutput = tempname()
|
|
|
|
call job_start(a:command, {'close_cb': 'BackgroundCommandClose', 'out_io': 'file', 'out_name': g:backgroundCommandOutput})
|
|
|
|
endif
|
|
|
|
endfunction
|
2018-06-24 13:25:59 +02:00
|
|
|
|
2018-08-29 21:22:24 +02:00
|
|
|
" So we can use :BackgroundCommand to call our function.
|
|
|
|
command! -nargs=+ -complete=shellcmd RunBackgroundCommand call RunBackgroundCommand(<q-args>)
|
2018-06-24 13:25:59 +02:00
|
|
|
|