2018-11-22 18:23:20 +01:00
|
|
|
|
" set vim mode
|
2017-03-06 10:36:51 +01:00
|
|
|
|
set nocompatible
|
|
|
|
|
|
|
|
|
|
source ~/.vim/plugins.vim
|
|
|
|
|
|
2017-04-12 15:54:04 +02:00
|
|
|
|
filetype plugin indent on
|
|
|
|
|
|
2017-03-06 10:36:51 +01:00
|
|
|
|
if has("vms")
|
|
|
|
|
set nobackup
|
|
|
|
|
else
|
|
|
|
|
" set backup
|
|
|
|
|
if has('persistent_undo')
|
|
|
|
|
set undofile
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
syntax enable
|
|
|
|
|
" set transparent background
|
|
|
|
|
" let g:solarized_termtrans=1
|
|
|
|
|
" use italics
|
|
|
|
|
let g:solarized_term_italics=1
|
|
|
|
|
" filetype-specific syntax highlighting groups
|
|
|
|
|
let g:solarized_extra_hi_groups=1
|
|
|
|
|
" let g:solarized_contrast="high"
|
|
|
|
|
" let g:solarized_visibility="high"
|
|
|
|
|
set background=dark
|
|
|
|
|
colorscheme solarized8
|
|
|
|
|
" underline spelling
|
|
|
|
|
highlight clear SpellBad
|
|
|
|
|
highlight SpellBad cterm=undercurl
|
2018-08-13 11:53:05 +02:00
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" true color
|
|
|
|
|
set termguicolors
|
|
|
|
|
" make true colors work in tmux
|
|
|
|
|
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
|
|
|
|
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" make comments and HTML attributes italic
|
|
|
|
|
"highlight Comment cterm=italic
|
|
|
|
|
"highlight htmlArg cterm=italic
|
|
|
|
|
|
|
|
|
|
"highlight Normal ctermbg=NONE guibg=NONE
|
|
|
|
|
"highlight NonText ctermbg=NONE guibg=NONE
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
" files and backups
|
|
|
|
|
set directory=$HOME/.vim/swapfiles//
|
|
|
|
|
" set backupdir=$HOME/.vim/backupdir//
|
|
|
|
|
set undodir=$HOME/.vim/undofiles//
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" yank into system clipboard
|
|
|
|
|
set clipboard=unnamedplus
|
2018-08-13 11:53:05 +02:00
|
|
|
|
|
2017-03-06 10:36:51 +01:00
|
|
|
|
" Only do this part when compiled with support for autocommands.
|
|
|
|
|
if has("autocmd")
|
|
|
|
|
" Put these in an autocmd group, so that we can delete them easily.
|
|
|
|
|
augroup vimrcEx
|
|
|
|
|
au!
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
autocmd FileType text setlocal foldtext<
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
augroup END
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" remember cursor position
|
2017-03-06 10:36:51 +01:00
|
|
|
|
autocmd BufReadPost *
|
|
|
|
|
\ if line("'\"") > 1 && line("'\"") <= line("$") |
|
|
|
|
|
\ exe "normal! g`\"" |
|
|
|
|
|
\ endif
|
|
|
|
|
|
|
|
|
|
endif " has("autocmd")
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
if !has('nvim')
|
|
|
|
|
" Get the defaults that most users want.
|
|
|
|
|
source $VIMRUNTIME/defaults.vim
|
|
|
|
|
" The matchit plugin makes the % command work better
|
|
|
|
|
packadd matchit
|
2017-03-06 10:36:51 +01:00
|
|
|
|
endif
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" always set autoindenting on
|
|
|
|
|
set autoindent
|
|
|
|
|
" smart indent; stop indent when closing brackets etc
|
|
|
|
|
set smartindent
|
2019-04-28 18:59:35 +02:00
|
|
|
|
" two spaces after .?! when joining lines
|
|
|
|
|
set joinspaces
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
" searching
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" highlight search result
|
|
|
|
|
set hlsearch
|
|
|
|
|
" ignore case
|
|
|
|
|
set ignorecase
|
|
|
|
|
" case-sensitive if expression contains capital letters
|
|
|
|
|
set smartcase
|
|
|
|
|
" incremental search
|
|
|
|
|
set incsearch
|
2017-03-06 10:36:51 +01:00
|
|
|
|
set nolazyredraw
|
|
|
|
|
|
|
|
|
|
" delete whitespace, line break and char using <BS>
|
|
|
|
|
set backspace=indent,eol,start
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" always show curser position
|
|
|
|
|
set ruler
|
|
|
|
|
" keep 1000 lines of history
|
|
|
|
|
set history=1000
|
2017-04-15 14:41:41 +02:00
|
|
|
|
set textwidth=120
|
|
|
|
|
set colorcolumn=+1
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" display absolute number of current line
|
|
|
|
|
set number
|
|
|
|
|
" display relative line numbers
|
|
|
|
|
set relativenumber
|
|
|
|
|
" highlight current line
|
|
|
|
|
set cursorline
|
2017-03-06 10:36:51 +01:00
|
|
|
|
" encoding
|
2018-11-22 18:23:20 +01:00
|
|
|
|
set fileencoding=utf-8
|
2017-03-06 10:36:51 +01:00
|
|
|
|
" break at last word instead of last char
|
|
|
|
|
set linebreak
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" autoload file changes
|
|
|
|
|
set autoread
|
2017-04-12 14:51:01 +02:00
|
|
|
|
|
2017-03-06 10:36:51 +01:00
|
|
|
|
" tab control
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" insert spaces
|
|
|
|
|
set expandtab
|
2017-03-06 10:36:51 +01:00
|
|
|
|
set smarttab
|
|
|
|
|
set tabstop=4
|
|
|
|
|
set softtabstop=4
|
|
|
|
|
set shiftwidth=4
|
|
|
|
|
set shiftround
|
2018-11-22 18:23:20 +01:00
|
|
|
|
"set completeopt+=longest
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
" invisible characters
|
|
|
|
|
set list
|
|
|
|
|
set listchars=tab:→\ ,eol:¬,trail:⋅,extends:❯,precedes:❮
|
|
|
|
|
set showbreak=↪
|
|
|
|
|
|
|
|
|
|
" code folding settings
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" fold based on syntax
|
|
|
|
|
set foldmethod=indent
|
|
|
|
|
" don't fold by default
|
|
|
|
|
set nofoldenable
|
2017-03-06 10:36:51 +01:00
|
|
|
|
set foldlevel=1
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" smoother redrawing
|
|
|
|
|
set ttyfast
|
|
|
|
|
" diff with vertical split
|
2017-03-06 10:36:51 +01:00
|
|
|
|
set diffopt+=vertical
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" show the status line all the time
|
|
|
|
|
set laststatus=2
|
|
|
|
|
" keep 5 lines on the screen when scrolling
|
|
|
|
|
set scrolloff=5
|
|
|
|
|
" enhanced command line completion
|
|
|
|
|
set wildmenu
|
2017-03-06 10:36:51 +01:00
|
|
|
|
" Search down into subfolders
|
|
|
|
|
" Provides tab-completion for all file-related tasks
|
|
|
|
|
set path+=**
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" allow switching away from unsaved buffers
|
|
|
|
|
set hidden
|
|
|
|
|
" show incomplete commands
|
|
|
|
|
set showcmd
|
|
|
|
|
"set noshowmode " don't show which mode disabled for PowerLine
|
|
|
|
|
" complete files like a shell
|
|
|
|
|
set wildmode=list:longest
|
2017-03-06 10:36:51 +01:00
|
|
|
|
set shell=$SHELL
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" command bar height
|
|
|
|
|
set cmdheight=1
|
|
|
|
|
" set terminal title
|
|
|
|
|
set title
|
|
|
|
|
set shortmess+=TOFwat
|
|
|
|
|
|
|
|
|
|
" show matching braces
|
|
|
|
|
set showmatch
|
|
|
|
|
" how many tenths of a second to blink
|
|
|
|
|
set mat=2
|
|
|
|
|
" set spell langs
|
|
|
|
|
set spelllang=de,en
|
|
|
|
|
|
|
|
|
|
"" user commands
|
|
|
|
|
|
|
|
|
|
"" create tags file
|
|
|
|
|
"" ^] jump to tag under cursor
|
|
|
|
|
"" g^] for ambiguous tags
|
|
|
|
|
"" ^t jump back in the tag stack
|
|
|
|
|
"command! MakeTags !ctags -R .
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
" error bells
|
2018-11-22 18:23:20 +01:00
|
|
|
|
set errorbells
|
2017-03-06 10:36:51 +01:00
|
|
|
|
set visualbell
|
2018-11-22 18:23:20 +01:00
|
|
|
|
set timeoutlen=500
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" turn on manpages (:Man)
|
|
|
|
|
runtime ftplugin/man.vim
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
" set a map leader for more key combos
|
2018-11-22 18:23:20 +01:00
|
|
|
|
let mapleader=','
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
" clear highlighted search
|
|
|
|
|
noremap <space> :nohlsearch<cr>
|
|
|
|
|
|
|
|
|
|
" enable . command in visual mode
|
|
|
|
|
vnoremap . :normal .<cr>
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" move between windows using CTRL+hjll
|
2017-03-06 10:36:51 +01:00
|
|
|
|
map <silent> <C-h> :call functions#WinMove('h')<cr>
|
|
|
|
|
map <silent> <C-j> :call functions#WinMove('j')<cr>
|
|
|
|
|
map <silent> <C-k> :call functions#WinMove('k')<cr>
|
|
|
|
|
map <silent> <C-l> :call functions#WinMove('l')<cr>
|
|
|
|
|
|
|
|
|
|
" count wraped lines as one line when doing relative jumps
|
|
|
|
|
noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
|
|
|
|
|
noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
|
|
|
|
|
|
|
|
|
|
" scroll the viewport faster
|
|
|
|
|
nnoremap <C-e> 3<C-e>
|
|
|
|
|
nnoremap <C-y> 3<C-y>
|
2018-11-22 18:23:20 +01:00
|
|
|
|
"
|
|
|
|
|
"" moving up and down work as you would expect
|
|
|
|
|
"nnoremap j gj
|
|
|
|
|
"nnoremap k gk
|
|
|
|
|
"nnoremap ^ g^
|
|
|
|
|
"nnoremap $ g$
|
|
|
|
|
|
|
|
|
|
"" cool resizing
|
|
|
|
|
"nnoremap <Left> :vertical resize +2<CR>
|
|
|
|
|
"nnoremap <Right> :vertical resize -2<CR>
|
|
|
|
|
"nnoremap <Up> :resize -2<CR>
|
|
|
|
|
"nnoremap <Down> :resize +2<CR><Paste>
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
" search for word under the cursor
|
|
|
|
|
nnoremap <leader>/ "fyiw :/<c-r>f<cr>
|
|
|
|
|
|
|
|
|
|
" highlight conflicts
|
|
|
|
|
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
|
|
|
|
|
|
|
|
|
|
" make the highlighting of tabs and other non-text less annoying
|
|
|
|
|
highlight SpecialKey ctermbg=none ctermfg=8
|
|
|
|
|
highlight NonText ctermbg=none ctermfg=8
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
"" Section AutoGroups {{{
|
|
|
|
|
"" file type specific settings
|
2017-03-06 10:36:51 +01:00
|
|
|
|
augroup configgroup
|
|
|
|
|
autocmd!
|
|
|
|
|
|
|
|
|
|
" automatically resize panes on resize
|
|
|
|
|
autocmd VimResized * exe 'normal! \<c-w>='
|
|
|
|
|
autocmd BufWritePost .vimrc,.vimrc.local,init.vim source %
|
|
|
|
|
autocmd BufWritePost .vimrc.local source %
|
|
|
|
|
" save all files on focus lost, ignoring warnings about untitled buffers
|
|
|
|
|
autocmd FocusLost * silent! wa
|
|
|
|
|
|
|
|
|
|
" make quickfix windows take all the lower section of the screen
|
|
|
|
|
" when there are multiple windows open
|
|
|
|
|
autocmd FileType qf wincmd J
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" autocmd BufNewFile,BufReadPost *.md set filetype=markdown
|
|
|
|
|
" let g:markdown_fenced_languages = ['css', 'javascript', 'js=javascript', 'json=javascript', 'stylus', 'html']
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" " autocmd! BufEnter * call functions#ApplyLocalSettings(expand('<afile>:p:h'))
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" autocmd BufNewFile,BufRead,BufWrite *.md syntax match Comment /\%^---\_.\{-}---$/
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
autocmd! BufWritePost * Neomake
|
|
|
|
|
augroup END
|
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
" paste without indention
|
|
|
|
|
function! WrapForTmux(s)
|
|
|
|
|
if !exists('$TMUX')
|
|
|
|
|
return a:s
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
let tmux_start = "\<Esc>Ptmux;"
|
|
|
|
|
let tmux_end = "\<Esc>\\"
|
|
|
|
|
|
|
|
|
|
return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
|
|
|
|
|
endfunction
|
|
|
|
|
|
2018-11-22 18:23:20 +01:00
|
|
|
|
"let &t_SI .= WrapForTmux("\<Esc>[?2004h")
|
|
|
|
|
"let &t_EI .= WrapForTmux("\<Esc>[?2004l")
|
2017-03-06 10:36:51 +01:00
|
|
|
|
|
|
|
|
|
function! XTermPasteBegin()
|
|
|
|
|
set pastetoggle=<Esc>[201~
|
|
|
|
|
set paste
|
|
|
|
|
return ""
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
|
|
|
|
|
|
|
|
|
|
" ctrlp
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" order top to bottom
|
|
|
|
|
let g:ctrlp_match_window='bottom,order::ttb'
|
|
|
|
|
" open files in new buffer
|
|
|
|
|
let g:ctrlp_switch_buffer=0
|
|
|
|
|
" use ripgrep if available
|
|
|
|
|
if executable('rg')
|
|
|
|
|
set grepprg=rg\ --color=never
|
2019-04-28 21:30:55 +02:00
|
|
|
|
let g:ctrlp_user_command='rg %s --files -i --color=never --glob ""'
|
2018-11-22 18:23:20 +01:00
|
|
|
|
let g:ctrlp_use_caching=0
|
|
|
|
|
endif
|
|
|
|
|
" use ag if available
|
|
|
|
|
if executable('ag')
|
|
|
|
|
set grepprg=ag\ --nogroup\ --nocolor
|
|
|
|
|
let g:ctrlp_user_command='ag %s -l --nocolor -g ""'
|
|
|
|
|
let g:ctrlp_use_caching=0
|
2017-03-06 10:36:51 +01:00
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
" Append modeline after last line in buffer.
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX files.
|
2017-03-06 10:36:51 +01:00
|
|
|
|
function! AppendModeline()
|
2018-11-22 18:23:20 +01:00
|
|
|
|
let l:modeline = printf(" vim: set filetype=%s ts=%d sw=%d tw=%d %set :",
|
|
|
|
|
\ &filetype, &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no')
|
|
|
|
|
let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
|
|
|
|
|
call append(line("$"), l:modeline)
|
2017-03-06 10:36:51 +01:00
|
|
|
|
endfunction
|
|
|
|
|
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
|
|
|
|
|
|
|
|
|
|
" set textwidth for mails
|
|
|
|
|
autocmd FileType mail setlocal textwidth=72
|
|
|
|
|
|
|
|
|
|
" netrw settings
|
2018-11-22 18:23:20 +01:00
|
|
|
|
" disable banner
|
|
|
|
|
let g:netrw_banner=0
|
|
|
|
|
" open in prior window
|
|
|
|
|
let g:netrw_browse_split=4
|
|
|
|
|
" open splits to the right
|
|
|
|
|
let g:netrw_altv=1
|
|
|
|
|
" treeview
|
|
|
|
|
let g:netrw_liststyle=3
|
|
|
|
|
let g:netrw_list_hide=netrw_gitignore#Hide()
|
|
|
|
|
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
|
|
|
|
|
|
|
|
|
|
"" racer config (rust autocomplete)
|
|
|
|
|
"let g:racer_cmd = "/home/me/.cargo/bin/racer"
|
|
|
|
|
"let g:racer_experimental_completer = 1
|
|
|
|
|
"au FileType rust nmap gd <Plug>(rust-def)
|
|
|
|
|
"au FileType rust nmap gs <Plug>(rust-def-split)
|
|
|
|
|
"au FileType rust nmap gx <Plug>(rust-def-vertical)
|
|
|
|
|
"au FileType rust nmap <leader>gd <Plug>(rust-doc)
|
|
|
|
|
|
|
|
|
|
"" " javacomplete2
|
|
|
|
|
"" autocmd FileType java setlocal omnifunc=javacomplete#Complete
|
|
|
|
|
"" " enable smart (trying to guess import option) inserting class imports with F4
|
|
|
|
|
"" nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
|
|
|
|
|
"" imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
|
|
|
|
|
"" " enable smart (trying to guess import option) inserting class imports with F4
|
|
|
|
|
"" nmap <F5> <Plug>(JavaComplete-Imports-Add)
|
|
|
|
|
"" imap <F5> <Plug>(JavaComplete-Imports-Add)
|
|
|
|
|
"" " add all missing imports with F6
|
|
|
|
|
"" nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
|
|
|
|
|
"" imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
|
|
|
|
|
"" " add all missing imports with F6
|
|
|
|
|
"" nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
|
|
|
|
|
"" imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
|
2017-05-12 14:20:02 +02:00
|
|
|
|
|
2018-08-13 11:53:05 +02:00
|
|
|
|
|