Tuned .vimrc

This commit is contained in:
Christian Baer 2020-01-05 23:04:27 +01:00
parent d97b9014b5
commit 65ab6657ae

85
.vimrc
View File

@ -1,54 +1,48 @@
set nocompatible set nocompatible " Vim defaults rather than vi ones. Keep at top.
filetype plugin indent on " Enable filetype-specific settings.
syntax on " Enable syntax highlighting.
set backspace=2 " Make the backspace behave as most applications.
set autoindent " Use current indent for new lines.
set display=lastline " Show as much of the line as will fit.
set wildmenu " Better tab completion in the commandline.
set wildmode=list:longest " List all matches and complete to the longest match.
set showcmd " Show (partial) command in bottom-right.
set expandtab " Use spaces instead of tabs for indentation.
set smarttab " Backspace removes 'shiftwidth' worth of spaces.
set number " Show line numbers.
set nowrap " Don't wrap long lines.
set laststatus=2 " Always show the statusline.
set ruler " Show the ruler in the statusline.
set textwidth=80 " Wrap at n characters.
set incsearch " Jump to search match while typing.
set hlsearch " Highlight the last used search pattern.
set nrformats-=octal " Remove octal support from 'nrformats'.
set tabstop=2 " Size of a Tab character.
set shiftwidth=0 " Use same value as 'tabstop'.
set softtabstop=-1 " Use same value as 'shiftwidth'.
set encoding=utf-8 " Set encoding
color smyck " Colorscheme see https://github.com/hukl/Smyck-Color-Scheme
set list listchars=tab:»·,trail:·" Show trailing spaces and highlight hard tabs
" Enable syntax highlighting " Go to the last cursor location when opening a file.
syntax on augroup jump
filetype plugin indent on autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\| exe 'normal! g`"'
\| endif
augroup end
" Colorscheme see https://github.com/hukl/Smyck-Color-Scheme " Clean trailing whitespace.
color smyck fun! s:trim_whitespace()
let l:save = winsaveview()
" Add line numbers keeppatterns %s/\s\+$//e
set number call winrestview(l:save)
set ruler
" Set encoding
set encoding=utf-8
" Whitespace stuff
set nowrap
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" Show trailing spaces and highlight hard tabs
set list listchars=tab:»·,trail
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Strip trailing whitespaces on each save
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun endfun
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces() command! TrimWhitespace call s:trim_whitespace()
" Search related settings
set incsearch
set hlsearch
" Map Ctrl+l to clear highlighted searches
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
" Highlight characters behind the 80 chars margin " Highlight characters behind the 80 chars margin
:au BufWinEnter * let w:m2=matchadd('ColumnMargin', '\%>80v.\+', -1) :au BufWinEnter * let w:m2=matchadd('ColumnMargin', '\%>80v.\+', -1)
" Disable code folding
set nofoldenable
" Directories for swp files " Directories for swp files
set backupdir=~/.vim/backups set backupdir=~/.vim/backups
set directory=~/.vim/backups set directory=~/.vim/backups
@ -61,6 +55,3 @@ au BufNewFile,BufRead *.json set ft=javascript
" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ ) " make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79 au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
" allow backspacing over everything in insert mode
set backspace=indent,eol,start