Compare commits

..

1 Commits

71
.vimrc
View File

@ -6,7 +6,7 @@
"set nocompatible " use vim defaults
syntax on " use syntax highlighting
set background=dark " when using black background terminal
colorscheme ron " for bash in windows this fixes my colors in vim inside tmux
" colorscheme ron " for bash in windows this fixes my colors in vim inside tmux
set nomodeline " workaround to close a vuln
@ -63,14 +63,8 @@ filetype on
let mapleader=" "
let g:mapleader=" "
" settings for vim 7
if version >= 700
set spellfile=~/.vimspell.de.add,~/.vimspell.en.add
" setlocal spell spelllang=de " enable spell checker
endif
hi LineTooLong cterm=bold ctermbg=red guibg=LightYellow
match LineTooLong /\%>80v.\+/
match LineTooLong /\%>160v.\+/
"useful mappings for managing tabs
map <leader>tn :tabnew<cr>
@ -91,12 +85,7 @@ endfun
" grep will sometimes skip displaying the file name
set grepprg=grep\ -nH\ $*
" Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
"let g:Tex_Folding=0 "I don't like folding.
let g:Tex_Folding=0 "I don't like folding.
set iskeyword+=:
" Press Space to turn off highlighting and clear any message already displayed.
@ -113,9 +102,6 @@ function! Incr()
endfunction
vnoremap <C-a> :call Incr()<CR>
" Prss CTRL + _ (CTRL + SHIFT + -) to close a html tag
if filereadable(glob('~/.vim/scripts/closetag.vim')) | source ~/.vim/scripts/closetag.vim | endif
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$\| \+\ze\t/
@ -125,23 +111,11 @@ nnoremap <F2> :<C-U>%retab!<CR>:set list<CR>:%s/^\(\t\+\) */\1/<CR>
nnoremap <F5> "=strftime("%c")<CR>P
inoremap <F5> <C-R>=strftime("%c")<CR>
" a few autocommands for when silly people send stupid file formats
" Read-only .doc through antiword
autocmd BufReadPre *.doc silent set ro
autocmd BufReadPost *.doc silent %!antiword "%"
" Read-only odt/odp through odt2txt
autocmd BufReadPre *.odt,*.odp silent set ro
autocmd BufReadPost *.odt,*.odp silent %!odt2txt "%"
" Read-only pdf through pdftotext
autocmd BufReadPre *.pdf silent set ro
autocmd BufReadPost *.pdf silent %!pdftotext -nopgbrk -layout -q -eol unix "%" -
"| fmt -w250
" Read-only rtf through unrtf
autocmd BufReadPre *.rtf silent set ro
autocmd BufReadPost *.rtf silent %!unrtf --text
" YAML and Ansible and so on
augroup ansible_vim_fthosts
autocmd!
autocmd BufNewFile,BufRead hosts setfiletype yaml.ansible
augroup END
" as long as vim isn't in diff-mode check the code at opening and closing
" also: special vimdiff-settings
@ -157,6 +131,14 @@ if ! &diff
nnoremap <leader>l <C-L>
endif
" NerdTree Settings
nnoremap <leader>n :NERDTreeToggle<CR>
nnoremap <leader>nf :NERDTreeFocus<CR>
nnoremap <leader>nc :NERDTreeClose<CR>
" block-editing workaround for a windows-terminal-wsl situation
nnoremap <Leader>v <c-v>
"tweaking my statusline
function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
@ -184,3 +166,24 @@ set statusline+=\ %p%%
set statusline+=\ %l:%c
set statusline+=\
call plug#begin('~/.vim/plugged')
" --- Your Plugin List Goes Here ---
" Example:
Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree'
Plug 'pearofducks/ansible-vim'
" Automatically install plugins if they are not installed
" Call plug#config_commit() is the modern way to replace auto_install, save_state, etc.
" call plug#config_commit()
" Optional: For automatic plugin updates on startup if you want
" autocmd VimEnter *
" \ PlugUpgrade |
" \ execute PlugInstall |
" \ PlugClean
" Initialize plugin system, then load plugins
call plug#end()