added vim settings

This commit is contained in:
Christian Koptein 2024-04-27 17:54:16 +02:00
parent 5f746b44be
commit b02af18962
4 changed files with 1381 additions and 1 deletions

View File

@ -2,7 +2,7 @@
mkdir -p $HOME/.ssh
for link in bashrc gitconfig screenrc Xresources Xdefaults Xmodmap themes fonts aliases ;do
for link in bashrc gitconfig screenrc Xresources Xdefaults Xmodmap themes fonts aliases vim vimrc ;do
rm -rf $HOME/.$link && ln -s $(pwd)/$link $HOME/.$link;

1117
vim/colors/solarized.vim Executable file

File diff suppressed because it is too large Load Diff

163
vim/plugin/rainbow.vim Executable file
View File

@ -0,0 +1,163 @@
"==============================================================================
"Script Title: rainbow parentheses improved
"Script Version: 2.52
"Author: luochen1990, Francisco Lopes
"Last Edited: 2013 Sep 12
" By default, use rainbow colors copied from gruvbox colorscheme (https://github.com/morhetz/gruvbox).
" They are generally good for both light and dark colorschemes.
let s:guifgs = exists('g:rainbow_guifgs')? g:rainbow_guifgs : [
\ '#458588',
\ '#b16286',
\ '#cc241d',
\ '#d65d0e',
\ '#458588',
\ '#b16286',
\ '#cc241d',
\ '#d65d0e',
\ '#458588',
\ '#b16286',
\ '#cc241d',
\ '#d65d0e',
\ '#458588',
\ '#b16286',
\ '#cc241d',
\ '#d65d0e',
\ ]
let s:ctermfgs = exists('g:rainbow_ctermfgs')? g:rainbow_ctermfgs : [
\ 'brown',
\ 'Darkblue',
\ 'darkgray',
\ 'darkgreen',
\ 'darkcyan',
\ 'darkred',
\ 'darkmagenta',
\ 'brown',
\ 'gray',
\ 'black',
\ 'darkmagenta',
\ 'Darkblue',
\ 'darkgreen',
\ 'darkcyan',
\ 'darkred',
\ 'red',
\ ]
let s:max = has('gui_running')? len(s:guifgs) : len(s:ctermfgs)
func! rainbow#load(...)
if exists('b:loaded')
cal rainbow#clear()
endif
if a:0 >= 1
let b:loaded = a:1
elseif &ft == 'cpp'
let b:loaded = [
\ ['(', ')'],
\ ['\[', '\]'],
\ ['{', '}'],
\ ['\v%(<operator\_s*)@<!%(%(\i|^\_s*|template\_s*)@<=\<[<#=]@!|\<@<!\<[[:space:]<#=]@!)', '\v%(-)@<!\>']
\ ]
elseif &ft == 'rust' || &ft == 'cs' || &ft == 'java'
let b:loaded = [
\ ['(', ')'],
\ ['\[', '\]'],
\ ['{', '}'],
\ ['\v%(\i|^\_s*)@<=\<[<#=]@!|\<@<!\<[[:space:]<#=]@!', '\v%(-)@<!\>']
\ ]
else
let b:loaded = [ ['(', ')'], ['\[', '\]'], ['{', '}'] ]
endif
let b:operators = (a:0 < 2) ? '"\v[{\[(<_"''`#*/>)\]}]@![[:punct:]]|\*/@!|/[/*]@!|\<#@!|#@<!\>"' : a:2
if b:operators != ''
exe 'syn match op_lv0 '.b:operators
let cmd = 'syn match %s %s containedin=%s contained'
for [left , right] in b:loaded
for each in range(1, s:max)
exe printf(cmd, 'op_lv'.each, b:operators, 'lv'.each)
endfor
endfor
endif
let str = 'TOP'
for each in range(1, s:max)
let str .= ',lv'.each
endfor
let cmd = 'syn region %s matchgroup=%s start=+%s+ end=+%s+ containedin=%s contains=%s,%s,@Spell fold'
for [left , right] in b:loaded
for each in range(1, s:max)
exe printf(cmd, 'lv'.each, 'lv'.each.'c', left, right, 'lv'.(each % s:max + 1), str, 'op_lv'.each)
endfor
endfor
cal rainbow#activate()
endfunc
func! rainbow#clear()
if exists('b:loaded')
unlet b:loaded
exe 'syn clear op_lv0'
for each in range(1 , s:max)
exe 'syn clear lv'.each
exe 'syn clear op_lv'.each
endfor
endif
endfunc
func! rainbow#activate()
if !exists('b:loaded')
cal rainbow#load()
endif
exe 'hi default op_lv0 ctermfg='.s:ctermfgs[-1].' guifg='.s:guifgs[-1]
for id in range(1 , s:max)
let ctermfg = s:ctermfgs[(s:max - id) % len(s:ctermfgs)]
let guifg = s:guifgs[(s:max - id) % len(s:guifgs)]
exe 'hi default lv'.id.'c ctermfg='.ctermfg.' guifg='.guifg
exe 'hi default op_lv'.id.' ctermfg='.ctermfg.' guifg='.guifg
endfor
exe 'syn sync fromstart'
let b:active = 'active'
endfunc
func! rainbow#inactivate()
if exists('b:active')
exe 'hi clear op_lv0'
for each in range(1, s:max)
exe 'hi clear lv'.each.'c'
exe 'hi clear op_lv'.each.''
endfor
exe 'syn sync fromstart'
unlet b:active
endif
endfunc
func! rainbow#toggle()
if exists('b:active')
cal rainbow#inactivate()
else
cal rainbow#activate()
endif
endfunc
if exists('g:rainbow_active') && g:rainbow_active
if exists('g:rainbow_load_separately')
let ps = g:rainbow_load_separately
for i in range(len(ps))
if len(ps[i]) < 3
exe printf('au syntax,colorscheme %s call rainbow#load(ps[%d][1])' , ps[i][0] , i)
else
exe printf('au syntax,colorscheme %s call rainbow#load(ps[%d][1] , ps[%d][2])' , ps[i][0] , i , i)
endif
endfor
else
au syntax,colorscheme * call rainbow#load()
endif
endif
command! RainbowToggle call rainbow#toggle()
command! RainbowLoad call rainbow#load()

100
vimrc Normal file
View File

@ -0,0 +1,100 @@
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
" For plugins to load correctly
filetype plugin indent on
" TODO: Pick a leader key
" let mapleader = ","
" Security
set modelines=0
" Show line numbers
set number
" Show file stats
set ruler
" Blink cursor on error instead of beeping (grr)
set visualbell
" Encoding
set encoding=utf-8
" Whitespace
set wrap
set textwidth=79
set formatoptions=tcqrn1
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set noshiftround
" Cursor motion
set scrolloff=3
set backspace=indent,eol,start
set matchpairs+=<:> " use % to jump between pairs
runtime! macros/matchit.vim
" Move up/down editor lines
nnoremap j gj
nnoremap k gk
" Allow hidden buffers
set hidden
" Rendering
set ttyfast
" Status bar
set laststatus=2
" Last line
set showmode
set showcmd
" Searching
nnoremap / /\v
vnoremap / /\v
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmatch
map <leader><space> :let @/=''<cr> " clear search
" Remap help key.
inoremap <F1> <ESC>:set invfullscreen<CR>a
nnoremap <F1> :set invfullscreen<CR>
vnoremap <F1> :set invfullscreen<CR>
" Textmate holdouts
" Formatting
map <leader>q gqip
" Visualize tabs and newlines
set listchars=tab:▸\ ,eol
" Uncomment this to enable by default:
" set list " To enable by default
" Or use your leader key + l to toggle on/off
map <leader>l :set list!<CR> " Toggle tabs and EOL
" Color scheme (terminal)
set t_Co=256
set background=dark
let g:solarized_termcolors=256
let g:solarized_termtrans=1
" put https://raw.github.com/altercation/vim-colors-solarized/master/colors/solarized.vim
" in ~/.vim/colors/ and uncomment:
colorscheme slate
set mouse=