Skip to content

Commit

Permalink
Merge pull request spf13#20 from OriginalCopy/master
Browse files Browse the repository at this point in the history
6 commits to make your life less frustrating and a bugfix
  • Loading branch information
Steve Francia committed Jun 16, 2011
2 parents ffdbe91 + e6d11e2 commit 4ec21c9
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
.DS_Store
*.pyc
*._*
*.vim/sessions/
37 changes: 26 additions & 11 deletions .vim/bundle/rbtweaks/plugin/sessionman.vim
Expand Up @@ -5,7 +5,7 @@
" Copyright (c) Yuri Klubakov
"
" Author: Yuri Klubakov <yuri.mlists at gmail dot com>
" Version: 1.04 (2008-06-21)
" Version: 1.06 (2011-05-06)
" Requires: Vim 6
" License: GPL
"
Expand All @@ -30,15 +30,15 @@
"
" :SessionList command creates a new window with session names.
" At the top of the window there is a help that shows normal mode mappings:
" q, <ESC> - close session list
" q - close session list
" o, <CR>, <2-LeftMouse> - open session
" d - delete session
" e - edit session
" x - edit extra session script
" The name of an opened session is saved in g:LAST_SESSION variable which is
" saved in the viminfo file if 'viminfo' option contains '!'. It is used to
" open last session by :SessionOpenLast command. It can be done when Vim
" starts (gvim +bd -c OpenLastSession) or any time during a Vim session.
" starts (gvim +bd -c SessionOpenLast) or any time during a Vim session.
" You can edit an extra session script to specify additional settings and
" actions associated with a given session. If you change values of
" 'expandtab', 'tabstop' or 'shiftwidth', they will be restored to their
Expand Down Expand Up @@ -107,12 +107,25 @@ endfunction
function! s:OpenSession(name)
if a:name != '' && a:name[0] != '"'
call s:RestoreDefaults()
execute 'silent! 1,' . bufnr('$') . 'bwipeout!'
let n = bufnr('%')
execute 'silent! so ' . s:sessions_path . '/' . a:name
execute 'silent! bwipeout! ' . n
if has('cscope')
silent! cscope kill -1
endif
try
set eventignore=all
execute 'silent! 1,' . bufnr('$') . 'bwipeout!'
let n = bufnr('%')
execute 'silent! so ' . s:sessions_path . '/' . a:name
execute 'silent! bwipeout! ' . n
finally
set eventignore=
doautoall BufRead
doautoall FileType
doautoall BufEnter
doautoall BufWinEnter
doautoall TabEnter
doautoall SessionLoadPost
endtry
if has('cscope')
silent! cscope add .
endif
let g:LAST_SESSION = a:name
Expand Down Expand Up @@ -164,7 +177,8 @@ endfunction
function! s:EditSessionExtra(name)
if a:name != '' && a:name[0] != '"'
bwipeout!
execute 'silent! edit ' . s:sessions_path . '/' . a:name . 'x.vim'
let n = substitute(a:name, "\\.[^.]*$", '', '')
execute 'silent! edit ' . s:sessions_path . '/' . n . 'x.vim'
endif
endfunction

Expand All @@ -184,8 +198,8 @@ function! s:ListSessions()
setlocal noswapfile
setlocal nowrap
setlocal nobuflisted
setlocal modifiable

nnoremap <buffer> <silent> <ESC> :bwipeout!<CR>
nnoremap <buffer> <silent> q :bwipeout!<CR>
nnoremap <buffer> <silent> o :call <SID>OpenSession(getline('.'))<CR>
nnoremap <buffer> <silent> <CR> :call <SID>OpenSession(getline('.'))<CR>
Expand All @@ -196,7 +210,7 @@ function! s:ListSessions()
syn match Comment "^\".*"
put ='\"-----------------------------------------------------'
put ='\" q, <ESC> - close session list'
put ='\" q - close session list'
put ='\" o, <CR>, <2-LeftMouse> - open session'
put ='\" d - delete session'
put ='\" e - edit session'
Expand All @@ -217,6 +231,7 @@ function! s:ListSessions()
0,1d
execute l
setlocal nomodifiable
setlocal nospell
endfunction

"============================================================================"
Expand Down Expand Up @@ -279,7 +294,7 @@ an 10.371 &File.S&essions.&Open\.\.\. :SessionList<CR>
an 10.372 &File.S&essions.Open\ &Last :SessionOpenLast<CR>
an 10.373 &File.S&essions.&Close :SessionClose<CR>
an 10.374 &File.S&essions.&Save :SessionSave<CR>
an 10.374 &File.S&essions.Save\ &As\.\.\. :SessionSaveAs<CR>
an 10.375 &File.S&essions.Save\ &As\.\.\. :SessionSaveAs<CR>

aug sessionman
au VimLeavePre * if sessionman_save_on_exit && v:this_session != '' | call s:SaveSession() | endif
Expand Down
5 changes: 5 additions & 0 deletions distclean
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

for i in .ctags .gvimrc .vim .vimrc .vimbackup .vimswap .vimviews .vim; do
rm -rf ~/$i
done
30 changes: 30 additions & 0 deletions fetch-scripts
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# This script fetches or updates local vim scripts which are not git modules

MYDIR="`dirname $(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")`"
CURL="curl -O -J"


#TODO install each download based on the file type
#currently, the following are zips: bufexplorer, cvim, taglist

VIMFILES=("sessionman.vim" "autoclose.vim" "a.vim" "showmarks.vim")
VIMFILESURLS=("http://www.vim.org/scripts/download_script.php?src_id=15599"
"http://www.vim.org/scripts/download_script.php?src_id=10873"
"http://www.vim.org/scripts/download_script.php?src_id=7218"
"http://www.vim.org/scripts/script.php?script_id=152"
)
VIMFILESLOCATIONS=(".vim/bundle/rbtweaks/plugin/"
".vim/bundle/rbtweaks/plugin/"
".vim/bundle/rbtweaks/plugin/"
".vim/bundle/rbtweaks/plugin/"
)

for (( i = 0 ; i < ${#VIMFILES[@]} ; i++ ))
do
cd ${VIMFILESLOCATIONS[$i]}
if [ -e ${VIMFILES[$i]} ]
then rm ${VIMFILES[$i]} #TODO do a diff
fi
$CURL ${VIMFILESURLS[$i]}
done
2 changes: 1 addition & 1 deletion link
Expand Up @@ -2,6 +2,6 @@

MYDIR="`dirname $(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")`"

for i in .ctags .gvimrc .vim .vimrc .vimrc.local; do
for i in .ctags .gvimrc .vim .vimrc; do
ln -s "$MYDIR/$i" ~/$i
done

0 comments on commit 4ec21c9

Please sign in to comment.