re-structure, clean vimrc

This commit is contained in:
Thomas Ruoff
2016-11-24 14:37:25 +01:00
parent daaa0005af
commit 5458844549
2 changed files with 157 additions and 180 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
irssi irssi
vim/plugged/* vim/plugged/*
vim/undos/* vim/undos/*
vim/backup/
vim/spell vim/spell
.netrwhist .netrwhist
Xresources.compiled Xresources.compiled

336
vimrc
View File

@@ -1,6 +1,10 @@
set encoding=utf-8 " vim: set fenc=utf-8 nu et sts=4 sw=4 ft=vim fdm=marker fmr={{{,}}}:
" file: ~/.vimrc
" author: Thomas Ruoff (with the help of a myriad others)
scriptencoding utf-8 scriptencoding utf-8
" Plugins {{{
call plug#begin('~/.vim/plugged') call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible' Plug 'tpope/vim-sensible'
@@ -47,117 +51,41 @@ Plug 'junegunn/fzf.vim'
Plug 'sheerun/vim-polyglot' Plug 'sheerun/vim-polyglot'
call plug#end() call plug#end()
" }}}
"" enable local .vimrc " Basics {{{
set exrc " Enable use of directory-specific .vimrc set encoding=utf-8
set secure " Only run autocommands owned by me filetype plugin indent on " Load filetype plugin/indent files.
syntax on " Enable syntax highlighting.
"" Tabs. May be overriten by autocmd rules set synmaxcol=512 " Limit syntax highlighting to 512 characters per line
set tabstop=4 set modeline " Use file-specific settings, if available.
set softtabstop=0 "set autochdir " Always switch to current file directory.
set shiftwidth=4 set backup " Make backup files.
set expandtab set backupdir=~/.vim/backup " Backup directory.
set directory=~/.vim/tmp " Directory for swap files.
"" Enable hidden buffers set mouse=a " Mouse support everywhere.
set hidden set mousehide " Auto-hide cursor while typing.
set wildmode=list:longest,full " Make completion more like zsh.
"" Searching set wildmenu " Turn on command-line completion wild style.
set hlsearch set wildignore+=*.swp,*.bak,*.jpg,*.gif,*.png,*.git,
set smartcase set ignorecase " Ignore case, except...
set smartcase " ...when search string contains uppercase.
"" find set incsearch " Highlight as you type search phrase.
set path+=** " set hlserach
set number " Show line numbers.
"" Display all matching files when we tab complete set report=0 " Tell me when anything is changed via :...
set wildmenu set ruler " Show current positions along bottom.
set scrolloff=5 " Keep 5 lines (top/bottom) for scope.
"set wildignorecase set showcmd " Show command being typed.
set wildignore+=.git,.hg,.svn set showmatch " Show matching brackets.
set wildignore+=*.aux,*.out,*.toc set spell " Highlight misspelled words.
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class set spellcapcheck= " Don't highlight uncapitalized first word.
set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp set complete+=kspell " Use <C-n> and <C-p> to get suggested spelling completions.
set wildignore+=*.avi,*.m4a,*.mp3,*.oga,*.ogg,*.wav,*.webm set splitright " Split to the right when executing :vsplit.
set wildignore+=*.eot,*.otf,*.ttf,*.woff let g:netrw_liststyle=3 " Use tree style directory listing.
set wildignore+=*.doc,*.pdf
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz
set wildignore+=*.swp,.lock,.DS_Store,._*
"" saving
set fileformats=unix,dos,mac
set fileformat=unix
"" backups
" Use backup files when writing (create new file, replace old one with new
" one)
set writebackup
" but do not leave around backup.xyz~ files after that
set nobackup
" backupcopy=yes is the default, just be explicit. We need this for
" webpack-dev-server and hot module reloading -- preserves special file types
" like symlinks
set backupcopy=yes nobackup
" swap files
set noswapfile
" persistent undo
set undodir=~/.vim/undos
set undofile
set undolevels=1000
set undoreload=10000
"" session management
let g:session_directory = "~/.vim/session"
let g:session_autoload = "no"
let g:session_autosave = "no"
let g:session_command_aliases = 1
"" Mouse
set mouse=a
"" Use modeline overrides
set modeline
set modelines=10
"" Visual settings
syntax enable
set synmaxcol=512
set title
set cursorline
set number
if exists('+relativenumber')
set relativenumber
endif
set background=dark set background=dark
let base16colorspace=256 set path+=**
colorscheme base16-solarized-dark "set title
if has("gui_running")
"disable menu, toolsbar, scrollbar
set guioptions -=m
set guioptions -=T
set guioptions -=r
endif
" Display unprintable chars
set listchars=tab:▸\ ,extends:,precedes:,nbsp:␣,trail
set showbreak=
"" disable visual bell
set visualbell
set t_vb=
"" spelling
set spelllang=en,de
" Open all folds initially
set foldmethod=indent
set foldlevelstart=10
" Writes to the unnamed register also writes to the * and + registers. This " Writes to the unnamed register also writes to the * and + registers. This
" makes it easy to interact with the system clipboard " makes it easy to interact with the system clipboard
@@ -166,86 +94,127 @@ if has ('unnamedplus')
set clipboard^=unnamedplus set clipboard^=unnamedplus
endif endif
" diff " }}}
" local .vimrc {{{
set exrc " Enable use of directory-specific .vimrc
set secure " Only run autocommands owned by me
" }}}
" Text Formatting {{{
set list " Show real tabs (so they can be removed).
set listchars=tab:▸\ ,extends:,precedes:,nbsp:␣,trail:-
set linebreak " Don't soft-wrap in the middle of a word.
set showbreak=" Show `…' at the beginning of a soft-broken line.
set tabstop=8 " Real tabs are 8 columns long.
set expandtab " No real tabs (use spaces for tabs).
set softtabstop=2 " Set # of spaces when hitting tab/delete.
set shiftwidth=2 " Set # of softtabs when using cindent, <<, >>, ...
set textwidth=80 " Set max # of characters on each line.
set autoindent " Use indentation level of previous line.
set nojoinspaces " Don't add extra space after ., !, etc. when joining.
set formatoptions+=j " Delete comment character when joining commented lines.
" }}}
" Folding {{{
set foldmethod=indent
set foldlevelstart=3
" }}}
" diff settings {{{
set fillchars+=diff:⣿ set fillchars+=diff:⣿
set diffopt=vertical " Use in vertical diff mode set diffopt=vertical " Use in vertical diff mode
set diffopt+=filler " blank lines to keep sides aligned set diffopt+=filler " blank lines to keep sides aligned
set diffopt+=iwhite " Ignore whitespace changes set diffopt+=iwhite " Ignore whitespace changes
" }}}
" {{{ Undo
set undodir=~/.vim/undos
set undofile
set undolevels=1000
set undoreload=10000
" }}}
" " Visual Setting {{{
" KEY MAPPINGS set cursorline
" let base16colorspace=256
colorscheme base16-solarized-dark
"" MAP LEADER set number
noremap , \ if exists('+relativenumber')
let mapleader = "," set relativenumber
endif
" }}}
" GUI Settings {{{
if has("gui_running")
"disable menu, toolsbar, scrollbar
set guioptions -=m
set guioptions -=T
set guioptions -=r
endif
" }}}
" Key mappings {{{
let mapleader=','
let maplocalleader=','
set timeoutlen=400 set timeoutlen=400
"" fast saving
nmap <leader>w :update<cr>
"" fast escaping "" fast escaping
imap jj <ESC> inoremap jj <ESC>
"" fast editing
nnoremap <leader>e :e<space>
"" fast saving
nnoremap <leader>w :update<cr>
"" clear highlight "" clear highlight
nnoremap <leader><space> :noh<cr> nnoremap <leader><space> :noh<cr>
"" ignore lines when going up or down
nnoremap j gj
nnoremap k gk
"" open last buffer
nnoremap <BS> <C-^>
" Easier split navigation
" Use ctrl-[hjkl] to select the active split!
nmap <silent> <c-k> :wincmd k<CR>
nmap <silent> <c-j> :wincmd j<CR>
nmap <silent> <c-h> :wincmd h<CR>
nmap <silent> <c-l> :wincmd l<CR>
"" fast window switching "" fast window switching
map <leader>, <C-W>w noremap <leader>, <C-W>w
"" open next buffer "" open next,prev buffer, cycle
map <leader>. :bn<cr> noremap <leader>. :bn<cr>
noremap <leader>m :bp<cr>
"" cycle between buffers noremap <leader>: :b#<cr>
map <leader>: :b#<cr>
"" delete buffer "" delete buffer
map <leader>bd :bd<cr> noremap <leader>bd :bd<cr>
"" indent visual selected code without unselecting and going back to normal mode "" indent visual selected code without unselecting and going back to normal mode
vmap > >gv vnoremap > >gv
vmap < <gv vnoremap < <gv
"" Visually select the text that was last edited/pasted "" Visually select the text that was last edited/pasted
nmap gV `[v`] nnoremap gV `[v`]
"" pull word under cursor into lhs of a substitute (for quick search and replace) "" pull word under cursor into lhs of a substitute (for quick search and replace)
nmap <leader>r :%s#\<<C-r>=expand("<cword>")<CR>\># nmap <leader>r :%s#\<<C-r>=expand("<cword>")<CR>\>#
"" fast editing of the .vimrc "" fast editing of the .vimrc
nmap <silent> <leader>ev :e $MYVIMRC<cr> nnoremap <silent> <leader>ev :e $MYVIMRC<cr>
nmap <silent> <leader>sv :so $MYVIMRC<cr> nnoremap <silent> <leader>sv :so $MYVIMRC<cr>
"" allow saving when you forgot sudo "" allow saving when you forgot sudo
cmap w!! w !sudo tee % >/dev/null cnoremap w!! w !sudo tee % >/dev/null
"" turn on spell checking "" turn on spell checking
map <leader>spl :setlocal spell!<cr> noremap <leader>spl :setlocal spell!<cr>
"" spell checking shortcuts "" spell checking shortcuts
map <leader>sn ]s noremap <leader>sn ]s
map <leader>sp [s noremap <leader>sp [s
map <leader>sa zg noremap <leader>sa zg
map <leader>s? z= noremap <leader>s? z=
"" toggle states "" toggle states
nmap <silent> <leader>hh :set invhlsearch<CR> nnoremap <silent> <leader>hh :set invhlsearch<CR>
nmap <silent> <leader>ll :set invlist<CR> nnoremap <silent> <leader>ll :set invlist<CR>
nmap <silent> <leader>pp :set invpaste<CR> nnoremap <silent> <leader>pp :set invpaste<CR>
nmap <silent> <leader>nn :set invnumber<CR> nnoremap <silent> <leader>nn :set invnumber<CR>
nmap <silent> <leader>ii :set invrelativenumber<CR> nnoremap <silent> <leader>ii :set invrelativenumber<CR>
"" <Leader>0: Run the visually selected code in node and replace it with the output "" <Leader>0: Run the visually selected code in node and replace it with the output
vnoremap <silent> <Leader>0 :!node<cr> vnoremap <silent> <Leader>0 :!node<cr>
@@ -268,10 +237,9 @@ cnoreabbrev Q q
cnoreabbrev Qall qall cnoreabbrev Qall qall
iab xnow <c-r>=strftime("%Y-%m-%d %H:%M")<cr> iab xnow <c-r>=strftime("%Y-%m-%d %H:%M")<cr>
" }}}
" " Plugin Configuration {{{
" Plugin Configuration
"
"" gutentags "" gutentags
@@ -283,15 +251,15 @@ let g:gutentags_file_list_command = {
\ }, \ },
\ } \ }
"" fzf "" fzf
nmap <leader>b :Buffers<cr> nnoremap <leader>b :Buffers<cr>
nmap <leader>f :GFiles<cr> nnoremap <leader>f :GFiles<cr>
nmap <leader>F :Files<cr> nnoremap <leader>F :Files<cr>
vmap <leader>f y:Files <c-r>"<cr> vnoremap <leader>f y:Files <c-r>"<cr>
nmap <leader>a :Ag<space> nnoremap <leader>a :Ag<space>
vmap <leader>a y:Ag <c-r>"<cr> vnoremap <leader>a y:Ag <c-r>"<cr>
nmap <leader>A :Ag <c-r><c-w><cr> nnoremap <leader>A :Ag <c-r><c-w><cr>
nmap <leader>c :Commits<cr> nnoremap <leader>c :Commits<cr>
"" syntastic "" syntastic
let g:syntastic_always_populate_loc_list = 1 let g:syntastic_always_populate_loc_list = 1
@@ -327,19 +295,16 @@ if filereadable(expand("~/.vim/lightline.vim"))
source ~/.vim/lightline.vim source ~/.vim/lightline.vim
endif endif
"" NERDTree configuration
nmap <leader>n :NERDTreeToggle<CR>
"" Unimpaired "" Unimpaired
"" bubble single lines "" bubble single lines
nmap <leader>k [e nnoremap <leader>k [e
nmap <leader>j ]e nnoremap <leader>j ]e
"" bubble multiple lines "" bubble multiple lines
vmap <leader>k [egv vnoremap <leader>k [egv
vmap <leader>j ]egv vnoremap <leader>j ]egv
"" Indent Guides "" Indent Guides
nmap <leader>g :IndentGuidesToggle<CR> nnoremap <leader>g :IndentGuidesToggle<CR>
"" Ultisnips "" Ultisnips
let g:UltiSnipsExpandTrigger="<c-j>" let g:UltiSnipsExpandTrigger="<c-j>"
@@ -356,10 +321,9 @@ let g:markdown_fenced_languages = [
\ 'html', \ 'html',
\ 'javascript', 'js=javascript', 'json=javascript' \ 'javascript', 'js=javascript', 'json=javascript'
\ ] \ ]
" }}}
" " Autocmd Rules {{{
" Autocmd Rules
"
"" do syntax highlight syncing from start "" do syntax highlight syncing from start
autocmd BufEnter * :syntax sync fromstart autocmd BufEnter * :syntax sync fromstart
@@ -384,3 +348,15 @@ au BufRead,BufNewFile *.template set filetype=html.mustache syntax=mustache
"" always open help in vertical split "" always open help in vertical split
au FileType help wincmd L au FileType help wincmd L
" }}}
" probably not needed {{{
"" disable visual bell
"set visualbell
"set t_vb=
"" spelling
"set spelllang=en,de
"}}}