summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2019-07-14 16:53:09 +0200
committerSebastian Reichel <sre@ring0.de>2019-07-14 16:53:09 +0200
commitcb7637be66695f558562c9c3595d7fc78c737dc3 (patch)
treebf8433c5c0a626f1cae3a0ded421bf546e28570c
parent732b7bcdd99824b19b04574d44a2696b58adf1ab (diff)
downloadvim-config-cb7637be66695f558562c9c3595d7fc78c737dc3.tar.bz2
update vim configHEADmaster
-rw-r--r--vim/usage2
-rw-r--r--vimrc77
2 files changed, 77 insertions, 2 deletions
diff --git a/vim/usage b/vim/usage
index 12a548e..17a465a 100644
--- a/vim/usage
+++ b/vim/usage
@@ -8,6 +8,8 @@ F10 - open pdf in evince
y - yank (copy selected text)
p - paste
+"0p - paste after delete
+
== Misc ==
C-A - increment next number
C-X - decrement next number
diff --git a/vimrc b/vimrc
index 1d40d5e..dc5e264 100644
--- a/vimrc
+++ b/vimrc
@@ -2,6 +2,7 @@
set nocompatible " vim native mode
syntax on " enable syntax highlighting
+let c_comment_strings=1
colorscheme elektranox " cool colors
set clipboard=unnamedplus " use X11 clipboard for copy/paste
set hlsearch " highlight searched word
@@ -21,6 +22,10 @@ set encoding=utf-8 " UTF-8
set autoread
set noexpandtab
set t_Co=256
+set tabpagemax=32
+
+autocmd Filetype gitcommit set textwidth=72
+autocmd Filetype gitcommit set spell
" spellcheck setup (disabled by default)
set spellfile=~/.vim/spell/en.add,~/.vim/spell/de.add,~/.vim/spell/names.add
@@ -47,6 +52,9 @@ set whichwrap=h,l,~,[,]
set wildmenu
set wildmode=list:longest,full
+" save as root with w!!
+cmap w!! w !/usr/bin/sudo /usr/bin/tee > /dev/null %
+
" copy&paste via <F4>
nnoremap \tp :set invpaste paste?<CR>
nmap <F4> \tp
@@ -66,6 +74,7 @@ imap <F6> <C-O>\make
" insert newline without editing mode
map <CR> o<Esc>
+nmap <F9> :ConqueTerm zsh<CR>
nmap <F12> :TagbarToggle<CR>
" add vala support
@@ -78,6 +87,9 @@ au BufRead,BufNewFile *.gtkaml setfiletype vala
let vala_comment_strings = 1
let vala_space_errors = 1 " highlight space errors in vala code
+" G-Code
+au BufRead,BufNewFile *.nc setfiletype nc
+
" add support for subtitle files
au BufNewFile,BufRead *.ssa setf ssa
au BufNewFile,BufRead *.ass setf ssa
@@ -142,7 +154,11 @@ au BufReadCmd *.epub call zip#Browse(expand("<amatch>"))
filetype plugin on
" git branch in ruler
-set rulerformat=%33(%{fugitive#statusline()}%=%10(%l,%c%V%=%5(%p%%%)%)%)
+if has('nvim')
+ " no fugitive in nvim for now
+else
+ set rulerformat=%33(%{fugitive#statusline()}%=%10(%l,%c%V%=%5(%p%%%)%)%)
+endif
" tex = latex
let g:tex_flavor='latex'
@@ -150,13 +166,19 @@ let g:tex_flavor='latex'
" debian/control indents must be spaces
autocmd FileType debcontrol set expandtab
+autocmd BufNewFile,BufRead /home/sre/src/u-boot/* set tabstop=8 shiftwidth=8 softtabstop=8
autocmd BufNewFile,BufRead /home/sre/src/linux/* set tabstop=8 shiftwidth=8 softtabstop=8
autocmd BufNewFile,BufRead /home/sre/src/linux-*/* set tabstop=8 shiftwidth=8 softtabstop=8
-execute pathogen#infect()
+if has('nvim')
+ " no pathogen in nvim for now
+else
+ execute pathogen#infect()
+endif
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
+" automatic alignment of ascii-art tables
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
@@ -167,3 +189,54 @@ function! s:align()
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
+
+" Rename tabs to show tab number
+" https://superuser.com/questions/331272/vim-show-the-index-of-tabs-in-the-tabline
+if exists("+showtabline")
+ function! MyTabLine()
+ let s = ''
+ let wn = ''
+ let t = tabpagenr()
+ let i = 1
+ while i <= tabpagenr('$')
+ let buflist = tabpagebuflist(i)
+ let winnr = tabpagewinnr(i)
+ let s .= '%' . i . 'T'
+ let s .= (i == t ? '%1*' : '%2*')
+ let s .= ' '
+ let wn = tabpagewinnr(i,'$')
+
+ let s .= '%#TabNum#'
+ let s .= i
+ " let s .= '%*'
+ let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
+ let bufnr = buflist[winnr - 1]
+ let file = bufname(bufnr)
+ let buftype = getbufvar(bufnr, 'buftype')
+ if buftype == 'nofile'
+ if file =~ '\/.'
+ let file = substitute(file, '.*\/\ze.', '', '')
+ endif
+ else
+ let file = fnamemodify(file, ':p:t')
+ endif
+ if file == ''
+ let file = '[No Name]'
+ endif
+ let s .= ' ' . file . ' '
+ let i = i + 1
+ endwhile
+ let s .= '%T%#TabLineFill#%='
+ let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
+ return s
+ endfunction
+ set stal=2
+ set tabline=%!MyTabLine()
+ set showtabline=1
+ highlight link TabNum Special
+endif
+
+
+let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
+noremap <C-w>e :SyntasticCheck<CR>
+noremap <C-w>f :SyntasticToggleMode<CR>