1
0

add configuration tree

This commit is contained in:
valeth 2015-02-13 04:20:21 +01:00
parent 3d2dffe5f8
commit fdbea47fc8
34 changed files with 522 additions and 0 deletions

24
config/autocommands.vim Normal file
View File

@ -0,0 +1,24 @@
"aug LineNumbers
"au!
"au VimEnter,WinEnter,InsertLeave * setlocal relativenumber
"au WinLeave,InsertEnter * setlocal norelativenumber
"aug END
aug CursorLineColumn
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline cursorcolumn
"au VimEnter,WinEnter,BufWinEnter * setlocal cursorcolumn
"au VimEnter,WinEnter,BufWinEnter * setlocal colorcolumn=80
au WinLeave * setlocal nocursorline nocursorcolumn colorcolumn=0
aug END
aug FastEscape
au!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
aug END
aug ReadonlyFiles
au BufNewFile,BufRead /var/log/* set readonly
au BufNewFile,BufRead /var/log/* set nomodifiable
aug END

4
config/commands.vim Normal file
View File

@ -0,0 +1,4 @@
command! Wq wq
command! WQ wq
command! Q q
command! W w

View File

@ -0,0 +1 @@
au BufReadPost * if &key != "" | set noswapfile nowritebackup viminfo= nobackup noshelltemp history=0 secure | endif

View File

@ -0,0 +1,3 @@
if v:version >= 704
set cryptmethod=blowfish
endif

View File

@ -0,0 +1,5 @@
let g:ctrlp_cmd = "CtrlPBuffer"
let g:ctrlp_prompt_mappings = {
\ 'ToggleType(1)': ['<c-l>', '<c-f>', '<c-up>'],
\ 'ToggleType(-1)': ['<c-h>', '<c-b>', '<c-down>'],
\ }

31
config/folding.vim Normal file
View File

@ -0,0 +1,31 @@
if has("folding")
set foldtext=MyFoldText()
function! MyFoldText()
" get actual numberwidth of the current document
let nw_add = (len(line('$')) - (&numberwidth - 1))
if nw_add > 0
let nw = &numberwidth + nw_add
else
let nw = &numberwidth
endif
let numfold_w =(nw * &number) + &foldcolumn
let window_w = winwidth(0) - numfold_w
let foldtxt_start = getline(v:foldstart)
let foldtxt_start_w = len(foldtxt_start)
let foldtxt_end = "+" . string(foldclosedend(v:foldend) - foldclosed(v:foldstart)) . "  "
let foldtxt_end_w = len(foldtxt_end)
let foldtxt_mid_w = window_w - (foldtxt_start_w + foldtxt_end_w)
let foldtxt_mid = repeat(" ", foldtxt_mid_w + 2)
""let onetab = strpart(" ", 0, &tabstop)
"let foldtext_start = getline(v:foldstart) . " …"
"let foldtext_start = substitute(foldtext_start, "\t", onetab, "g")
return foldtxt_start . foldtxt_mid . foldtxt_end
endfunction
endif

3
config/gundo/keymaps.vim Normal file
View File

@ -0,0 +1,3 @@
nnoremap <silent> <F11> :GundoToggle<CR>
inoremap <silent> <F11> <C-O>:GundoToggle<CR>
vnoremap <silent> <F11> <ESC>:GundoToggle<CR>

View File

@ -0,0 +1,3 @@
let g:gundo_width = 60
let g:gundo_preview_height = 30
let g:gundo_right = 1

28
config/keymaps.vim Normal file
View File

@ -0,0 +1,28 @@
nnoremap <F1> <NOP>
inoremap <F1> <NOP>
nnoremap <silent> <F4> :set invlist<CR>
inoremap <silent> <F4> <C-O>:set invlist<CR>
vnoremap <silent> <F4> :<C-W>set invlist<CR>
nnoremap Q <NOP>
nnoremap K <NOP>
nnoremap Y y$
nnoremap j gj
nnoremap k gk
vnoremap < <gv
vnoremap > >gv
nnoremap th :tabfirst<CR>
nnoremap tj :tabnext<CR>
nnoremap tk :tabprev<CR>
nnoremap tl :tablast<CR>
nnoremap tn :tabnew<CR>
nnoremap tq :tabclose<CR>
noremap <silent> <Leader><CR> :noh<CR>
nnoremap <Leader>vl :setlocal cursorline!<CR>
nnoremap <Leader>vc :setlocal cursorcolumn!<CR>
nnoremap <Leader>ve :setlocal colorcolumn=80<CR>
nnoremap <Leader>vn :setlocal colorcolumn=0<CR>

View File

@ -0,0 +1,5 @@
nnoremap <SID> <Plug>Tex_Help
inoremap <SID> <Plug>Tex_Help
nnoremap <SID> <Plug>IMAP_JumpForward
vnoremap <SID> <Plug>IMAP_JumpForward
"noremap <buffer> <F5> :w<CR> :!pdflatex -shell-escape "%" && { pgrep ".*%:p || xdg-open %:p:r.pdf }<CR>

View File

@ -0,0 +1 @@
set grepprg=grep\ -nH\ $*

View File

@ -0,0 +1,14 @@
let g:tex_flavor = "latex"
let g:tex_fold_enabled = 1
let g:Imap_UsePlaceHolders = 0
let g:Tex_ViewRule_dvi = ""
let g:Tex_ViewRule_ps = ""
let g:Tex_ViewRule_pdf = ""
let g:Tex_ViewRuleComplete_dvi = "pgrep okular.*$* || xdg-open &"
let g:Tex_ViewRuleComplete_ps = ""
let g:Tex_ViewRuleComplete_pdf = "pgrep okular.*$* || xdg-open &"
let g:Tex_DefaultTargetFormat = "pdf"

View File

@ -0,0 +1 @@
colorscheme molokai

View File

@ -0,0 +1 @@
set background=dark

View File

@ -0,0 +1,2 @@
"let g:molokai_original = 1
"let g:rehash256 = 1

193
config/my_vim.vim Normal file
View File

@ -0,0 +1,193 @@
function! CheckXDGVars()
if empty($XDG_CONFIG_HOME)
let $vim_config_home=expand("$HOME/.config/vim")
else
let $vim_config_home=expand("$XDG_CONFIG_HOME/vim")
endif
if empty($XDG_CACHE_HOME)
let $vim_cache_home=expand("$HOME/.local/cache/vim")
else
let $vim_cache_home=expand("$XDG_CACHE_HOME/vim")
endif
if empty($XDG_DATA_HOME)
let $vim_data_home=expand("$HOME/.local/share/vim")
else
let $vim_data_home=expand("$XDG_DATA_HOME/vim")
endif
endfunction
function! SetUserRuntimePath(dir)
let $user_rtp=a:dir
let $runtimepath_old=&runtimepath
set runtimepath=$user_rtp,$user_rtp/after,$runtimepath_old
endfunction
function! SetUserBackupdir(dir)
let &backupdir=a:dir . "/backup"
if !isdirectory(expand(&backupdir))
call mkdir(expand(&backupdir), "p", 0700)
endif
endfunction
function! SetUserSwapdir(dir)
let &directory=a:dir . "/swap"
if !isdirectory(expand(&directory))
call mkdir(expand(&directory), "p", 0700)
endif
endfunction
function! SetUserViewdir(dir)
if has('mksession')
let &viewdir=a:dir . "/views"
if !isdirectory(expand(&viewdir))
call mkdir(expand(&viewdir), "p", 0700)
endif
endif
endfunction
function! SetUserUndodir(dir)
if has('persistent_undo')
let &undodir=a:dir . "/undo"
if !isdirectory(expand(&undodir))
call mkdir(expand(&undodir), "p", 0700)
endif
endif
endfunction
function! SetUserViminfo(dir)
if has('viminfo')
if !isdirectory(a:dir)
call mkdir(a:dir, "p", 0700)
endif
set nocompatible
let &viminfo="'1000,<50,s10,n" . a:dir . "/viminfo"
endif
endfunction
function! SetOptions()
set autoindent
set backspace=indent,eol,start
set complete-=i
set smarttab
set nrformats-=octal
set shiftround
set ttimeout
set ttimeoutlen=100
set laststatus=2
set number
set autoread " does it even work?
set fileformats=unix,dos,mac
set display+=lastline
set noerrorbells
set visualbell
set t_vb=
set showmatch
"#################################
"# Options depending on features #
"#################################
" allow the cursor to be positioned where no characters are in virtual block mode
if has('virtualedit')
set virtualedit=block
endif
" split the windows more 'naturally'
if has('windows')
set splitbelow
set splitright
endif
" enable filetype plugins
if has('autocmd')
filetype plugin indent on
endif
" enable syntax highlighting
if has('syntax')
syntax enable
endif
" highlight searches and search while typing
if has('extra_search')
set hlsearch
set incsearch
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent><C-L> :nohlsearch<CR><C-L>
endif
endif
" show a ruler and show the current command in the bottom right
if has('cmdline_info')
set ruler
set showcmd
endif
if has('wildmenu')
set wildmenu
endif
if has('multi_byte')
set encoding=utf-8
set termencoding=utf-8
endif
" enable mouse support
if has('mouse')
set mouse=a
endif
"######################################
"# Options depending on set variables #
"######################################
" set scroll offset slightly higher so that the next or previous line can be seen
if !&scrolloff
set scrolloff=1
endif
" same as with scroll offset but for horizontal scrolling
if !&sidescrolloff
set sidescrolloff=5
endif
" set the history far higher (default 50)
if &history < 1000
set history=1000
endif
" increase the maximal number of tabpages (default 10)
if &tabpagemax < 50
set tabpagemax=50
endif
" set the terminal colors to 256 if not in a VT
if exists($TERM)
if &t_Co == 8 && $TERM !~# '^linux'
set t_Co=256
endif
endif
"#################
"# Plugins, etc. #
"#################
" load the matchit macros
if !exists('g:loaded_matchit') && findfile('plugins/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
endfunction
if empty($my_vim)
call CheckXDGVars()
call SetUserRuntimePath($vim_config_home)
call SetUserSwapdir($vim_data_home)
call SetUserUndodir($vim_data_home)
call SetUserViewdir($vim_data_home)
call SetUserBackupdir($vim_data_home)
call SetUserViminfo($vim_cache_home)
call SetOptions()
endif " empty($my_vim)

View File

@ -0,0 +1 @@
au bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif

View File

@ -0,0 +1,3 @@
noremap <silent> <F3> :NERDTreeToggle<CR>
inoremap <silent> <F3> <C-O>:NERDTreeToggle<CR>
vnoremap <silent> <F3> <ESC>:NERDTreeToggle<CR>

36
config/options.vim Normal file
View File

@ -0,0 +1,36 @@
set listchars=tab:»\ ,trail:◆,extends:▹,precedes:◃,eol:↲,nbsp
set ignorecase
set smartcase
set confirm
set autowrite
set shortmess=aoOtTI
set clipboard=unnamed,unnamedplus,autoselect
set softtabstop=4
set shiftwidth=4
set smartindent
set expandtab
set wildmode=longest:full,list
set wildignore=.bak,.old,.swp,~
set autochdir
if v:version >= 704
set undofile
set undolevels=1000
endif
set report=0
set updatetime=1500
set switchbuf=useopen,usetab
set pumheight=10
set diffopt+=context:3
set matchtime=2
set foldcolumn=0
set foldlevel=1
set foldmethod=syntax
set nowrap
set t_Co=256

View File

@ -0,0 +1,3 @@
set laststatus=2
set noshowmode
"set showtabline=2

View File

@ -0,0 +1,11 @@
"if $TERM != "linux"
"if executable("powerline")
"if executable("python3")
"let $PYTHONPATH="/usr/lib/python3.4/site-packages"
"elseif executable("python2")
"let $PYTHONPATH="/usr/lib/python2.7/site-packages"
"endif
"endif
"endif
"let g:powerline_pycmd = "py3"

View File

@ -0,0 +1 @@
let g:quickrun_config = {}

View File

@ -0,0 +1 @@
"colorscheme solarized

View File

@ -0,0 +1 @@
"set background=dark

View File

@ -0,0 +1,2 @@
let g:solarized_termtrans = 1
let g:solarized_termcolors = 256

1
config/sudo/commands.vim Normal file
View File

@ -0,0 +1 @@
command! Sw w !sudo tee % >/dev/null

View File

@ -0,0 +1,12 @@
let g:syntastic_enable_signs = 1
let g:syntastic_check_on_open = 1
let g:syntastic_enable_highlighting = 1
let g:syntastic_auto_loc_list = 1
"let g:syntastic_c_check_header = 1
"let g:syntastic_cpp_remove_include_errors = 1
"let g:syntastic_cpp_check_header = 1
"let g:syntastic_cpp_auto_refresh_includes = 1
let g:syntastic_tex_checkers = ["false"]

View File

@ -0,0 +1,3 @@
nnoremap <silent> <F12> :TagbarToggle<CR>
inoremap <silent> <F12> <C-O>:TagbarToggle<CR>
vnoremap <silent> <F12> <ESC>:TagbarToggle<CR>

25
config/tmux/keymaps.vim Normal file
View File

@ -0,0 +1,25 @@
if exists('$TMUX')
function! TmuxOrSplitSwitch(wincmd, tmuxdir)
let previous_winnr = winnr()
silent! execute "wincmd " . a:wincmd
if previous_winnr == winnr()
call system("tmux select-pane -" . a:tmuxdir)
redraw!
endif
endfunction
let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', '', '')
let &t_ti = "\<Esc>]2;vim\<Esc>\\" . &t_ti
let &t_te = "\<Esc>]2;". previous_title . "\<Esc>\\" . &t_te
noremap <silent><C-h> :call TmuxOrSplitSwitch('h', 'L')<cr>
noremap <silent><C-l> :call TmuxOrSplitSwitch('l', 'R')<cr>
noremap <silent><C-k> :call TmuxOrSplitSwitch('k', 'U')<cr>
noremap <silent><C-j> :call TmuxOrSplitSwitch('j', 'D')<cr>
noremap <silent><C-b> :call TmuxOrSplitSwitch('b', 'l')<cr>
else
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
endif

View File

@ -0,0 +1 @@
inoremap <C-@> <C-Space>

View File

@ -0,0 +1,5 @@
let g:UltiSnipsUsePythonVersion = 3
let g:UltiSnipsExpandTrigger = '<C-Space>'
let g:UltiSnipsJumpForwardTrigger = '<C-l>'
let g:UltiSnipsJumpBackwardTrigger = '<C-h>'
let g:UltiSnipsSnippetDirectories = ['UltiSnips', 'snippets']

2
config/variables.vim Normal file
View File

@ -0,0 +1,2 @@
let g:mapleader = ","
let g:sh_fold_enabled=1

3
config/ycm/variables.vim Normal file
View File

@ -0,0 +1,3 @@
let g:ycm_global_ycm_extra_conf = $XDG_CONFIG_HOME . "/vim/config/ycm/ycm_extra_conf.py"
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_register_as_syntastic_checker = 1

View File

@ -0,0 +1,92 @@
import os
import ycm_core
flags = [ '-Wall', '-Werror', '-std=c99' ]
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
if os.path.exists( compilation_database_folder ):
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
compilation_info = database.GetCompilationInfoForFile(
replacement_file )
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile( filename )
def FlagsForFile( filename, **kwargs ):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = GetCompilationInfoForFile( filename )
if not compilation_info:
return None
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_ )
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
return {
'flags': final_flags,
'do_cache': True
}