myhome/.vimrc-def
2021-03-22 21:25:52 +01:00

89 lines
1.7 KiB
Plaintext

" settings
if ! filereadable(system('echo -n "$HOME/.vim/autoload/plug.vim"'))
silent !mkdir -p $HOME/.vim/autoload/
silent !curl --silent "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > $HOME/.vim/autoload/plug.vim
autocmd VimEnter * PlugInstall
endif
set laststatus=2
set shiftwidth=4
set softtabstop=4
set tabstop=4
au BufWritePre * let &bex = '@' . strftime("%F.%H:%M")
" plugins
call plug#begin('~/.vim/plugged')
Plug 'preservim/nerdtree', "{ 'on': 'NERDTreeToggle' }
call plug#end()
" Status-line
set statusline=
set statusline+=%#IncSearch#
set statusline+=\ %y
set statusline+=\ %r
set statusline+=%#CursorLineNr#
set statusline+=\ %F
set statusline+=%= "Right side settings
set statusline+=%#Search#
set statusline+=\ %l/%L
set statusline+=\ [%c]
set nocompatible
set hlsearch
set incsearch
set noshowmode
set cmdheight=1
syntax on
filetype plugin indent on
set encoding=utf-8
" line numbers
set number
set ruler
set title
" indent
set backspace=indent,eol,start
set shiftwidth=4
set expandtab
" editing
runtime! macros/matchit.vim
" visual feedback
set laststatus=2
set showmode
set showcmd
" off mouse
set mouse-=a
" disable pcspkr beep
set visualbell
set t_vb=
" searching
set smartcase
set ic
" cursor
let &t_SI = "\<esc>[6 q"
let &t_EI = "\<esc>[2 q"
" colors
set bg=dark
" map
nnoremap S :%s//g<Left><Left>
map <C-n> :NERDTreeToggle<CR>
nnoremap <silent> <C-t> :tabnew <CR>
nnoremap <F7> :tabprevious<CR>
nnoremap <F8> :tabnext<CR>
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
" Automatically deletes all trailing whitespace and newlines at end of file on save.
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritepre * %s/\n\+\%$//e