add new vimrc config

This commit is contained in:
Simon Rieger 2023-05-25 15:28:22 +02:00
parent ab727114ef
commit cc82a0c9fa

243
dot_vimrc
View file

@ -1,157 +1,98 @@
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by " All system-wide defaults are set in $VIMRUNTIME/archlinux.vim (usually just
" the call to :runtime you can find below. If you wish to change any of those " /usr/share/vim/vimfiles/archlinux.vim) and sourced by the call to :runtime
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim " you can find below. If you wish to change any of those settings, you should
" will be overwritten everytime an upgrade of the vim packages is performed. " do it in this file (/etc/vimrc), since archlinux.vim will be overwritten
" It is recommended to make changes after sourcing debian.vim since it alters " everytime an upgrade of the vim packages is performed. It is recommended to
" the value of the 'compatible' option. " make changes after sourcing archlinux.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are " 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. " properly set to work with the Vim-related packages.
"runtime! debian.vim
runtime! archlinux.vim runtime! archlinux.vim
" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc. " If you prefer the old-style vim functionalty, add 'runtime! vimrc_example.vim'
" This happens after /etc/vim/vimrc(.local) are loaded, so it will override " Or better yet, read /usr/share/vim/vim80/vimrc_example.vim or the vim manual
" any settings in these files. " and configure vim to your own liking!
" 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 " do not load defaults if ~/.vimrc is missing
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous "let skip_defaults_vim=1
" options, so any other options should be set AFTER setting 'compatible'.
set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next " Disable compatibility with vi which can cause unexpected issues.
" line enables syntax highlighting by default. set nocompatible
" Enable type file detection. Vim will be able to try to detect the type of file in use.
filetype on
" Enable plugins and load plugin for the detected file type.
filetype plugin on
" Load an indent file for the detected file type.
filetype indent on
" Turn syntax highlighting on.
syntax on syntax on
" If using a dark background within the editing area and syntax highlighting " Add numbers to each line on the left-hand side.
" turn on this option as well set number
set background=dark
"colo desert
"colo delek
" Uncomment the following to have Vim jump to the last position when " Highlight cursor line underneath the cursor horizontally.
" reopening a file "set cursorline
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" Uncomment the following to have Vim load indentation rules and plugins " Highlight cursor line underneath the cursor vertically.
" according to the detected filetype. "set cursorcolumn
filetype plugin indent on
" autocmd BufReadPost *.odt :%!odt2txt % " Set shift width to 4 spaces.
set shiftwidth=4
" autocmd BufReadPost *.odt,*.ods,*.odd,*.doc,*.docx,*.ppt,*.pptx,*.csv :%!unoconv -f txt --stdout % " Set tab width to 4 columns.
set tabstop=4
"autocmd BufReadPre *.doc,*.docx,*.rtf,*.odp,*.odt,*.ods silent set ro " Use space characters instead of tabs.
autocmd BufReadPost *.doc,*.docx,*.rtf,*.odp,*.odt,*.ods silent %!pandoc "%" -tplain -o /dev/stdout set expandtab
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 " Do not save backup files.
autocmd BufReadPost *.xls silent set number set nobackup
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 " Do not let cursor scroll below or above N number of lines when scrolling.
autocmd BufReadPost *.csv silent set number set scrolloff=10
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 " Do not wrap lines. Allow long lines to extend as far as the line goes.
"autocmd BufReadPost *.xls silent setlocal nowrap set 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 "%" " While searching though a file incrementally highlight matching characters as you type.
set incsearch
autocmd BufReadPre *.pdf silent set ro " Ignore capital letters during search.
autocmd BufReadPost *.pdf silent %!pdftotext -nopgbrk -layout -q -eol unix "%" - | fmt -w78 set ignorecase
autocmd BufReadPre *.jpg,*.jpeg silent set ro " Override the ignorecase option if searching for capital letters.
autocmd BufReadPost *.jpg,*.jpeg silent %!jp2a --width=78 "%" " This will allow you to search specifically for capital letters.
set smartcase
autocmd BufReadPre *.png,*.gif,*.bmp silent set ro " Show partial command you type in the last line of the screen.
autocmd BufReadPost *.png,*.gif,*.bmp silent %!convert "%" jpg:- | jp2a --width=78 - set showcmd
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' " Show the mode you are on the last line.
" 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
" more powerful backspacing
set backspace=indent,eol,start
" show the editing mode on the last line
set showmode set showmode
" tell vim to keep a backup file " Show matching words during a search.
set backup set showmatch
" tell vim where to put its backup files " Use highlighting when doing a search.
set backupdir=/tmp set hlsearch
" tell vim where to put swap files " Set the commands to save in history default number is 20.
set dir=/tmp set history=1000
" use the system clipboard " Enable auto completion menu after pressing TAB.
set clipboard=unnamedplus set wildmenu
" wayland support " Make wildmenu behave like similar to Bash completion.
nnoremap <C-@> :call system("wl-copy", @")<CR> set wildmode=list:longest
xnoremap <silent> <C-Q> :w !wl-copy<CR><CR>
" Allow saving of files as sudo when I forgot to start vim using sudo. " There are certain files that we would never want to edit with Vim.
cmap w!! w !sudo tee > /dev/null % " Wildmenu will ignore files with these extensions.
cmap runpy!! w !clear; python % set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
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
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim')) if empty(glob(data_dir . '/autoload/plug.vim'))
@ -159,54 +100,10 @@ if empty(glob(data_dir . '/autoload/plug.vim'))
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif endif
" https://vimawesome.com/
call plug#begin() 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 Plug 'scrooloose/nerdtree'
" 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() 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
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif