diff --git a/.bash_profile b/.bash_profile index 9c7203d..e0ee3c9 100644 --- a/.bash_profile +++ b/.bash_profile @@ -16,6 +16,7 @@ Darwin) MACPORTS_PATH=/opt/local/bin:/opt/local/sbin:/opt/local/usr/bin:/opt/local/usr/local/bin; export MACPORTS_PATH PATH=$HOME/bin:$MACPORTS_PATH:$PATH; export PATH export DISPLAY=:0.0 + set completion-ignore-case on ;; esac diff --git a/.bashrc b/.bashrc index 58dd472..553a425 100644 --- a/.bashrc +++ b/.bashrc @@ -38,7 +38,7 @@ case $TERM in *) TITLEBAR="\033k\033\134"; esac; -PS1="${TITLEBAR}\[\033[0m\]\[\033[0;32m\]\u\[\033[0m\]\[\033[0;37m\]@\[\033[0m\]\[\033[0;32m\]\h\[\033[0m\]\[\033[0;37m\]:\[\033[0;34m\][\[\033[1;36m\]\w\[\033[0;34m\]]\[\033[0;0m\]\$ " +PS1="\[\033[0m\]\[\033[0;32m\]\u\[\033[0m\]\[\033[0;37m\]@\[\033[0m\]\[\033[0;32m\]\h\[\033[0m\]\[\033[0;37m\]:\[\033[0;34m\][\[\033[1;36m\]\w\[\033[0;34m\]]\[\033[0;0m\]\$ " #PS1="${TITLEBAR}\[\033[0m\]\[\033[0;34m\][\[\033[0m\]\[\033[1;33m\]\$(date +%H:%M)|\!\[\033[0m\]\[\033[0;34m\]] \[\033[0m\]\[\033[0;32m\]\u\[\033[0m\]\[\033[0;37m\]@\[\033[0m\]\[\033[0;32m\]\h\[\033[0m\]\[\033[0;37m\]:\[\033[0m\]\[\033[1;36m\]\w\[\033[0m\]\[\033[0;0m\]\$ " #PS1="${TITLEBAR}\[\033[0m\]\[\033[1;34m\][\[\033[0m\]\[\033[1;33m\]\$(date +%H:%M)\[\033[0m\]\[\033[1;34m\]] \u\[\033[0m\]\[\033[0;37m\]@\[\033[0m\]\[\033[1;34m\]\h\[\033[0m\]\[\033[0;37m\]:\[\033[0m\]\[\033[1;36m\]\w\[\033[0m\]\[\033[0;0m\]\$ " #PS1="${TITLEBAR}\[\033[0m\]\[\033[0;32m\][\$(date +%H:%M)] \[\033[0;33m\]\u\[\033[0m\]@\[\033[0;31m\]\h\[\033[1;37m\]:\[\033[0m\]\[\033[1;34m\]\w\[\033[1;37m\]\$ \[\033[0;0m\]" diff --git a/.gvimrc b/.gvimrc index 4778f8c..b999c41 100644 --- a/.gvimrc +++ b/.gvimrc @@ -1 +1,4 @@ winsize 110 43 + +call AppleTSetPath("~/work/client") +map gg :CmdT diff --git a/.vim/doc/vcscommand.txt b/.vim/doc/vcscommand.txt new file mode 100644 index 0000000..0c16aac --- /dev/null +++ b/.vim/doc/vcscommand.txt @@ -0,0 +1,771 @@ +*vcscommand.txt* vcscommand +Copyright (c) 2007 Bob Hiestand + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +For instructions on installing this file, type + :help add-local-help +inside Vim. + +Author: Bob Hiestand +Credits: Benji Fisher's excellent MatchIt documentation + +============================================================================== +1. Contents *vcscommand-contents* + + Installation : |vcscommand-install| + vcscommand Intro : |vcscommand| + vcscommand Manual : |vcscommand-manual| + Customization : |vcscommand-customize| + SSH "integration" : |vcscommand-ssh| + Changes from cvscommand : |cvscommand-changes| + Bugs : |vcscommand-bugs| + +============================================================================== + +2. vcscommand Installation *vcscommand-install* + +The vcscommand plugin comprises five files: vcscommand.vim, vcssvn.vim, +vcscvs.vim, vcssvk.vim and vcscommand.txt (this file). In order to install +the plugin, place the vcscommand.vim, vcssvn.vim, vcssvk.vim, and vcscvs.vim +files into a plugin directory in your runtime path (please see +|add-global-plugin| and |'runtimepath'|. + +This help file can be included in the VIM help system by copying it into a +'doc' directory in your runtime path and then executing the |:helptags| +command, specifying the full path of the 'doc' directory. Please see +|add-local-help| for more details. + +vcscommand may be customized by setting variables, creating maps, and +specifying event handlers. Please see |vcscommand-customize| for more +details. + +============================================================================== + +3. vcscommand Intro *vcscommand* + *vcscommand-intro* + +The vcscommand plugin provides global ex commands for manipulating +version-controlled source files, currently those controlled either by CVS or +Subversion. In general, each command operates on the current buffer and +accomplishes a separate source control function, such as update, commit, log, +and others (please see |vcscommand-commands| for a list of all available +commands). The results of each operation are displayed in a scratch buffer. +Several buffer variables are defined for those scratch buffers (please see +|vcscommand-buffer-variables|). + +The notion of "current file" means either the current buffer, or, in the case +of a directory buffer (such as Explorer or netrw buffers), the directory (and +all subdirectories) represented by the the buffer. + +For convenience, any vcscommand invoked on a vcscommand scratch buffer acts as +though it was invoked on the original file and splits the screen so that the +output appears in a new window. + +Many of the commands accept revisions as arguments. By default, most operate +on the most recent revision on the current branch if no revision is specified. + +Each vcscommand is mapped to a key sequence starting with the +keystroke. The default mappings may be overridden by supplying different +mappings before the plugin is loaded, such as in the vimrc, in the standard +fashion for plugin mappings. For examples, please see +|vcscommand-mappings-override|. + +The vcscommand plugin may be configured in several ways. For more details, +please see |vcscommand-customize|. + +============================================================================== + +4. vcscommand Manual *vcscommand-manual* + +4.1 vcscommand commands *vcscommand-commands* + +vcscommand defines the following commands: + +|:VCSAdd| +|:VCSAnnotate| +|:VCSBlame| +|:VCSCommit| +|:VCSDelete| +|:VCSDiff| +|:VCSGotoOriginal| +|:VCSLog| +|:VCSRemove| +|:VCSRevert| +|:VCSReview| +|:VCSStatus| +|:VCSUpdate| +|:VCSVimDiff| + +The following commands are specific to CVS files: + +|:CVSEdit| +|:CVSEditors| +|:CVSUnedit| +|:CVSWatch| +|:CVSWatchAdd| +|:CVSWatchOn| +|:CVSWatchOff| +|:CVSWatchRemove| +|:CVSWatchers| + +:VCSAdd *:VCSAdd* + +This command adds the current file to source control. Please note, this does +not commit the newly-added file. All parameters to the command are passed to +the underlying VCS. + +:VCSAnnotate *:VCSAnnotate* + +This command displays the current file with each line annotated with the +version in which it was most recently changed. If an argument is given, the +argument is used as a revision number to display. If not given an argument, +it uses the most recent version of the file (on the current branch, if under +CVS control). Additionally, if the current buffer is a VCSAnnotate buffer +already, the version number on the current line is used. + +For CVS buffers, the 'VCSCommandCVSAnnotateParent' option, if set to non-zero, +will cause the above behavior to change. Instead of annotating the version on +the current line, the parent revision is used instead, crossing branches if +necessary. + +The filetype of the vcscommand scratch buffer is set to one of 'CVSAnnotate', +'SVNAnnotate', or 'SVKAnnotate' as appropriate, to take advantage of the +bundled syntax files. + +:VCSBlame *:VCSBlame* + +Alias for |:VCSAnnotate|. + +:VCSCommit[!] *:VCSCommit* + +This command commits changes to the current file to source control. + +If called with arguments, the arguments are the log message. + +If '!' is used, an empty log message is committed. + +If called with no arguments, this is a two-step command. The first step opens +a buffer to accept a log message. When that buffer is written, it is +automatically closed and the file is committed using the information from that +log message. The commit can be abandoned if the log message buffer is deleted +or wiped before being written. + +Alternatively, the mapping that is used to invoke :VCSCommit (by default +cc) can be used in the log message buffer to immediately commit. This +is useful if the |VCSCommandCommitOnWrite| variable is set to 0 to disable the +normal commit-on-write behavior. + +:VCSDelete *:VCSDelete* + +Deletes the current file and removes it from source control. All parameters +to the command are passed to the underlying VCS. + +:VCSDiff *:VCSDiff* + +With no arguments, this displays the differences between the current file and +its parent version under source control in a new scratch buffer. + +With one argument, the diff is performed on the current file against the +specified revision. + +With two arguments, the diff is performed between the specified revisions of +the current file. + +For CVS, this command uses the |VCSCommandCVSDiffOpt| variable to specify diff +options. If that variable does not exist, a plugin-specific default is used. +If you wish to have no options, then set it to the empty string. + +For SVN, this command uses the |VCSCommandSVNDiffOpt| variable to specify diff +options. If that variable does not exist, the SVN default is used. +Additionally, |VCSCommandSVNDiffExt| can be used to select an external diff +application. + +:VCSGotoOriginal *:VCSGotoOriginal* + +This command jumps to the source buffer if the current buffer is a VCS scratch +buffer. + +:VCSGotoOriginal! + +Like ":VCSGotoOriginal" but also executes :bufwipeout on all VCS scrach +buffers associated with the original file. + +:VCSInfo *:VCSInfo* + +This command displays extended information about the current file in a new +scratch buffer. + +:VCSLock *:VCSLock* + +This command locks the current file in order to prevent other users from +concurrently modifying it. The exact semantics of this command depend on the +underlying VCS. This does nothing in CVS. All parameters are passed to the +underlying VCS. + +:VCSLog *:VCSLog* + +Displays the version history of the current file in a new scratch buffer. If +there is one parameter supplied, it is taken as as a revision parameters to be +passed through to the underlying VCS. Otherwise, all parameters are passed to +the underlying VCS. + +:VCSRemove *:VCSRemove* + +Alias for |:VCSDelete|. + +:VCSRevert *:VCSRevert* + +This command replaces the current file with the most recent version from the +repository in order to wipe out any undesired changes. + +:VCSReview *:VCSReview* + +Displays a particular version of the current file in a new scratch buffer. If +no argument is given, the most recent version of the file on the current +branch is retrieved. + +:VCSStatus *:VCSStatus* + +Displays versioning information about the current file in a new scratch +buffer. All parameters are passed to the underlying VCS. + + +:VCSUnlock *:VCSUnlock* + +Unlocks the current file in order to allow other users from concurrently +modifying it. The exact semantics of this command depend on the underlying +VCS. All parameters are passed to the underlying VCS. + +:VCSUpdate *:VCSUpdate* + +Updates the current file with any relevant changes from the repository. This +intentionally does not automatically reload the current buffer, though vim +should prompt the user to do so if the underlying file is altered by this +command. + +:VCSVimDiff *:VCSVimDiff* + +Uses vimdiff to display differences between versions of the current file. + +If no revision is specified, the most recent version of the file on the +current branch is used. With one argument, that argument is used as the +revision as above. With two arguments, the differences between the two +revisions is displayed using vimdiff. + +With either zero or one argument, the original buffer is used to perform the +vimdiff. When the scratch buffer is closed, the original buffer will be +returned to normal mode. + +Once vimdiff mode is started using the above methods, additional vimdiff +buffers may be added by passing a single version argument to the command. +There may be up to 4 vimdiff buffers total. + +Using the 2-argument form of the command resets the vimdiff to only those 2 +versions. Additionally, invoking the command on a different file will close +the previous vimdiff buffers. + +:CVSEdit *:CVSEdit* + +This command performs "cvs edit" on the current file. Yes, the output buffer +in this case is almost completely useless. + +:CVSEditors *:CVSEditors* + +This command performs "cvs edit" on the current file. + +:CVSUnedit *:CVSUnedit* + +Performs "cvs unedit" on the current file. Again, yes, the output buffer here +is basically useless. + +:CVSWatch *:CVSWatch* + +This command takes an argument which must be one of [on|off|add|remove]. The +command performs "cvs watch" with the given argument on the current file. + +:CVSWatchAdd *:CVSWatchAdd* + +This command is an alias for ":CVSWatch add" + +:CVSWatchOn *:CVSWatchOn* + +This command is an alias for ":CVSWatch on" + +:CVSWatchOff *:CVSWatchOff* + +This command is an alias for ":CVSWatch off" + +:CVSWatchRemove *:CVSWatchRemove* + +This command is an alias for ":CVSWatch remove" + +:CVSWatchers *:CVSWatchers* + +This command performs "cvs watchers" on the current file. + +4.2 Mappings *vcscommand-mappings* + +By default, a mapping is defined for each command. These mappings execute the +default (no-argument) form of each command. + +ca VCSAdd +cn VCSAnnotate +cc VCSCommit +cD VCSDelete +cd VCSDiff +cg VCSGotoOriginal +cG VCSGotoOriginal! +ci VCSInfo +cl VCSLog +cL VCSLock +cr VCSReview +cs VCSStatus +cu VCSUpdate +cU VCSUnlock +cv VCSVimDiff + +Only for CVS buffers: + +ce CVSEdit +cE CVSEditors +ct CVSUnedit +cwv CVSWatchers +cwa CVSWatchAdd +cwn CVSWatchOn +cwf CVSWatchOff +cwf CVSWatchRemove + + *vcscommand-mappings-override* + +The default mappings can be overriden by user-provided instead by mapping to +CommandName. This is especially useful when these mappings collide with +other existing mappings (vim will warn of this during plugin initialization, +but will not clobber the existing mappings). + +For instance, to override the default mapping for :VCSAdd to set it to '\add', +add the following to the vimrc: + +nmap \add VCSAdd + +4.3 Automatic buffer variables *vcscommand-buffer-variables* + +Several buffer variables are defined in each vcscommand result buffer. These +may be useful for additional customization in callbacks defined in the event +handlers (please see |vcscommand-events|). + +The following variables are automatically defined: + +b:VCSCommandOriginalBuffer *b:VCSCommandOriginalBuffer* + +This variable is set to the buffer number of the source file. + +b:VCSCommandCommand *b:VCSCommandCommand* + +This variable is set to the name of the vcscommand that created the result +buffer. + +b:VCSCommandSourceFile *b:VCSCommandSourceFile* + +This variable is set to the name of the original file under source control. + +b:VCSCommandVCSType *b:VCSCommandVCSType* + +This variable is set to the type of the source control. This variable is also +set on the original file itself. +============================================================================== + +5. Configuration and customization *vcscommand-customize* + *vcscommand-config* + +The vcscommand plugin can be configured in several ways: by setting +configuration variables (see |vcscommand-options|) or by defining vcscommand +event handlers (see |vcscommand-events|). Additionally, the vcscommand plugin +supports a customized status line (see |vcscommand-statusline| and +|vcscommand-buffer-management|). + +5.1 vcscommand configuration variables *vcscommand-options* + +Several variables affect the plugin's behavior. These variables are checked +at time of execution, and may be defined at the window, buffer, or global +level and are checked in that order of precedence. + + +The following variables are available: + +|VCSCommandCommitOnWrite| +|VCSCommandCVSDiffOpt| +|VCSCommandCVSExec| +|VCSCommandDeleteOnHide| +|VCSCommandDiffSplit| +|VCSCommandDisableMappings| +|VCSCommandDisableExtensionMappings| +|VCSCommandEdit| +|VCSCommandEnableBufferSetup| +|VCSCommandResultBufferNameExtension| +|VCSCommandResultBufferNameFunction| +|VCSCommandSplit| +|VCSCommandSVKExec| +|VCSCommandSVNDiffExt| +|VCSCommandSVNDiffOpt| +|VCSCommandSVNExec| + +VCSCommandCommitOnWrite *VCSCommandCommitOnWrite* + +This variable, if set to a non-zero value, causes the pending commit +to take place immediately as soon as the log message buffer is written. +If set to zero, only the VCSCommit mapping will cause the pending commit to +occur. If not set, it defaults to 1. + +VCSCommandCVSExec *VCSCommandCVSExec* + +This variable controls the executable used for all CVS commands If not set, +it defaults to "cvs". + +VCSCommandDeleteOnHide *VCSCommandDeleteOnHide* + +This variable, if set to a non-zero value, causes the temporary result buffers +to automatically delete themselves when hidden. + +VCSCommandCVSDiffOpt *VCSCommandCVSDiffOpt* + +This variable, if set, determines the options passed to the diff command of +CVS. If not set, it defaults to 'u'. + +VCSCommandDiffSplit *VCSCommandDiffSplit* + +This variable overrides the |VCSCommandSplit| variable, but only for buffers +created with |:VCSVimDiff|. + +VCSCommandDisableMappings *VCSCommandDisableMappings* + +This variable, if set to a non-zero value, prevents the default command +mappings from being set. This supercedes +|VCSCommandDisableExtensionMappings|. + +VCSCommandDisableExtensionMappings *VCSCommandDisableExtensionMappings* + +This variable, if set to a non-zero value, prevents the default command +mappings from being set for commands specific to an individual VCS. + +VCSCommandEdit *VCSCommandEdit* + +This variable controls whether the original buffer is replaced ('edit') or +split ('split'). If not set, it defaults to 'split'. + +VCSCommandEnableBufferSetup *VCSCommandEnableBufferSetup* + +This variable, if set to a non-zero value, activates VCS buffer management +mode see (|vcscommand-buffer-management|). This mode means that the +'VCSCommandBufferInfo' variable is filled with version information if the file +is VCS-controlled. This is useful for displaying version information in the +status bar. + +VCSCommandResultBufferNameExtension *VCSCommandResultBufferNameExtension* + +This variable, if set to a non-blank value, is appended to the name of the VCS +command output buffers. For example, '.vcs'. Using this option may help +avoid problems caused by autocommands dependent on file extension. + +VCSCommandResultBufferNameFunction *VCSCommandResultBufferNameFunction* + +This variable, if set, specifies a custom function for naming VCS command +output buffers. This function is expected to return the new buffer name, and +will be passed the following arguments: + + command - name of the VCS command being executed (such as 'Log' or + 'Diff'). + + originalBuffer - buffer number of the source file. + + vcsType - type of VCS controlling this file (such as 'CVS' or 'SVN'). + + statusText - extra text associated with the VCS action (such as version + numbers). + +VCSCommandSplit *VCSCommandSplit* + +This variable controls the orientation of the various window splits that +may occur. + +If set to 'horizontal', the resulting windows will be on stacked on top of +one another. If set to 'vertical', the resulting windows will be +side-by-side. If not set, it defaults to 'horizontal' for all but +VCSVimDiff windows. + +VCSCommandSVKExec *VCSCommandSVKExec* + +This variable controls the executable used for all SVK commands If not set, +it defaults to "svk". + +VCSCommandSVNDiffExt *VCSCommandSVNDiffExt* + +This variable, if set, is passed to SVN via the --diff-cmd command to select +an external application for performing the diff. + +VCSCommandSVNDiffOpt *VCSCommandSVNDiffOpt* + +This variable, if set, determines the options passed with the '-x' parameter +to the SVN diff command. If not set, no options are passed. + +VCSCommandSVNExec *VCSCommandSVNExec* + +This variable controls the executable used for all SVN commands If not set, +it defaults to "svn". + +5.2 VCSCommand events *vcscommand-events* + +For additional customization, vcscommand can trigger user-defined events. +Event handlers are provided by defining User event autocommands (see +|autocommand|, |User|) in the vcscommand group with patterns matching the +event name. + +For instance, the following could be added to the vimrc to provide a 'q' +mapping to quit a vcscommand scratch buffer: + +augroup VCSCommand + au User VCSBufferCreated silent! nmap q: bwipeout +augroup END + +The following hooks are available: + +VCSBufferCreated This event is fired just after a vcscommand + result buffer is created and populated. It is + executed within the context of the vcscommand + buffer. The vcscommand buffer variables may + be useful for handlers of this event (please + see |vcscommand-buffer-variables|). + +VCSBufferSetup This event is fired just after vcscommand buffer + setup occurs, if enabled. + +VCSPluginInit This event is fired when the vcscommand plugin + first loads. + +VCSPluginFinish This event is fired just after the vcscommand + plugin loads. + +VCSVimDiffFinish This event is fired just after the VCSVimDiff + command executes to allow customization of, + for instance, window placement and focus. + +Additionally, there is another hook which is used internally to handle loading +the multiple scripts in order. This hook should probably not be used by an +end user without a good idea of how it works. Among other things, any events +associated with this hook are cleared after they are executed (during +vcscommand.vim script initialization). + +VCSLoadExtensions This event is fired just before the + VCSPluginFinish. It is used internally to + execute any commands from the VCS + implementation plugins that needs to be + deferred until the primary plugin is + initialized. + +5.3 vcscommand buffer naming *vcscommand-naming* + +vcscommand result buffers use the following naming convention: +[{VCS type} {VCS command} {Source file name}] + +If additional buffers are created that would otherwise conflict, a +distinguishing number is added: + +[{VCS type} {VCS command} {Source file name}] (1,2, etc) + +5.4 vcscommand status line support *vcscommand-statusline* + +It is intended that the user will customize the |'statusline'| option to +include vcscommand result buffer attributes. A sample function that may be +used in the |'statusline'| option is provided by the plugin, +VCSCommandGetStatusLine(). In order to use that function in the status line, do +something like the following: + +set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P + +of which %{VCSCommandGetStatusLine()} is the relevant portion. + +The sample VCSCommandGetStatusLine() function handles both vcscommand result +buffers and VCS-managed files if vcscommand buffer management is enabled +(please see |vcscommand-buffer-management|). + +5.5 vcscommand buffer management *vcscommand-buffer-management* + +The vcscommand plugin can operate in buffer management mode, which means that +it attempts to set a buffer variable ('VCSCommandBufferInfo') upon entry into +a buffer. This is rather slow because it means that the VCS will be invoked +at each entry into a buffer (during the |BufEnter| autocommand). + +This mode is disabled by default. In order to enable it, set the +|VCSCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling +this mode simply provides the buffer variable mentioned above. The user must +explicitly include information from the variable in the |'statusline'| option +if they are to appear in the status line (but see |vcscommand-statusline| for +a simple way to do that). + +The 'VCSCommandBufferInfo' variable is a list which contains, in order, the +revision of the current file, the latest revision of the file in the +repository, and (for CVS) the name of the branch. If those values cannot be +determined, the list is a single element: 'Unknown'. + +============================================================================== + +6. SSH "integration" *vcscommand-ssh* + +The following instructions are intended for use in integrating the +vcscommand.vim plugin with an SSH-based CVS environment. + +Familiarity with SSH and CVS are assumed. + +These instructions assume that the intent is to have a message box pop up in +order to allow the user to enter a passphrase. If, instead, the user is +comfortable using certificate-based authentication, then only instructions +6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then +work transparently. + +6.1 Environment settings *vcscommand-ssh-env* + +6.1.1 CVSROOT should be set to something like: + + :ext:user@host:/path_to_repository + +6.1.2 CVS_RSH should be set to: + + ssh + + Together, those settings tell CVS to use ssh as the transport when + performing CVS calls. + +6.1.3 SSH_ASKPASS should be set to the password-dialog program. In my case, + running gnome, it's set to: + + /usr/libexec/openssh/gnome-ssh-askpass + + This tells SSH how to get passwords if no input is available. + +6.1.4 OPTIONAL. You may need to set SSH_SERVER to the location of the cvs + executable on the remote (server) machine. + +6.2 CVS wrapper program *vcscommand-ssh-wrapper* + +Now you need to convince SSH to use the password-dialog program. This means +you need to execute SSH (and therefore CVS) without standard input. The +following script is a simple perl wrapper that dissasociates the CVS command +from the current terminal. Specific steps to do this may vary from system to +system; the following example works for me on linux. + +#!/usr/bin/perl -w +use strict; +use POSIX qw(setsid); +open STDIN, '/dev/null'; +fork and do {wait; exit;}; +setsid; +exec('cvs', @ARGV); + +6.3 Configuring vcscommand.vim *vcscommand-ssh-config* + +At this point, you should be able to use your wrapper script to invoke CVS with +various commands, and get the password dialog. All that's left is to make CVS +use your newly-created wrapper script. + +6.3.1 Tell vcscommand.vim what CVS executable to use. The easiest way to do this + is globally, by putting the following in your .vimrc: + + let VCSCommandCVSExec=/path/to/cvs/wrapper/script + +6.4 Where to go from here *vcscommand-ssh-other* + +The script given above works even when non-SSH CVS connections are used, +except possibly when interactively entering the message for CVS commit log +(depending on the editor you use... VIM works fine). Since the vcscommand.vim +plugin handles that message without a terminal, the wrapper script can be used +all the time. + +This allows mixed-mode operation, where some work is done with SSH-based CVS +repositories, and others with pserver or local access. + +It is possible, though beyond the scope of the plugin, to dynamically set the +CVS executable based on the CVSROOT for the file being edited. The user +events provided (such as VCSBufferCreated and VCSBufferSetup) can be used to +set a buffer-local value (b:VCSCommandCVSExec) to override the CVS executable +on a file-by-file basis. Alternatively, much the same can be done (less +automatically) by the various project-oriented plugins out there. + +It is highly recommended for ease-of-use that certificates with no passphrase +or ssh-agent are employed so that the user is not given the password prompt +too often. + +============================================================================== + +7. Changes from cvscommandi *cvscommand-changes* + +1. Require Vim 7 in order to leverage several convenient features; also +because I wanted to play with Vim 7. + +2. Renamed commands to start with 'VCS' instead of 'CVS'. The exceptions are +the 'CVSEdit' and 'CVSWatch' family of commands, which are specific to CVS. + +3. Renamed options, events to start with 'VCSCommand'. + +4. Removed option to jump to the parent version of the current line in an +annotated buffer, as opposed to the version on the current line. This made +little sense in the branching scheme used by subversion, where jumping to a +parent branch required finding a different location in the repository. It +didn't work consistently in CVS anyway. + +5. Removed option to have nameless scratch buffers. + +6. Changed default behavior of scratch buffers to split the window instead of +displaying in the current window. This may still be overridden using the +'VCSCommandEdit' option. + +7. Split plugin into multiple plugins. + +8. Added 'VCSLock' and 'VCSUnlock' commands. These are implemented for +subversion but not for CVS. These were not kept specific to subversion as they +seemed more general in nature and more likely to be supported by any future VCS +supported by this plugin. + +9. Changed name of buffer variables set by commands. + +'b:cvsOrigBuffNR' became 'b:VCSCommandOriginalBuffer' +'b:cvscmd' became 'b:VCSCommandCommand' + +10. Added new automatic variables to command result buffers. + +'b:VCSCommandSourceFile' +'b:VCSCommandVCSType' + +============================================================================== + +8. Known bugs *vcscommand-bugs* + +Please let me know if you run across any. + +CVSUnedit may, if a file is changed from the repository, provide prompt text +to determine whether the changes should be thrown away. Currently, that text +shows up in the CVS result buffer as information; there is no way for the user +to actually respond to the prompt and the CVS unedit command does nothing. If +this really bothers anyone, please let me know. + +VCSVimDiff, when using the original (real) source buffer as one of the diff +buffers, uses some hacks to try to restore the state of the original buffer +when the scratch buffer containing the other version is destroyed. There may +still be bugs in here, depending on many configuration details. + +vim:tw=78:ts=8:ft=help diff --git a/.vim/plugin/AppleT.vim b/.vim/plugin/AppleT.vim new file mode 100644 index 0000000..c3d90fa --- /dev/null +++ b/.vim/plugin/AppleT.vim @@ -0,0 +1,73 @@ +function! AppleT(name) +python << EOF +import sys +import os +import re +import vim + +def walkIt(search): + fullpath = os.path.expanduser(set_path) + fullsearch = ".*%s.*" % ".*".join(search) + fullsearch = re.sub(" ","[/.]", fullsearch) + bsearch = re.sub(" ",".*[/.].*", search) + exactsearch = "%s" % bsearch + exclude = re.compile("\.quer$|\.resp$|\.pyc$") + ignoredirs = [".svn", "_site-packages"] + fullmatch = re.compile(fullsearch, re.I) + exactmatch = re.compile(exactsearch, re.I) + length = len(fullpath) + + results = [] + exactresults = [] + + for root, dirs, files in os.walk(set_path): + for x in ignoredirs: + if x in dirs: + dirs.remove(x) + for f in files: + filename = os.path.join(root,f) + if exclude.search(filename): + pass + elif exactmatch.search(filename): + exactresults.append("%s" % filename) + elif fullmatch.search(filename): + results.append("%s" % filename) + + if len(results) == 0: + return + + def cmplen(x,y): + return cmp(len(x), len(y)) + + results.sort(cmplen) + exactresults.sort(cmplen) + results = exactresults + results + + for i, a in enumerate(results): + print "%d: %s" % (i + 1, a[length:]) + + which = vim.eval('input("Which? ")') + if re.match("^[0-9]+$", which) == None: + return + which = int(which) - 1 + vim.command("tabnew " + results[which]) + +thingtosearch = vim.eval("expand(a:name)") +walkIt(thingtosearch) + +EOF +endfunction + +function! AppleTSetPath(path) +python << EOF +import vim +set_path = vim.eval("expand(a:path)") +EOF +endfunction + +if !exists(":AppleTSetPath") + command! -nargs=+ AppleTSetPath :call AppleTSetPath() +endif +if !exists(":CmdT") + command! -nargs=+ CmdT :call AppleT() +endif diff --git a/.vim/plugin/project.vim b/.vim/plugin/project.vim deleted file mode 100644 index 47bd379..0000000 --- a/.vim/plugin/project.vim +++ /dev/null @@ -1,1293 +0,0 @@ -"============================================================================= -" File: project.vim -" Author: Aric Blumer (Aric.Blumer at aricvim@charter.net) -" Last Change: Fri 13 Oct 2006 09:47:08 AM EDT -" Version: 1.4.1 -"============================================================================= -" See documentation in accompanying help file -" You may use this code in whatever way you see fit. - -if exists('loaded_project') || &cp - finish -endif -let loaded_project=1 - -function! s:Project(filename) " <<< - " Initialization <<< - if exists("g:proj_running") - if strlen(a:filename) != 0 - call confirm('Project already loaded; ignoring filename "'.a:filename."\".\n".'See ":help project-invoking" for information about changing project files.', "&OK", 1) - endif - let filename=bufname(g:proj_running) - else - if strlen(a:filename) == 0 - let filename ='~/.vimprojects' " Default project filename - else - let filename = a:filename - endif - endif - if !exists('g:proj_window_width') - let g:proj_window_width=24 " Default project window width - endif - if !exists('g:proj_window_increment') - let g:proj_window_increment=100 " Project Window width increment - endif - if !exists('g:proj_flags') - if has("win32") || has("mac") - let g:proj_flags='imst' " Project default flags for windows/mac - else - let g:proj_flags='imstb' " Project default flags for everything else - endif - endif - if !exists("g:proj_running") || (bufwinnr(g:proj_running) == -1) " Open the Project Window - exec 'silent vertical new '.filename - if match(g:proj_flags, '\CF') == -1 " We're floating - silent! wincmd H - exec 'vertical resize '.g:proj_window_width - endif - setlocal nomodeline - else - silent! 99wincmd h - if bufwinnr(g:proj_running) == -1 - vertical split - let v:errmsg="nothing" - silent! bnext - if 'nothing' != v:errmsg - enew - endif - endif - return - endif - " Process the flags - let b:proj_cd_cmd='cd' - if match(g:proj_flags, '\Cl') != -1 - let b:proj_cd_cmd = 'lcd' - endif - - let b:proj_locate_command='silent! wincmd H' - let b:proj_resize_command='exec ''vertical resize ''.g:proj_window_width' - if match(g:proj_flags, '\CF') != -1 " Set the resize commands to nothing - let b:proj_locate_command='' - let b:proj_resize_command='' - endif - - let g:proj_last_buffer = -1 - ">>> - " ProjFoldText() <<< - " The foldtext function for displaying just the description. - function! ProjFoldText() - let line=substitute(getline(v:foldstart),'^[ \t#]*\([^=]*\).*', '\1', '') - let line=strpart(' ', 0, (v:foldlevel - 1)).substitute(line,'\s*{\+\s*', '', '') - return line - endfunction ">>> - " s:DoSetup() <<< - " Ensure everything is set up - function! s:DoSetup() - setlocal foldenable foldmethod=marker foldmarker={,} commentstring=%s foldcolumn=0 nonumber noswapfile shiftwidth=1 - setlocal foldtext=ProjFoldText() nobuflisted nowrap - setlocal winwidth=1 - if match(g:proj_flags, '\Cn') != -1 - setlocal number - endif - endfunction ">>> - call s:DoSetup() - " Syntax Stuff <<< - if match(g:proj_flags, '\Cs')!=-1 && has('syntax') && exists('g:syntax_on') && !has('syntax_items') - syntax match projectDescriptionDir '^\s*.\{-}=\s*\(\\ \|\f\|:\|"\)\+' contains=projectDescription,projectWhiteError - syntax match projectDescription '\<.\{-}='he=e-1,me=e-1 contained nextgroup=projectDirectory contains=projectWhiteError - syntax match projectDescription '{\|}' - syntax match projectDirectory '=\(\\ \|\f\|:\)\+' contained - syntax match projectDirectory '=".\{-}"' contained - syntax match projectScriptinout '\>> - " s:SortR(start, end) <<< - " Sort lines. SortR() is called recursively. - " from ":help eval-examples" by Robert Webb, slightly modified - function! s:SortR(start, end) - if (a:start >= a:end) - return - endif - let partition = a:start - 1 - let middle = partition - let partStr = getline((a:start + a:end) / 2) - let i = a:start - while (i <= a:end) - let str = getline(i) - if str < partStr - let result = -1 - elseif str > partStr - let result = 1 - else - let result = 0 - endif - if (result <= 0) - let partition = partition + 1 - if (result == 0) - let middle = partition - endif - if (i != partition) - let str2 = getline(partition) - call setline(i, str2) - call setline(partition, str) - endif - endif - let i = i + 1 - endwhile - if (middle != partition) - let str = getline(middle) - let str2 = getline(partition) - call setline(middle, str2) - call setline(partition, str) - endif - call s:SortR(a:start, partition - 1) - call s:SortR(partition + 1, a:end) - endfunc ">>> - " s:IsAbsolutePath(path) <<< - " Returns true if filename has an absolute path. - function! s:IsAbsolutePath(path) - if a:path =~ '^ftp:' || a:path =~ '^rcp:' || a:path =~ '^scp:' || a:path =~ '^http:' - return 2 - endif - if a:path =~ '\$' - let path=expand(a:path) " Expand any environment variables that might be in the path - else - let path=a:path - endif - if path[0] == '/' || path[0] == '~' || path[0] == '\\' || path[1] == ':' - return 1 - endif - return 0 - endfunction " >>> - " s:DoSetupAndSplit() <<< - " Call DoSetup to ensure the settings are correct. Split to the next - " file. - function! s:DoSetupAndSplit() - call s:DoSetup() " Ensure that all the settings are right - let n = winnr() " Determine if there is a CTRL_W-p window - silent! wincmd p - if n == winnr() - silent! wincmd l - endif - if n == winnr() - " If n == winnr(), then there is no CTRL_W-p window - " So we have to create a new one - if bufnr('%') == g:proj_running - exec 'silent vertical new' - else - exec 'silent vertical split | silent! bnext' - endif - wincmd p " Go back to the Project Window and ensure it is the right width - exec b:proj_locate_command - exec b:proj_resize_command - wincmd p - endif - endfunction ">>> - " s:DoSetupAndSplit_au() <<< - " Same as above but ensure that the Project window is the current - " window. Only called from an autocommand - function! s:DoSetupAndSplit_au() - if winbufnr(0) != g:proj_running - return - endif - call s:DoSetup() " Ensure that all the settings are right - if winbufnr(2) == -1 " We're the only window right now. - exec 'silent vertical split | bnext' - if bufnr('%') == g:proj_running - enew - endif - if bufnr('%') == g:proj_last_buffer | bnext | bprev | bnext | endif - wincmd p " Go back to the Project Window and ensure it is the right width - exec b:proj_locate_command - exec b:proj_resize_command - elseif(winnr() != 1) - exec b:proj_locate_command - exec b:proj_resize_command - endif - endfunction - function! s:RecordPrevBuffer_au() - let g:proj_last_buffer = bufnr('%') - endfunction ">>> - " s:RecursivelyConstructDirectives(lineno) <<< - " Construct the inherited directives - function! s:RecursivelyConstructDirectives(lineno) - let lineno=s:FindFoldTop(a:lineno) - let foldlineno = lineno - let foldlev=foldlevel(lineno) - let parent_infoline = '' - if foldlev > 1 - while foldlevel(lineno) >= foldlev " Go to parent fold - if lineno < 1 - echoerr 'Some kind of fold error. Check your syntax.' - return - endif - let lineno = lineno - 1 - endwhile - let parent_infoline = s:RecursivelyConstructDirectives(lineno) - endif - let parent_home = s:GetHome(parent_infoline, '') - let parent_c_d = s:GetCd(parent_infoline, parent_home) - let parent_scriptin = s:GetScriptin(parent_infoline, parent_home) - let parent_scriptout = s:GetScriptout(parent_infoline, parent_home) - let parent_filter = s:GetFilter(parent_infoline, '*') - let infoline = getline(foldlineno) - " Extract the home directory of this fold - let home=s:GetHome(infoline, parent_home) - if home != '' - if (foldlevel(foldlineno) == 1) && !s:IsAbsolutePath(home) - call confirm('Outermost Project Fold must have absolute path! Or perhaps the path does not exist.', "&OK", 1) - let home = '~' " Some 'reasonable' value - endif - endif - " Extract any CD information - let c_d = s:GetCd(infoline, home) - if c_d != '' - if (foldlevel(foldlineno) == 1) && !s:IsAbsolutePath(c_d) - call confirm('Outermost Project Fold must have absolute CD path! Or perhaps the path does not exist.', "&OK", 1) - let c_d = '.' " Some 'reasonable' value - endif - else - let c_d=parent_c_d - endif - " Extract scriptin - let scriptin = s:GetScriptin(infoline, home) - if scriptin == '' - let scriptin = parent_scriptin - endif - " Extract scriptout - let scriptout = s:GetScriptout(infoline, home) - if scriptout == '' - let scriptout = parent_scriptout - endif - " Extract filter - let filter = s:GetFilter(infoline, parent_filter) - if filter == '' | let filter = parent_filter | endif - return s:ConstructInfo(home, c_d, scriptin, scriptout, '', filter) - endfunction ">>> - " s:ConstructInfo(home, c_d, scriptin, scriptout, flags, filter) <<< - function! s:ConstructInfo(home, c_d, scriptin, scriptout, flags, filter) - let retval='Directory='.a:home - if a:c_d[0] != '' - let retval=retval.' CD='.a:c_d - endif - if a:scriptin[0] != '' - let retval=retval.' in='.a:scriptin - endif - if a:scriptout[0] != '' - let retval=retval.' out='.a:scriptout - endif - if a:filter[0] != '' - let retval=retval.' filter="'.a:filter.'"' - endif - return retval - endfunction ">>> - " s:OpenEntry(line, precmd, editcmd) <<< - " Get the filename under the cursor, and open a window with it. - function! s:OpenEntry(line, precmd, editcmd, dir) - silent exec a:precmd - if (a:editcmd[0] != '') - if a:dir - let fname='.' - else - if (foldlevel(a:line) == 0) && (a:editcmd[0] != '') - return 0 " If we're outside a fold, do nothing - endif - let fname=substitute(getline(a:line), '\s*#.*', '', '') " Get rid of comments and whitespace before comment - let fname=substitute(fname, '^\s*\(.*\)', '\1', '') " Get rid of leading whitespace - if strlen(fname) == 0 - return 0 " The line is blank. Do nothing. - endif - endif - else - let fname='.' - endif - let infoline = s:RecursivelyConstructDirectives(a:line) - let retval=s:OpenEntry2(a:line, infoline, fname, a:editcmd) - call s:DisplayInfo() - return retval - endfunction - ">>> - " s:OpenEntry2(line, infoline, precmd, editcmd) <<< - " Get the filename under the cursor, and open a window with it. - function! s:OpenEntry2(line, infoline, fname, editcmd) - let fname=escape(a:fname, ' %#') " Thanks to Thomas Link for cluing me in on % and # - let home=s:GetHome(a:infoline, '').'/' - if home=='/' - echoerr 'Project structure error. Check your syntax.' - return - endif - "Save the cd command - let cd_cmd = b:proj_cd_cmd - if a:editcmd[0] != '' " If editcmd is '', then just set up the environment in the Project Window - call s:DoSetupAndSplit() - " If it is an absolute path, don't prepend home - if !s:IsAbsolutePath(fname) - let fname=home.fname - endif - if s:IsAbsolutePath(fname) == 2 - exec a:editcmd.' '.fname - else - silent exec 'silent '.a:editcmd.' '.fname - endif - else " only happens in the Project File - exec 'au! BufEnter,BufLeave '.expand('%:p') - endif - " Extract any CD information - let c_d = s:GetCd(a:infoline, home) - if c_d != '' && (s:IsAbsolutePath(home) != 2) - if match(g:proj_flags, '\CL') != -1 - call s:SetupAutoCommand(c_d) - endif - if !isdirectory(glob(c_d)) - call confirm("From this fold's entry,\nCD=".'"'.c_d.'" is not a valid directory.', "&OK", 1) - else - silent exec cd_cmd.' '.c_d - endif - endif - " Extract any scriptin information - let scriptin = s:GetScriptin(a:infoline, home) - if scriptin != '' - if !filereadable(glob(scriptin)) - call confirm('"'.scriptin.'" not found. Ignoring.', "&OK", 1) - else - call s:SetupScriptAutoCommand('BufEnter', scriptin) - exec 'source '.scriptin - endif - endif - let scriptout = s:GetScriptout(a:infoline, home) - if scriptout != '' - if !filereadable(glob(scriptout)) - call confirm('"'.scriptout.'" not found. Ignoring.', "&OK", 1) - else - call s:SetupScriptAutoCommand('BufLeave', scriptout) - endif - endif - return 1 - endfunction - ">>> - " s:DoFoldOrOpenEntry(cmd0, cmd1) <<< - " Used for double clicking. If the mouse is on a fold, open/close it. If - " not, try to open the file. - function! s:DoFoldOrOpenEntry(cmd0, cmd1) - if getline('.')=~'{\|}' || foldclosed('.') != -1 - normal! za - else - call s:DoEnsurePlacementSize_au() - call s:OpenEntry(line('.'), a:cmd0, a:cmd1, 0) - if (match(g:proj_flags, '\Cc') != -1) - let g:proj_mywinnumber = winbufnr(0) - Project - hide - if(g:proj_mywinnumber != winbufnr(0)) - wincmd p - endif - wincmd = - endif - endif - endfunction ">>> - " s:VimDirListing(filter, padding, separator, filevariable, filecount, dirvariable, dircount) <<< - function! s:VimDirListing(filter, padding, separator, filevariable, filecount, dirvariable, dircount) - let end = 0 - let files='' - let filter = a:filter - " Chop up the filter - " Apparently glob() cannot take something like this: glob('*.c *.h') - let while_var = 1 - while while_var - let end = stridx(filter, ' ') - if end == -1 - let end = strlen(filter) - let while_var = 0 - endif - let single=glob(strpart(filter, 0, end)) - if strlen(single) != 0 - let files = files.single."\010" - endif - let filter = strpart(filter, end + 1) - endwhile - " files now contains a list of everything in the directory. We need to - " weed out the directories. - let fnames=files - let {a:filevariable}='' - let {a:dirvariable}='' - let {a:filecount}=0 - let {a:dircount}=0 - while strlen(fnames) > 0 - let fname = substitute(fnames, '\(\(\f\|[ :\[\]]\)*\).*', '\1', '') - let fnames = substitute(fnames, '\(\f\|[ :\[\]]\)*.\(.*\)', '\2', '') - if isdirectory(glob(fname)) - let {a:dirvariable}={a:dirvariable}.a:padding.fname.a:separator - let {a:dircount}={a:dircount} + 1 - else - let {a:filevariable}={a:filevariable}.a:padding.fname.a:separator - let {a:filecount}={a:filecount} + 1 - endif - endwhile - endfunction ">>> - " s:GenerateEntry(recursive, name, absolute_dir, dir, c_d, filter_directive, filter, foldlev, sort) <<< - function! s:GenerateEntry(recursive, line, name, absolute_dir, dir, c_d, filter_directive, filter, foldlev, sort) - let line=a:line - if a:dir =~ '\\ ' - let dir='"'.substitute(a:dir, '\\ ', ' ', 'g').'"' - else - let dir=a:dir - endif - let spaces=strpart(' ', 0, a:foldlev) - let c_d=(strlen(a:c_d) > 0) ? 'CD='.a:c_d.' ' : '' - let c_d=(strlen(a:filter_directive) > 0) ? c_d.'filter="'.a:filter_directive.'" ': c_d - call append(line, spaces.'}') - call append(line, spaces.a:name.'='.dir.' '.c_d.'{') - if a:recursive - exec 'cd '.a:absolute_dir - call s:VimDirListing("*", '', "\010", 'b:files', 'b:filecount', 'b:dirs', 'b:dircount') - cd - - let dirs=b:dirs - let dcount=b:dircount - unlet b:files b:filecount b:dirs b:dircount - while dcount > 0 - let dname = substitute(dirs, '\(\( \|\f\|:\)*\).*', '\1', '') - let edname = escape(dname, ' ') - let dirs = substitute(dirs, '\( \|\f\|:\)*.\(.*\)', '\2', '') - let line=s:GenerateEntry(1, line + 1, dname, a:absolute_dir.'/'.edname, edname, '', '', a:filter, a:foldlev+1, a:sort) - let dcount=dcount-1 - endwhile - endif - return line+1 - endfunction " >>> - " s:DoEntryFromDir(line, name, absolute_dir, dir, c_d, filter_directive, filter, foldlev, sort) <<< - " Generate the fold from the directory hierarchy (if recursive), then - " fill it in with RefreshEntriesFromDir() - function! s:DoEntryFromDir(recursive, line, name, absolute_dir, dir, c_d, filter_directive, filter, foldlev, sort) - call s:GenerateEntry(a:recursive, a:line, a:name, escape(a:absolute_dir, ' '), escape(a:dir, ' '), escape(a:c_d, ' '), a:filter_directive, a:filter, a:foldlev, a:sort) - normal! j - call s:RefreshEntriesFromDir(1) - endfunction ">>> - " s:CreateEntriesFromDir(recursive) <<< - " Prompts user for information and then calls s:DoEntryFromDir() - function! s:CreateEntriesFromDir(recursive) - " Save a mark for the current cursor position - normal! mk - let line=line('.') - let name = inputdialog('Enter the Name of the Entry: ') - if strlen(name) == 0 - return - endif - let foldlev=foldlevel(line) - if (foldclosed(line) != -1) || (getline(line) =~ '}') - let foldlev=foldlev - 1 - endif - let absolute = (foldlev <= 0)?'Absolute ': '' - let home='' - let filter='*' - if (match(g:proj_flags, '\Cb') != -1) && has('browse') - " Note that browse() is inconsistent: On Win32 you can't select a - " directory, and it gives you a relative path. - let dir = browse(0, 'Enter the '.absolute.'Directory to Load: ', '', '') - let dir = fnamemodify(dir, ':p') - else - let dir = inputdialog('Enter the '.absolute.'Directory to Load: ', '') - endif - if (dir[strlen(dir)-1] == '/') || (dir[strlen(dir)-1] == '\\') - let dir=strpart(dir, 0, strlen(dir)-1) " Remove trailing / or \ - endif - let dir = substitute(dir, '^\~', $HOME, 'g') - if (foldlev > 0) - let parent_directive=s:RecursivelyConstructDirectives(line) - let filter = s:GetFilter(parent_directive, '*') - let home=s:GetHome(parent_directive, '') - if home[strlen(home)-1] != '/' && home[strlen(home)-1] != '\\' - let home=home.'/' - endif - unlet parent_directive - if s:IsAbsolutePath(dir) - " It is not a relative path Try to make it relative - let hend=matchend(dir, '\C'.glob(home)) - if hend != -1 - let dir=strpart(dir, hend) " The directory can be a relative path - else - let home="" - endif - endif - endif - if strlen(home.dir) == 0 - return - endif - if !isdirectory(home.dir) - if has("unix") - silent exec '!mkdir '.home.dir.' > /dev/null' - else - call confirm('"'.home.dir.'" is not a valid directory.', "&OK", 1) - return - endif - endif - let c_d = inputdialog('Enter the CD parameter: ', '') - let filter_directive = inputdialog('Enter the File Filter: ', '') - if strlen(filter_directive) != 0 - let filter = filter_directive - endif - " If I'm on a closed fold, go to the bottom of it - if foldclosedend(line) != -1 - let line = foldclosedend(line) - endif - let foldlev = foldlevel(line) - " If we're at the end of a fold . . . - if getline(line) =~ '}' - let foldlev = foldlev - 1 " . . . decrease the indentation by 1. - endif - " Do the work - call s:DoEntryFromDir(a:recursive, line, name, home.dir, dir, c_d, filter_directive, filter, foldlev, 0) - " Restore the cursor position - normal! `k - endfunction ">>> - " s:RefreshEntriesFromDir(recursive) <<< - " Finds metadata at the top of the fold, and then replaces all files - " with the contents of the directory. Works recursively if recursive is 1. - function! s:RefreshEntriesFromDir(recursive) - if foldlevel('.') == 0 - echo 'Nothing to refresh.' - return - endif - " Open the fold. - if getline('.') =~ '}' - normal! zo[z - else - normal! zo]z[z - endif - let just_a_fold=0 - let infoline = s:RecursivelyConstructDirectives(line('.')) - let immediate_infoline = getline('.') - if strlen(substitute(immediate_infoline, '[^=]*=\(\(\f\|:\|\\ \)*\).*', '\1', '')) == strlen(immediate_infoline) - let just_a_fold = 1 - endif - " Extract the home directory of the fold - let home = s:GetHome(infoline, '') - if home == '' - " No Match. This means that this is just a label with no - " directory entry. - if a:recursive == 0 - return " We're done--nothing to do - endif - " Mark that it is just a fold, so later we don't delete filenames - " that aren't there. - let just_a_fold = 1 - endif - if just_a_fold == 0 - " Extract the filter between quotes (we don't care what CD is). - let filter = s:GetFilter(infoline, '*') - " Extract the description (name) of the fold - let name = substitute(infoline, '^[#\t ]*\([^=]*\)=.*', '\1', '') - if strlen(name) == strlen(infoline) - return " If there's no name, we're done. - endif - if (home == '') || (name == '') - return - endif - " Extract the flags - let flags = s:GetFlags(immediate_infoline) - let sort = (match(g:proj_flags, '\CS') != -1) - if flags != '' - if match(flags, '\Cr') != -1 - " If the flags do not contain r (refresh), then treat it just - " like a fold - let just_a_fold = 1 - endif - if match(flags, '\CS') != -1 - let sort = 1 - endif - if match(flags, '\Cs') != -1 - let sort = 0 - endif - else - let flags='' - endif - endif - " Move to the first non-fold boundary line - normal! j - " Delete filenames until we reach the end of the fold - while getline('.') !~ '}' - if line('.') == line('$') - break - endif - if getline('.') !~ '{' - " We haven't reached a sub-fold, so delete what's there. - if (just_a_fold == 0) && (getline('.') !~ '^\s*#') && (getline('.') !~ '#.*pragma keep') - d _ - else - " Skip lines only in a fold and comment lines - normal! j - endif - else - " We have reached a sub-fold. If we're doing recursive, then - " call this function again. If not, find the end of the fold. - if a:recursive == 1 - call s:RefreshEntriesFromDir(1) - normal! ]zj - else - if foldclosed('.') == -1 - normal! zc - endif - normal! j - endif - endif - endwhile - if just_a_fold == 0 - " We're not just in a fold, and we have deleted all the filenames. - " Now it is time to regenerate what is in the directory. - if !isdirectory(glob(home)) - call confirm('"'.home.'" is not a valid directory.', "&OK", 1) - else - let foldlev=foldlevel('.') - " T flag. Thanks Tomas Z. - if (match(flags, '\Ct') != -1) || ((match(g:proj_flags, '\CT') == -1) && (match(flags, '\CT') == -1)) - " Go to the top of the fold (force other folds to the - " bottom) - normal! [z - normal! j - " Skip any comments - while getline('.') =~ '^\s*#' - normal! j - endwhile - endif - normal! k - let cwd=getcwd() - let spaces=strpart(' ', 0, foldlev) - exec 'cd '.home - if match(g:proj_flags, '\Ci') != -1 - echon home."\r" - endif - call s:VimDirListing(filter, spaces, "\n", 'b:files', 'b:filecount', 'b:dirs', 'b:dircount') - if b:filecount > 0 - normal! mk - silent! put =b:files - normal! `kj - if sort - call s:SortR(line('.'), line('.') + b:filecount - 1) - endif - else - normal! j - endif - unlet b:files b:filecount b:dirs b:dircount - exec 'cd '.cwd - endif - endif - " Go to the top of the refreshed fold. - normal! [z - endfunction ">>> - " s:MoveUp() <<< - " Moves the entity under the cursor up a line. - function! s:MoveUp() - let lineno=line('.') - if lineno == 1 - return - endif - let fc=foldclosed('.') - let a_reg=@a - if lineno == line('$') - normal! "add"aP - else - normal! "addk"aP - endif - let @a=a_reg - if fc != -1 - normal! zc - endif - endfunction ">>> - " s:MoveDown() <<< - " Moves the entity under the cursor down a line. - function! s:MoveDown() - let fc=foldclosed('.') - let a_reg=@a - normal! "add"ap - let @a=a_reg - if (fc != -1) && (foldclosed('.') == -1) - normal! zc - endif - endfunction " >>> - " s:DisplayInfo() <<< - " Displays filename and current working directory when i (info) is in - " the flags. - function! s:DisplayInfo() - if match(g:proj_flags, '\Ci') != -1 - echo 'file: '.expand('%').', cwd: '.getcwd().', lines: '.line('$') - endif - endfunction ">>> - " s:SetupAutoCommand(cwd) <<< - " Sets up an autocommand to ensure that the cwd is set to the one - " desired for the fold regardless. :lcd only does this on a per-window - " basis, not a per-buffer basis. - function! s:SetupAutoCommand(cwd) - if !exists("b:proj_has_autocommand") - let b:proj_cwd_save = escape(getcwd(), ' ') - let b:proj_has_autocommand = 1 - let bufname=escape(substitute(expand('%:p', 0), '\\', '/', 'g'), ' ') - exec 'au BufEnter '.bufname." let b:proj_cwd_save=escape(getcwd(), ' ') | cd ".a:cwd - exec 'au BufLeave '.bufname.' exec "cd ".b:proj_cwd_save' - exec 'au BufWipeout '.bufname.' au! * '.bufname - endif - endfunction ">>> - " s:SetupScriptAutoCommand(bufcmd, script) <<< - " Sets up an autocommand to run the scriptin script. - function! s:SetupScriptAutoCommand(bufcmd, script) - if !exists("b:proj_has_".a:bufcmd) - let b:proj_has_{a:bufcmd} = 1 - exec 'au '.a:bufcmd.' '.escape(substitute(expand('%:p', 0), '\\', '/', 'g'), ' ').' source '.a:script - endif - endfunction " >>> - " s:DoEnsurePlacementSize_au() <<< - " Ensure that the Project window is on the left of the window and has - " the correct size. Only called from an autocommand - function! s:DoEnsurePlacementSize_au() - if (winbufnr(0) != g:proj_running) || (winnr() != 1) - if exists("g:proj_doinghelp") - if g:proj_doinghelp > 0 - let g:proj_doinghelp = g:proj_doinghelp - 1 - return - endif - unlet g:proj_doinghelp - return - endif - exec b:proj_locate_command - endif - exec b:proj_resize_command - endfunction ">>> - " s:Spawn(number) <<< - " Spawn an external command on the file - function! s:Spawn(number) - echo | if exists("g:proj_run".a:number) - let fname=getline('.') - if fname!~'{\|}' - let fname=substitute(fname, '\s*#.*', '', '') - let fname=substitute(fname, '^\s*\(.*\)\s*', '\1', '') - if fname == '' | return | endif - let parent_infoline = s:RecursivelyConstructDirectives(line('.')) - let home=expand(s:GetHome(parent_infoline, '')) - let c_d=expand(s:GetCd(parent_infoline, '')) - let command=substitute(g:proj_run{a:number}, '%%', "\010", 'g') - let command=substitute(command, '%f', escape(home.'/'.fname, '\'), 'g') - let command=substitute(command, '%F', substitute(escape(home.'/'.fname, '\'), ' ', '\\\\ ', 'g'), 'g') - let command=substitute(command, '%s', escape(home.'/'.fname, '\'), 'g') - let command=substitute(command, '%n', escape(fname, '\'), 'g') - let command=substitute(command, '%N', substitute(fname, ' ', '\\\\ ', 'g'), 'g') - let command=substitute(command, '%h', escape(home, '\'), 'g') - let command=substitute(command, '%H', substitute(escape(home, '\'), ' ', '\\\\ ', 'g'), 'g') - if c_d != '' - if c_d == home - let percent_r='.' - else - let percent_r=substitute(home, escape(c_d.'/', '\'), '', 'g') - endif - else - let percent_r=home - endif - let command=substitute(command, '%r', percent_r, 'g') - let command=substitute(command, '%R', substitute(percent_r, ' ', '\\\\ ', 'g'), 'g') - let command=substitute(command, '%d', escape(c_d, '\'), 'g') - let command=substitute(command, '%D', substitute(escape(c_d, '\'), ' ', '\\\\ ', 'g'), 'g') - let command=substitute(command, "\010", '%', 'g') - exec command - endif - endif - endfunction ">>> - " s:ListSpawn(varnamesegment) <<< - " List external commands - function! s:ListSpawn(varnamesegment) - let number = 1 - while number < 10 - if exists("g:proj_run".a:varnamesegment.number) - echohl LineNr | echo number.':' | echohl None | echon ' '.substitute(escape(g:proj_run{a:varnamesegment}{number}, '\'), "\n", '\\n', 'g') - else - echohl LineNr | echo number.':' | echohl None - endif - let number=number + 1 - endwhile - endfunction ">>> - " s:FindFoldTop(line) <<< - " Return the line number of the directive line - function! s:FindFoldTop(line) - let lineno=a:line - if getline(lineno) =~ '}' - let lineno = lineno - 1 - endif - while getline(lineno) !~ '{' && lineno > 1 - if getline(lineno) =~ '}' - let lineno=s:FindFoldTop(lineno) - endif - let lineno = lineno - 1 - endwhile - return lineno - endfunction ">>> - " s:FindFoldBottom(line) <<< - " Return the line number of the directive line - function! s:FindFoldBottom(line) - let lineno=a:line - if getline(lineno) =~ '{' - let lineno=lineno + 1 - endif - while getline(lineno) !~ '}' && lineno < line('$') - if getline(lineno) =~ '{' - let lineno=s:FindFoldBottom(lineno) - endif - let lineno = lineno + 1 - endwhile - return lineno - endfunction ">>> - " s:LoadAll(recurse, line) <<< - " Load all files in a project - function! s:LoadAll(recurse, line) - let b:loadcount=0 - function! s:SpawnExec(infoline, fname, lineno, data) - if s:OpenEntry2(a:lineno, a:infoline, a:fname, 'e') - wincmd p - let b:loadcount=b:loadcount+1 - echon b:loadcount."\r" - if getchar(0) != 0 - let b:stop_everything=1 - endif - endif - endfunction - call Project_ForEach(a:recurse, line('.'), "*SpawnExec", 0, '^\(.*l\)\@!') - delfunction s:SpawnExec - echon b:loadcount." Files Loaded\r" - unlet b:loadcount - if exists("b:stop_everything") | unlet b:stop_everything | endif - endfunction ">>> - " s:WipeAll(recurse, line) <<< - " Wipe all files in a project - function! s:WipeAll(recurse, line) - let b:wipecount=0 - let b:totalcount=0 - function! s:SpawnExec(home, c_d, fname, lineno, data) - let fname=escape(a:fname, ' ') - if s:IsAbsolutePath(fname) - let fname=fnamemodify(fname, ':n') " :n is coming, won't break anything now - else - let fname=fnamemodify(a:home.'/'.fname, ':n') " :n is coming, won't break anything now - endif - let b:totalcount=b:totalcount+1 - let fname=substitute(fname, '^\~', $HOME, 'g') - if bufloaded(substitute(fname, '\\ ', ' ', 'g')) - if getbufvar(fname.'\>', '&modified') == 1 - exec 'sb '.fname - wincmd L - w - wincmd p - endif - let b:wipecount=b:wipecount+1 - exec 'bwipe! '.fname - endif - if b:totalcount % 5 == 0 - echon b:wipecount.' of '.b:totalcount."\r" - redraw - endif - if getchar(0) != 0 - let b:stop_everything=1 - endif - endfunction - call Project_ForEach(a:recurse, line('.'), "SpawnExec", 0, '^\(.*w\)\@!') - delfunction s:SpawnExec - echon b:wipecount.' of '.b:totalcount." Files Wiped\r" - unlet b:wipecount b:totalcount - if exists("b:stop_everything") | unlet b:stop_everything | endif - endfunction ">>> - " s:LoadAllSplit(recurse, line) <<< - " Load all files in a project using split windows. - " Contributed by A. Harrison - function! s:LoadAllSplit(recurse, line) - let b:loadcount=0 - function! s:SpawnExec(infoline, fname, lineno, data) - let winNr = winnr() "get ProjectWindow number - if s:OpenEntry2(a:lineno, a:infoline, a:fname, 'sp') - exec winNr."wincmd w" - let b:loadcount=b:loadcount+1 - echon b:loadcount."\r" - if getchar(0) != 0 - let b:stop_everything=1 - endif - endif - endfunction - call Project_ForEach(a:recurse, line('.'), "*SpawnExec", 0, '^\(.*l\)\@!') - delfunction s:SpawnExec - echon b:loadcount." Files Loaded\r" - unlet b:loadcount - if exists("b:stop_everything") | unlet b:stop_everything | endif - endfunction ">>> - " s:GrepAll(recurse, lineno, pattern) <<< - " Grep all files in a project, optionally recursively - function! s:GrepAll(recurse, lineno, pattern) - cunmap help - let pattern=(a:pattern[0] == '')?input("GREP options and pattern: "):a:pattern - cnoremap help let g:proj_doinghelp = 1:help - if pattern[0] == '' - return - endif - let b:escape_spaces=1 - let fnames=Project_GetAllFnames(a:recurse, a:lineno, ' ') - unlet b:escape_spaces - cclose " Make sure grep window is closed - call s:DoSetupAndSplit() - if match(g:proj_flags, '\Cv') == -1 - silent! exec 'silent! grep '.pattern.' '.fnames - if v:shell_error != 0 - echo 'GREP error. Perhaps there are too many filenames.' - else - copen - endif - else - silent! exec 'silent! vimgrep '.pattern.' '.fnames - copen - endif - endfunction ">>> - " GetXXX Functions <<< - function! s:GetHome(info, parent_home) - " Thanks to Adam Montague for pointing out the need for @ in urls. - let home=substitute(a:info, '^[^=]*=\(\(\\ \|\f\|:\|@\)\+\).*', '\1', '') - if strlen(home) == strlen(a:info) - let home=substitute(a:info, '.\{-}"\(.\{-}\)".*', '\1', '') - if strlen(home) != strlen(a:info) | let home=escape(home, ' ') | endif - endif - if strlen(home) == strlen(a:info) - let home=a:parent_home - elseif home=='.' - let home=a:parent_home - elseif !s:IsAbsolutePath(home) - let home=a:parent_home.'/'.home - endif - return home - endfunction - function! s:GetFilter(info, parent_filter) - let filter = substitute(a:info, '.*\>> - " Project_GetAllFnames(recurse, lineno, separator) <<< - " Grep all files in a project, optionally recursively - function! Project_GetAllFnames(recurse, lineno, separator) - let b:fnamelist='' - function! s:SpawnExec(home, c_d, fname, lineno, data) - if exists('b:escape_spaces') - let fname=escape(a:fname, ' ') - else - let fname=a:fname - endif - if !s:IsAbsolutePath(a:fname) - let fname=a:home.'/'.fname - endif - let b:fnamelist=b:fnamelist.a:data.fname - endfunction - call Project_ForEach(a:recurse, line('.'), "SpawnExec", a:separator, '') - delfunction s:SpawnExec - let retval=b:fnamelist - unlet b:fnamelist - return retval - endfunction ">>> - " Project_GetAllFnames(recurse, lineno, separator) <<< - " Grep all files in a project, optionally recursively - function! Project_GetFname(line) - if (foldlevel(a:line) == 0) - return '' - endif - let fname=substitute(getline(a:line), '\s*#.*', '', '') " Get rid of comments and whitespace before comment - let fname=substitute(fname, '^\s*\(.*\)', '\1', '') " Get rid of leading whitespace - if strlen(fname) == 0 - return '' " The line is blank. Do nothing. - endif - if s:IsAbsolutePath(fname) - return fname - endif - let infoline = s:RecursivelyConstructDirectives(a:line) - return s:GetHome(infoline, '').'/'.fname - endfunction ">>> - " Project_ForEach(recurse, lineno, cmd, data, match) <<< - " Grep all files in a project, optionally recursively - function! Project_ForEach(recurse, lineno, cmd, data, match) - let info=s:RecursivelyConstructDirectives(a:lineno) - let lineno=s:FindFoldTop(a:lineno) + 1 - let flags=s:GetFlags(getline(lineno - 1)) - if (flags == '') || (a:match=='') || (match(flags, a:match) != -1) - call s:Project_ForEachR(a:recurse, lineno, info, a:cmd, a:data, a:match) - endif - endfunction - function! s:Project_ForEachR(recurse, lineno, info, cmd, data, match) - let home=s:GetHome(a:info, '') - let c_d=s:GetCd(a:info, home) - let scriptin = s:GetScriptin(a:info, home) - let scriptout = s:GetScriptout(a:info, home) - let filter = s:GetFilter(a:info, '') - let lineno = a:lineno - let curline=getline(lineno) - while (curline !~ '}') && (curline < line('$')) - if exists("b:stop_everything") && b:stop_everything | return 0 | endif - if curline =~ '{' - if a:recurse - let flags=s:GetFlags(curline) - if (flags == '') || (a:match=='') || (match(flags, a:match) != -1) - let this_home=s:GetHome(curline, home) - let this_cd=s:GetCd(curline, this_home) - if this_cd=='' | let this_cd=c_d | endif - let this_scriptin=s:GetScriptin(curline, this_home) - if this_scriptin == '' | let this_scriptin=scriptin | endif - let this_scriptout=s:GetScriptin(curline, this_home) - if this_scriptout == '' | let this_scriptout=scriptout | endif - let this_filter=s:GetFilter(curline, filter) - let lineno=s:Project_ForEachR(1, lineno+1, - \s:ConstructInfo(this_home, this_cd, this_scriptin, this_scriptout, flags, this_filter), a:cmd, a:data, a:match) - else - let lineno=s:FindFoldBottom(lineno) - endif - else - let lineno=s:FindFoldBottom(lineno) - endif - else - let fname=substitute(curline, '\s*#.*', '', '') - let fname=substitute(fname, '^\s*\(.*\)', '\1', '') - if (strlen(fname) != strlen(curline)) && (fname[0] != '') - if a:cmd[0] == '*' - call {strpart(a:cmd, 1)}(a:info, fname, lineno, a:data) - else - call {a:cmd}(home, c_d, fname, lineno, a:data) - endif - endif - endif - let lineno=lineno + 1 - let curline=getline(lineno) - endwhile - return lineno - endfunction ">>> - " s:SpawnAll(recurse, number) <<< - " Spawn an external command on the files of a project - function! s:SpawnAll(recurse, number) - echo | if exists("g:proj_run_fold".a:number) - if g:proj_run_fold{a:number}[0] == '*' - function! s:SpawnExec(home, c_d, fname, lineno, data) - let command=substitute(strpart(g:proj_run_fold{a:data}, 1), '%s', escape(a:fname, ' \'), 'g') - let command=substitute(command, '%f', escape(a:fname, '\'), 'g') - let command=substitute(command, '%h', escape(a:home, '\'), 'g') - let command=substitute(command, '%d', escape(a:c_d, '\'), 'g') - let command=substitute(command, '%F', substitute(escape(a:fname, '\'), ' ', '\\\\ ', 'g'), 'g') - exec command - endfunction - call Project_ForEach(a:recurse, line('.'), "SpawnExec", a:number, '.') - delfunction s:SpawnExec - else - let info=s:RecursivelyConstructDirectives(line('.')) - let home=s:GetHome(info, '') - let c_d=s:GetCd(info, '') - let b:escape_spaces=1 - let fnames=Project_GetAllFnames(a:recurse, line('.'), ' ') - unlet b:escape_spaces - let command=substitute(g:proj_run_fold{a:number}, '%f', substitute(escape(fnames, '\'), '\\ ', ' ', 'g'), 'g') - let command=substitute(command, '%s', escape(fnames, '\'), 'g') - let command=substitute(command, '%h', escape(home, '\'), 'g') - let command=substitute(command, '%d', escape(c_d, '\'), 'g') - let command=substitute(command, '%F', escape(fnames, '\'), 'g') - exec command - if v:shell_error != 0 - echo 'Shell error. Perhaps there are too many filenames.' - endif - endif - endif - endfunction ">>> - if !exists("g:proj_running") - " s:DoProjectOnly(void) <<< - " Make the file window the only one. - function! s:DoProjectOnly() - if winbufnr(0) != g:proj_running - let lzsave=&lz - set lz - only - Project - silent! wincmd p - let &lz=lzsave - unlet lzsave - endif - endfunction - " >>> - - " Mappings <<< - nnoremap \|:call DoFoldOrOpenEntry('', 'e') - nnoremap \|:call DoFoldOrOpenEntry('', 'sp') - nnoremap \|:call DoFoldOrOpenEntry('silent! only', 'e') - nnoremap T \|:call DoFoldOrOpenEntry('', 'tabe') - nmap s - nnoremap S \|:call LoadAllSplit(0, line('.')) - nmap o - nnoremap i :echo RecursivelyConstructDirectives(line('.')) - nnoremap I :echo Project_GetFname(line('.')) - nmap p - nmap v - nnoremap l \|:call LoadAll(0, line('.')) - nnoremap L \|:call LoadAll(1, line('.')) - nnoremap w \|:call WipeAll(0, line('.')) - nnoremap W \|:call WipeAll(1, line('.')) - nnoremap W \|:call WipeAll(1, line('.')) - nnoremap g \|:call GrepAll(0, line('.'), "") - nnoremap G \|:call GrepAll(1, line('.'), "") - nnoremap <2-LeftMouse> \|:call DoFoldOrOpenEntry('', 'e') - nnoremap \|:call DoFoldOrOpenEntry('', 'sp') - nnoremap - nnoremap - nmap - nnoremap - nnoremap <3-LeftMouse> - nmap - nmap <2-RightMouse> - nmap <3-RightMouse> - nmap <4-RightMouse> - nnoremap \|:silent exec 'vertical resize '.(match(g:proj_flags, '\Ct')!=-1 && winwidth('.') > g:proj_window_width?(g:proj_window_width):(winwidth('.') + g:proj_window_increment)) - nnoremap \|:silent call MoveUp() - nnoremap \|:silent call MoveDown() - nmap - nmap - let k=1 - while k < 10 - exec 'nnoremap '.k.' \|:call Spawn('.k.')' - exec 'nnoremap f'.k.' \|:call SpawnAll(0, '.k.')' - exec 'nnoremap F'.k.' \|:call SpawnAll(1, '.k.')' - let k=k+1 - endwhile - nnoremap 0 \|:call ListSpawn("") - nnoremap f0 \|:call ListSpawn("_fold") - nnoremap F0 \|:call ListSpawn("_fold") - nnoremap c :call CreateEntriesFromDir(0) - nnoremap C :call CreateEntriesFromDir(1) - nnoremap r :call RefreshEntriesFromDir(0) - nnoremap R :call RefreshEntriesFromDir(1) - " For Windows users: same as \R - nnoremap :call RefreshEntriesFromDir(1) - nnoremap e :call OpenEntry(line('.'), '', '', 0) - nnoremap E :call OpenEntry(line('.'), '', 'e', 1) - " The :help command stomps on the Project Window. Try to avoid that. - " This is not perfect, but it is alot better than without the mappings. - cnoremap help let g:proj_doinghelp = 1:help - nnoremap :let g:proj_doinghelp = 1 - " This is to avoid changing the buffer, but it is not fool-proof. - nnoremap - "nnoremap