dotfiles/dot_vimrc

213 lines
8 KiB
Text
Raw Normal View History

2023-02-01 06:38:24 +01:00
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below. If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
"runtime! debian.vim
runtime! archlinux.vim
" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
" This happens after /etc/vim/vimrc(.local) are loaded, so it will override
" any settings in these files.
" If you don't want that to happen, uncomment the below line to prevent
" defaults.vim from being loaded.
" let g:skip_defaults_vim = 1
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
"colo desert
"colo delek
" Uncomment the following to have Vim jump to the last position when
" reopening a file
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
filetype plugin indent on
" autocmd BufReadPost *.odt :%!odt2txt %
" autocmd BufReadPost *.odt,*.ods,*.odd,*.doc,*.docx,*.ppt,*.pptx,*.csv :%!unoconv -f txt --stdout %
"autocmd BufReadPre *.doc,*.docx,*.rtf,*.odp,*.odt,*.ods silent set ro
autocmd BufReadPost *.doc,*.docx,*.rtf,*.odp,*.odt,*.ods silent %!pandoc "%" -tplain -o /dev/stdout
autocmd BufWritePost *.doc %:!pandoc -f markdown -t doc -o "%"
autocmd BufWritePost *.docx %:!pandoc -f markdown -t docx -o "%"
autocmd BufWritePost *.rtf %:!pandoc -f markdown -t rtf -o "%"
autocmd BufWritePost *.odp %:!pandoc -f markdown -t odp -o "%"
autocmd BufWritePost *.odt %:!pandoc -f markdown -t odt -o "%"
autocmd BufWritePost *.ods %:!pandoc -f markdown -t ods -o "%"
"autocmd BufReadPre *.xls silent set ro
autocmd BufReadPost *.xls silent set number
autocmd BufReadPost *.xls silent setlocal noexpandtab
autocmd BufReadPost *.xls silent setlocal shiftwidth=20
autocmd BufReadPost *.xls silent setlocal softtabstop=20
autocmd BufReadPost *.xls silent setlocal tabstop=20
autocmd BufReadPost *.xls silent %!xls2csv "%" | csv2tsv
autocmd BufWritePost *.xls silent %!tsv2csv -e > "%".csv
"autocmd BufReadPre *.csv silent set ro
autocmd BufReadPost *.csv silent set number
autocmd BufReadPost *.csv silent setlocal noexpandtab
autocmd BufReadPost *.csv silent setlocal shiftwidth=20
autocmd BufReadPost *.csv silent setlocal softtabstop=20
autocmd BufReadPost *.csv silent setlocal tabstop=20
autocmd BufReadPost *.csv silent %!csv2tsv -e < "%"
autocmd BufWritePost *.csv silent %!tsv2csv -e > "%"
"autocmd BufReadPre *.xls silent set ro
"autocmd BufReadPost *.xls silent setlocal nowrap
"autocmd BufReadPost *.xls silent %!xls2csv -c\| -b$'\n'$'\n' -q0 "%"
"autocmd BufReadPost *.xls silent %Tableize/|
"autocmd BufReadPost *.xls silent 1g/^/ TableModeRealign
"autocmd BufReadPost *.xls silent %g/\(^\n\)\@<=|/ TableModeRealign
" autocmd BufReadPost *.ods silent %!ods2txt "%"
autocmd BufReadPre *.pdf silent set ro
autocmd BufReadPost *.pdf silent %!pdftotext -nopgbrk -layout -q -eol unix "%" - | fmt -w78
autocmd BufReadPre *.jpg,*.jpeg silent set ro
autocmd BufReadPost *.jpg,*.jpeg silent %!jp2a --width=78 "%"
autocmd BufReadPre *.png,*.gif,*.bmp silent set ro
autocmd BufReadPost *.png,*.gif,*.bmp silent %!convert "%" jpg:- | jp2a --width=78 -
let g:zipPlugin_ext = '*.zip,*.jar,*.xpi,*.ja,*.war,*.ear,*.celzip,*.oxt,*.kmz,*.wsz,*.xap,*.docm,*.dotx,*.dotm,*.potx,*.potm,*.ppsx,*.ppsm,*.pptx,*.pptm,*.ppam,*.sldx,*.thmx,*.xlam,*.xlsx,*.xlsm,*.xlsb,*.xltx,*.xltm,*.xlam,*.crtx,*.vdw,*.glox,*.gcsx,*.gqsx'
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes)
set autoindent " Enable automatic einrueckungen
2023-05-25 15:00:39 +02:00
" more powerful backspacing
set backspace=indent,eol,start
2023-02-01 06:38:24 +01:00
" show the editing mode on the last line
set showmode
" tell vim to keep a backup file
set backup
" tell vim where to put its backup files
set backupdir=/tmp
" tell vim where to put swap files
set dir=/tmp
" use the system clipboard
set clipboard=unnamedplus
" wayland support
nnoremap <C-@> :call system("wl-copy", @")<CR>
xnoremap <silent> <C-Q> :w !wl-copy<CR><CR>
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
cmap runpy!! w !clear; python %
nmap <special> <F8> :TagbarToggle<CR>
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#formatter = 'default'
let g:airline_statusline_ontop=1
let g:translate_source = "en"
let g:translate_target = "de"
let g:translate_winsize = 10
xmap <special> <Space>tr <Plug>(VTranslate)
xmap <special> <Space>tt <Plug>(VTranslateBang)
nnoremap <silent> ,<space> :nohlsearch<CR>
set nocompatible " be iMproved, required
filetype off " required
2023-02-01 07:11:31 +01:00
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
2023-02-01 06:38:24 +01:00
2023-02-01 07:17:03 +01:00
call plug#begin()
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" - Vim (Windows): '~/vimfiles/plugged'
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-default branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'
" Initialize plugin system
" - Automatically executes `filetype plugin indent on` and `syntax enable`.
call plug#end()
" You can revert the settings after the call like so:
" filetype indent off " Disable file-type-specific indentation
" syntax off " Disable syntax highlighting
2023-02-01 06:38:24 +01:00
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif