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
" 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.
" All system-wide defaults are set in $VIMRUNTIME/archlinux.vim (usually just
" /usr/share/vim/vimfiles/archlinux.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/vimrc), since archlinux.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" 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
" properly set to work with the Vim-related packages available in Debian.
"runtime! debian.vim
" properly set to work with the Vim-related packages.
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
" If you prefer the old-style vim functionalty, add 'runtime! vimrc_example.vim'
" Or better yet, read /usr/share/vim/vim80/vimrc_example.vim or the vim manual
" and configure vim to your own liking!
" 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
" do not load defaults if ~/.vimrc is missing
"let skip_defaults_vim=1
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
" Disable compatibility with vi which can cause unexpected issues.
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
" 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
" Add numbers to each line on the left-hand side.
set number
" 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
" Highlight cursor line underneath the cursor horizontally.
"set cursorline
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
filetype plugin indent on
" Highlight cursor line underneath the cursor vertically.
"set cursorcolumn
" 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
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 "%"
" Use space characters instead of tabs.
set expandtab
"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
" Do not save backup files.
set nobackup
"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 > "%"
" Do not let cursor scroll below or above N number of lines when scrolling.
set scrolloff=10
"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
" Do not wrap lines. Allow long lines to extend as far as the line goes.
set nowrap
" 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
autocmd BufReadPost *.pdf silent %!pdftotext -nopgbrk -layout -q -eol unix "%" - | fmt -w78
" Ignore capital letters during search.
set ignorecase
autocmd BufReadPre *.jpg,*.jpeg silent set ro
autocmd BufReadPost *.jpg,*.jpeg silent %!jp2a --width=78 "%"
" Override the ignorecase option if searching for capital letters.
" This will allow you to search specifically for capital letters.
set smartcase
autocmd BufReadPre *.png,*.gif,*.bmp silent set ro
autocmd BufReadPost *.png,*.gif,*.bmp silent %!convert "%" jpg:- | jp2a --width=78 -
" Show partial command you type in the last line of the screen.
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'
" 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
" Show the mode you are on the last line.
set showmode
" tell vim to keep a backup file
set backup
" Show matching words during a search.
set showmatch
" tell vim where to put its backup files
set backupdir=/tmp
" Use highlighting when doing a search.
set hlsearch
" tell vim where to put swap files
set dir=/tmp
" Set the commands to save in history default number is 20.
set history=1000
" use the system clipboard
set clipboard=unnamedplus
" Enable auto completion menu after pressing TAB.
set wildmenu
" wayland support
nnoremap <C-@> :call system("wl-copy", @")<CR>
xnoremap <silent> <C-Q> :w !wl-copy<CR><CR>
" Make wildmenu behave like similar to Bash completion.
set wildmode=list:longest
" 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
" There are certain files that we would never want to edit with Vim.
" Wildmenu will ignore files with these extensions.
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.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
endif
" https://vimawesome.com/
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()
" 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