rc, pathogen, solarized

This commit is contained in:
Loic Nageleisen 2011-05-29 16:51:05 +02:00
commit 8beea916fa
5 changed files with 314 additions and 0 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "bundle.available/vim-colors-solarized"]
path = bundle.available/vim-colors-solarized
url = http://github.com/altercation/vim-colors-solarized.git

142
autoload/pathogen.vim Normal file
View file

@ -0,0 +1,142 @@
" pathogen.vim - path option manipulation
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Version: 1.3
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" API is documented below.
if exists("g:loaded_pathogen") || &cp
finish
endif
let g:loaded_pathogen = 1
" Split a path into a list.
function! pathogen#split(path) abort " {{{1
if type(a:path) == type([]) | return a:path | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction " }}}1
" Convert a list to a path.
function! pathogen#join(...) abort " {{{1
if type(a:1) == type(1) && a:1
let i = 1
let space = ' '
else
let i = 0
let space = ''
endif
let path = ""
while i < a:0
if type(a:000[i]) == type([])
let list = a:000[i]
let j = 0
while j < len(list)
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
let path .= ',' . escaped
let j += 1
endwhile
else
let path .= "," . a:000[i]
endif
let i += 1
endwhile
return substitute(path,'^,','','')
endfunction " }}}1
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort " {{{1
return call('pathogen#join',[1] + a:000)
endfunction " }}}1
" Remove duplicates from a list.
function! pathogen#uniq(list) abort " {{{1
let i = 0
let seen = {}
while i < len(a:list)
if has_key(seen,a:list[i])
call remove(a:list,i)
else
let seen[a:list[i]] = 1
let i += 1
endif
endwhile
return a:list
endfunction " }}}1
" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#separator() abort " {{{1
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction " }}}1
" Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort " {{{1
let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
endfunction "}}}1
" Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort " {{{1
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction "}}}1
" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if
" its 'basename()' is included in g:pathogen_disabled[]'.
function! pathogen#is_disabled(path) " {{{1
if !exists("g:pathogen_disabled")
return 0
endif
let sep = pathogen#separator()
return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1
endfunction "}}}1
" Prepend all subdirectories of path to the rtp, and append all 'after'
" directories in those subdirectories.
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
let sep = pathogen#separator()
let before = filter(pathogen#glob_directories(a:path.sep."*[^~]"), '!pathogen#is_disabled(v:val)')
let after = filter(pathogen#glob_directories(a:path.sep."*[^~]".sep."after"), '!pathogen#is_disabled(v:val[0:-7])')
let rtp = pathogen#split(&rtp)
let path = expand(a:path)
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
return &rtp
endfunction " }}}1
" For each directory in rtp, check for a subdirectory named dir. If it
" exists, add all subdirectories of that subdirectory to the rtp, immediately
" after the original directory. If no argument is given, 'bundle' is used.
" Repeated calls with the same arguments are ignored.
function! pathogen#runtime_append_all_bundles(...) " {{{1
let sep = pathogen#separator()
let name = a:0 ? a:1 : 'bundle'
if "\n".s:done_bundles =~# "\\M\n".name."\n"
return ""
endif
let s:done_bundles .= name . "\n"
let list = []
for dir in pathogen#split(&rtp)
if dir =~# '\<after$'
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
else
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))
return 1
endfunction
let s:done_bundles = ''
" }}}1
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() " {{{1
for dir in pathogen#split(&rtp)
if dir[0 : strlen($VIM)-1] !=# $VIM && isdirectory(dir.'/doc') && !empty(glob(dir.'/doc/*')) && (!filereadable(dir.'/doc/tags') || filewritable(dir.'/doc/tags'))
helptags `=dir.'/doc'`
endif
endfor
endfunction " }}}1
" vim:set ft=vim ts=8 sw=2 sts=2:

@ -0,0 +1 @@
Subproject commit 528a59f26d12278698bb946f8fb82a63711eec21

1
bundle/vim-colors-solarized Symbolic link
View file

@ -0,0 +1 @@
../bundle.available/vim-colors-solarized

167
vimrc Normal file
View file

@ -0,0 +1,167 @@
" lloeki's vimrc
set nocompatible
"bundle loading via pathogen
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
scriptencoding "utf-8"
"make sure backspace behaves
set backspace=indent,eol,start
if has('gui_running') "GUI specific settings
"better font
set guifont=Menlo:h12
"no toolbar
set guioptions-=T
set background=light
set transparency=8
"window size
set columns=90
set lines=30
else "non-GUI
set background=dark
set showtabline=0 "no tab bar
endif
"color theme
"colorscheme desert
"colorscheme delek
let g:solarized_termcolors=16
colorscheme solarized
"special case fixes
"if &term =~ "vt100"
" let &term="xterm"
"endif
"if &term =~ "xterm"
" if has("terminfo")
" let &t_Co=8
" let &t_Sf="\e[3%p1%dm"
" let &t_Sb="\e[4%p1%dm"
" else
" let &t_Co=8
" let &t_Sf="\e[3%dm"
" let &t_Sb="\e[4%dm"
" endif
"endif
"enable syntax highlighting if term supports enough colors
if has('syntax') && (&t_Co > 2)
syntax on
endif
"enable filetype detection
"filetype on
filetype plugin on
filetype indent on
"ignore some files
set wildignore+=*.o,*.obj,.git,.svn,*.pyc
"display more info
set showmode "display current mode at the bottom
set showcmd "display command info at the bottom
set ruler "display coordinates and relative position at the bottom
set number "show line numbers in left margin
set laststatus=1
" search tweaks
set incsearch
set ignorecase "ignore case when searching
set smartcase "... but be nice when actually typing caps
" tabbing settings
set shiftwidth=4 "indent size
set shiftround "round indent to next offset
set tabstop=4 "size of tab character
set expandtab "insert spaces instead of tab
set softtabstop=4 "... and that much spaces are inserted
set smarttab "tab insertion actually indents on line start
set autoindent "new line copies indent from above
"feedback
set cursorline "highlight current line
set showmatch "highlight both matching parentheses
set listchars=eol,tab:→\ ,nbsp:•,trail:⋅
set list
"filetype specific settings
autocmd FileType make set noexpandtab "makefiles need tabs
"swap files
"set directory=/var/tmp,.
"key mappings
let mapleader = ','
"Command-T mappings
let g:CommandTAcceptSelectionTabMap='<CR>'
let g:CommandTAcceptSelectionMap='<C-r>'
" xterm escape codes for osx-like cursor motion
"noremap  <C-Left>
"noremap  <C-Right>
"noremap  <Home>
"noremap  <End>
"noremap  <Home>
"noremap  <End>
"noremap!  <C-Left>
"noremap!  <C-Right>
"noremap!  <Home>
"noremap!  <End>
"noremap!  <Home>
"noremap!  <End>
" highlight background for >80
"highlight OverLength ctermbg=red ctermfg=white guibg=#592929
"match OverLength /\%81v.\+/
" restore last known cursor position
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
" unfold at cursor position
if has("folding")
function! UnfoldCur()
if !&foldenable
return
endif
let cl = line(".")
if cl <= 1
return
endif
let cf = foldlevel(cl)
let uf = foldlevel(cl - 1)
let min = (cf > uf ? uf : cf)
if min
execute "normal!" min . "zo"
return 1
endif
endfunction
endif
" restore last known cursor position on open
augroup resCur
autocmd!
if has("folding")
autocmd BufWinEnter * if ResCur() | call UnfoldCur() | endif
else
autocmd BufWinEnter * call ResCur()
endif
augroup END