Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
84b19f4ae0
3 changed files with 43 additions and 23 deletions
2
env
2
env
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
export SYS=`uname -s | tr A-Z a-z`
|
export SYS=`uname -s | tr A-Z a-z`
|
||||||
# Set this to a non-zero integer to see startup messages
|
# Set this to a non-zero integer to see startup messages
|
||||||
export NOISY=0
|
export NOISY=20
|
||||||
|
|
||||||
print_heading -l 1 'Initializing environment'
|
print_heading -l 1 'Initializing environment'
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
f = fetch
|
f = fetch
|
||||||
[ui]
|
[ui]
|
||||||
color = true
|
color = true
|
||||||
|
[difftool "Kaleidoscope"]
|
||||||
|
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
|
||||||
[diff]
|
[diff]
|
||||||
tool = Kaleidoscope
|
tool = Kaleidoscope
|
||||||
[mergetool]
|
[mergetool]
|
||||||
|
|
62
vimrc
62
vimrc
|
@ -126,6 +126,8 @@ endif
|
||||||
|
|
||||||
set bg=dark
|
set bg=dark
|
||||||
|
|
||||||
|
call togglebg#map("<F10>")
|
||||||
|
|
||||||
" use solarized colorscheme if the terminal can support it (or we're in a GUI)
|
" use solarized colorscheme if the terminal can support it (or we're in a GUI)
|
||||||
let g:solarized_termtrans = 1
|
let g:solarized_termtrans = 1
|
||||||
let g:solarized_visibility = 'low'
|
let g:solarized_visibility = 'low'
|
||||||
|
@ -178,40 +180,54 @@ function! <SID>strip_trailing_whitespace()
|
||||||
call cursor(l, c)
|
call cursor(l, c)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! <SID>FindProjectFileOrDirectory(fod)
|
||||||
function! <SID>find_project_file()
|
|
||||||
let l:dir = getcwd()
|
let l:dir = getcwd()
|
||||||
" Search up the path, starting at the current working directory, for a
|
" Search up the path, starting at the current working directory, for the
|
||||||
" project.vim file and return the path to it, if it exists.
|
" file or directory given in a:fod and return the path to it, if it exists.
|
||||||
while l:dir != '/'
|
while l:dir != "/"
|
||||||
let l:project_file = l:dir . '/project.vim'
|
let l:file_or_dir = l:dir . "/" . a:fod
|
||||||
if filereadable(l:project_file)
|
if filereadable(l:file_or_dir) || isdirectory(l:file_or_dir)
|
||||||
return l:project_file
|
return l:file_or_dir
|
||||||
endif
|
endif
|
||||||
let l:dir = fnamemodify(l:dir, ':h')
|
let l:dir = fnamemodify(l:dir, ':h')
|
||||||
endwhile
|
endwhile
|
||||||
return ''
|
return ""
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! GetProjectRuntimeDirectory()
|
||||||
|
return <SID>FindProjectFileOrDirectory("vim")
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! <SID>source_project_file()
|
function! GetProjectFile()
|
||||||
let l:project_file = <SID>find_project_file()
|
return <SID>FindProjectFileOrDirectory("project.vim")
|
||||||
if l:project_file != ''
|
endfunction
|
||||||
exec 'source ' . l:project_file
|
|
||||||
|
function! <SID>SourceProjectFile()
|
||||||
|
let l:project_file = GetProjectFile()
|
||||||
|
if l:project_file != ""
|
||||||
|
exec "source " . l:project_file
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! <SID>AddProjectRuntimeDirectory()
|
||||||
|
let l:project_rtp = GetProjectRuntimeDirectory()
|
||||||
|
if isdirectory(l:project_rtp)
|
||||||
|
exec "set rtp+=" . l:project_rtp
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
let mapleader=','
|
let mapleader=','
|
||||||
|
|
||||||
" strip all trailing whitespace in the current file
|
" strip all trailing whitespace in the current file
|
||||||
nnoremap <silent> <leader>W :call <SID>strip_trailing_whitespace()<CR>
|
nnoremap <silent> <leader>W :call <SID>strip_trailing_whitespace()<CR>
|
||||||
" (Re)load a project.vim file
|
|
||||||
nnoremap <leader>P :exec 'edit ' . <SID>source_project_file()<CR>
|
|
||||||
|
|
||||||
" edit and source .vimrc and project.vim files
|
" Source .vimrc and project.vim files
|
||||||
nmap <silent> <leader>ev :e $MYVIMRC<CR>
|
nmap <leader>V :source $MYVIMRC<CR>
|
||||||
nmap <silent> <leader>sv :source $MYVIMRC<CR>
|
nmap <leader>P :call <SID>SourceProjectFile()<CR>
|
||||||
nmap <silent> <leader>eP :e <SID>find_project_file()<CR>
|
" Edit my .vimrc and project.vim files
|
||||||
|
nmap <leader>eV :edit $MYVIMRC<CR>
|
||||||
|
nmap <leader>eP :exec 'edit ' . GetProjectFile()<CR>
|
||||||
|
|
||||||
" hide search terms
|
" hide search terms
|
||||||
nmap <silent> <leader><space> :setlocal invhlsearch<CR>
|
nmap <silent> <leader><space> :setlocal invhlsearch<CR>
|
||||||
|
@ -256,13 +272,15 @@ if has('autocmd')
|
||||||
" All my projects are in the ~/Code directory. Look for and source a
|
" All my projects are in the ~/Code directory. Look for and source a
|
||||||
" project.vim file if one exists.
|
" project.vim file if one exists.
|
||||||
autocmd VimEnter ~/Code/*
|
autocmd VimEnter ~/Code/*
|
||||||
\ call <SID>source_project_file()
|
\ call <SID>SourceProjectFile()
|
||||||
|
autocmd VimEnter ~/Code/*
|
||||||
|
\ call <SID>AddProjectRuntimeDirectory()
|
||||||
|
|
||||||
" Reload snippets after editing the snippets file. Snippet files are
|
" Reload snippets after editing the snippets file. Snippet files are
|
||||||
" <filetype>.snippets. Get <filetype> from the filename and reload the
|
" <filetype>.snippets. Get <filetype> from the filename and reload the
|
||||||
" snippets for that type.
|
" snippets for that type.
|
||||||
autocmd BufWritePost *.snippets
|
"autocmd BufWritePost *.snippets
|
||||||
\ :call ReloadSnippets(expand('%:t:r'))
|
" \ :call ReloadSnippets(expand('%:t:r'))
|
||||||
|
|
||||||
" Clean whitespace before saving: Python, C, HTML, and Objective-C
|
" Clean whitespace before saving: Python, C, HTML, and Objective-C
|
||||||
autocmd BufWritePre *.py,*.h,*.c,*.html,*.m,*.mm,*.cc,*.hh
|
autocmd BufWritePre *.py,*.h,*.c,*.html,*.m,*.mm,*.cc,*.hh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue