From b780b8ad80b0dda994b3a0bb8f5d4f227b0f688a Mon Sep 17 00:00:00 2001 From: Flavius Aspra Date: Mon, 30 May 2011 11:56:55 +0200 Subject: [PATCH 1/6] update sessionman to version 1.06 --- .vim/bundle/rbtweaks/plugin/sessionman.vim | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.vim/bundle/rbtweaks/plugin/sessionman.vim b/.vim/bundle/rbtweaks/plugin/sessionman.vim index b56514cb9..d9ab64eda 100644 --- a/.vim/bundle/rbtweaks/plugin/sessionman.vim +++ b/.vim/bundle/rbtweaks/plugin/sessionman.vim @@ -5,7 +5,7 @@ " Copyright (c) Yuri Klubakov " " Author: Yuri Klubakov -" Version: 1.04 (2008-06-21) +" Version: 1.06 (2011-05-06) " Requires: Vim 6 " License: GPL " @@ -30,7 +30,7 @@ " " :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, - close session list +" q - close session list " o, , <2-LeftMouse> - open session " d - delete session " e - edit session @@ -38,7 +38,7 @@ " 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 @@ -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 @@ -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 @@ -185,7 +199,6 @@ function! s:ListSessions() setlocal nowrap setlocal nobuflisted - nnoremap :bwipeout! nnoremap q :bwipeout! nnoremap o :call OpenSession(getline('.')) nnoremap :call OpenSession(getline('.')) @@ -196,7 +209,7 @@ function! s:ListSessions() syn match Comment "^\".*" put ='\"-----------------------------------------------------' - put ='\" q, - close session list' + put ='\" q - close session list' put ='\" o, , <2-LeftMouse> - open session' put ='\" d - delete session' put ='\" e - edit session' @@ -217,6 +230,7 @@ function! s:ListSessions() 0,1d execute l setlocal nomodifiable + setlocal nospell endfunction "============================================================================" @@ -279,7 +293,7 @@ an 10.371 &File.S&essions.&Open\.\.\. :SessionList an 10.372 &File.S&essions.Open\ &Last :SessionOpenLast an 10.373 &File.S&essions.&Close :SessionClose an 10.374 &File.S&essions.&Save :SessionSave -an 10.374 &File.S&essions.Save\ &As\.\.\. :SessionSaveAs +an 10.375 &File.S&essions.Save\ &As\.\.\. :SessionSaveAs aug sessionman au VimLeavePre * if sessionman_save_on_exit && v:this_session != '' | call s:SaveSession() | endif From e280294ca6f9894ef969ac1240f008d78a7f42b3 Mon Sep 17 00:00:00 2001 From: Flavius Aspra Date: Mon, 30 May 2011 12:20:20 +0200 Subject: [PATCH 2/6] making sessionman work after the first usage --- .vim/bundle/rbtweaks/plugin/sessionman.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/.vim/bundle/rbtweaks/plugin/sessionman.vim b/.vim/bundle/rbtweaks/plugin/sessionman.vim index d9ab64eda..71d7c46be 100644 --- a/.vim/bundle/rbtweaks/plugin/sessionman.vim +++ b/.vim/bundle/rbtweaks/plugin/sessionman.vim @@ -198,6 +198,7 @@ function! s:ListSessions() setlocal noswapfile setlocal nowrap setlocal nobuflisted + setlocal modifiable nnoremap q :bwipeout! nnoremap o :call OpenSession(getline('.')) From ec936aa104fef4280c3de78ad948da605753532a Mon Sep 17 00:00:00 2001 From: Flavius Aspra Date: Mon, 30 May 2011 12:21:26 +0200 Subject: [PATCH 3/6] use the local .vimrc.local if it's already existent --- link | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/link b/link index 8bf0a00cf..fab3851c3 100755 --- a/link +++ b/link @@ -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 From 5574697fcf2b39013e77a64d39531baf74c19e28 Mon Sep 17 00:00:00 2001 From: Flavius Aspra Date: Mon, 30 May 2011 12:23:37 +0200 Subject: [PATCH 4/6] ignore the sessions --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4ce1074dd..e4706f8eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store *.pyc *._* +*.vim/sessions/ From cf7cfa030a0835dae147153e9f2a4496abc978aa Mon Sep 17 00:00:00 2001 From: Flavius Aspra Date: Mon, 30 May 2011 12:26:25 +0200 Subject: [PATCH 5/6] distclean cleans up everything in your home directory but outside of the repo, so you can start clean with ./link --- distclean | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 distclean diff --git a/distclean b/distclean new file mode 100755 index 000000000..d29899982 --- /dev/null +++ b/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 From e6d11e203a373b8d4fda5653f8b158c5df8b3431 Mon Sep 17 00:00:00 2001 From: Flavius Aspra Date: Mon, 30 May 2011 13:48:04 +0200 Subject: [PATCH 6/6] an utility script for developers to update scripts which are not git modules --- fetch-scripts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 fetch-scripts diff --git a/fetch-scripts b/fetch-scripts new file mode 100755 index 000000000..e6efbb567 --- /dev/null +++ b/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