" Vim filetype plugin file " " Language : bash " Plugin : bash-support.vim " Maintainer : Fritz Mehner " Version : 2.10 " Revision : $Id: sh.vim,v 1.21 2009/01/30 14:23:10 mehner Exp $ " " ----------------------------------------------------------------- " " Only do this when not done yet for this buffer " if exists("b:did_BASH_ftplugin") finish endif let b:did_BASH_ftplugin = 1 " " ---------- Do we have a mapleader other than '\' ? ------------ " if exists("g:BASH_MapLeader") let maplocalleader = g:BASH_MapLeader endif " let s:MSWIN = has("win16") || has("win32") || has("win64") || has("win95") " " ---------- BASH dictionary ----------------------------------- " " This will enable keyword completion for bash " using Vim's dictionary feature |i_CTRL-X_CTRL-K|. " if exists("g:BASH_Dictionary_File") silent! exec 'setlocal dictionary+='.g:BASH_Dictionary_File endif " " ---------- hot keys ------------------------------------------ " " Alt-F9 run syntax check " Ctrl-F9 update file and run script " Shift-F9 command line arguments " if has("gui_running") " map :call BASH_HelpBASHsupport() imap :call BASH_HelpBASHsupport() " map :call BASH_SyntaxCheck() imap :call BASH_SyntaxCheck() " map :call BASH_Run("n") imap :call BASH_Run("n") if !s:MSWIN vmap :call BASH_Run("v") endif " map :call BASH_CmdLineArguments() imap :call BASH_CmdLineArguments() endif " if !s:MSWIN map :call BASH_Debugger():redraw! imap :call BASH_Debugger():redraw! endif " " " ---------- help ---------------------------------------------------- " noremap hh :call BASH_help('h') inoremap hh :call BASH_help('h') " noremap hm :call BASH_help('m') inoremap hm :call BASH_help('m') " noremap hp :call BASH_HelpBASHsupport() inoremap hp :call BASH_HelpBASHsupport() " " ---------- comment menu ---------------------------------------------------- " noremap cl :call BASH_LineEndComment()A inoremap cl :call BASH_LineEndComment()A vnoremap cl :call BASH_MultiLineEndComments()A noremap cj :call BASH_AdjustLineEndComm("a") inoremap cj :call BASH_AdjustLineEndComm("a") vnoremap cj :call BASH_AdjustLineEndComm("v") noremap cs :call BASH_GetLineEndCommCol() inoremap cs :call BASH_GetLineEndCommCol() noremap cfr :call BASH_CommentTemplates('frame') inoremap cfr :call BASH_CommentTemplates('frame') noremap cfu :call BASH_CommentTemplates('function') inoremap cfu :call BASH_CommentTemplates('function') noremap ch :call BASH_CommentTemplates('header') inoremap ch :call BASH_CommentTemplates('header') noremap cc :call BASH_CommentToggle()j inoremap cc :call BASH_CommentToggle()j vnoremap cc :'<,'>call BASH_CommentToggle()j noremap cd a=BASH_InsertDateAndTime('d') inoremap cd =BASH_InsertDateAndTime('d') noremap ct a=BASH_InsertDateAndTime('dt') inoremap ct =BASH_InsertDateAndTime('dt') noremap ckb $:call BASH_CommentClassified("BUG") kJA noremap ckt $:call BASH_CommentClassified("TODO") kJA noremap ckr $:call BASH_CommentClassified("TRICKY") kJA noremap ckw $:call BASH_CommentClassified("WARNING") kJA noremap ckn $:call BASH_CommentClassified("") kJf:a noremap ce ^iecho""j' noremap cr 0:s/^\s*echo\s\+\"// \| s/\s*\"\s*$// \| :normal ==j' noremap cv :call BASH_CommentVimModeline() inoremap ckb $:call BASH_CommentClassified("BUG") kJA inoremap ckt $:call BASH_CommentClassified("TODO") kJA inoremap ckr $:call BASH_CommentClassified("TRICKY") kJA inoremap ckw $:call BASH_CommentClassified("WARNING") kJA inoremap ckn $:call BASH_CommentClassified("") kJf:a inoremap ce ^iecho""j' inoremap cr 0:s/^\s*echo\s\+\"// \| s/\s*\"\s*$// \| :normal ==j' inoremap cv :call BASH_CommentVimModeline() " " ---------- statement menu ---------------------------------------------------- " noremap sc ocase in);;);;*);;esac # --- end of case ---11kfa inoremap sc ocase in);;);;*);;esac # --- end of case ---11kfa noremap sl :call BASH_FlowControl( "elif _ ", "then", "", "a" )i inoremap sl :call BASH_FlowControl( "elif _ ", "then", "", "a" )i noremap sf :call BASH_FlowControl( "for _ in ", "do", "done", "a" )i inoremap sf :call BASH_FlowControl( "for _ in ", "do", "done", "a" )i vnoremap sf :call BASH_FlowControl( "for _ in ", "do", "done", "v" ) noremap sfo :call BASH_FlowControl( "for (( COUNTER=0; COUNTER<_0; COUNTER++ ))", "do", "done", "a" ) inoremap sfo :call BASH_FlowControl( "for (( COUNTER=0; COUNTER<_0; COUNTER++ ))", "do", "done", "a" ) vnoremap sfo :call BASH_FlowControl( "for (( COUNTER=0; COUNTER<_0; COUNTER++ ))", "do", "done", "v" ) noremap si :call BASH_FlowControl( "if _ ", "then", "fi", "a" )i inoremap si :call BASH_FlowControl( "if _ ", "then", "fi", "a" )i vnoremap si :call BASH_FlowControl( "if _ ", "then", "fi", "v" ) noremap sie :call BASH_FlowControl( "if _ ", "then", "else\nfi", "a" )i inoremap sie :call BASH_FlowControl( "if _ ", "then", "else\nfi", "a" )i vnoremap sie :call BASH_FlowControl( "if _ ", "then", "else\nfi", "v" ) noremap ss :call BASH_FlowControl( "select _ in ", "do", "done", "a" )i inoremap ss :call BASH_FlowControl( "select _ in ", "do", "done", "a" )i vnoremap ss :call BASH_FlowControl( "select _ in ", "do", "done", "v" ) noremap st :call BASH_FlowControl( "until _ ", "do", "done", "a" )i inoremap st :call BASH_FlowControl( "until _ ", "do", "done", "a" )i vnoremap st :call BASH_FlowControl( "until _ ", "do", "done", "v" ) noremap sw :call BASH_FlowControl( "while _ ", "do", "done", "a" )i inoremap sw :call BASH_FlowControl( "while _ ", "do", "done", "a" )i vnoremap sw :call BASH_FlowControl( "while _ ", "do", "done", "v" ) noremap sfu :call BASH_CodeFunction("a")O inoremap sfu :call BASH_CodeFunction("a")O vnoremap sfu :call BASH_CodeFunction("v") noremap se ^iecho-e"\n"2hi inoremap se echo-e"\n"2hi vnoremap se secho-e"\n"2hP noremap sp ^iprintf"%s\n"2hi inoremap sp printf"%s\n"2hi vnoremap sp sprintf"%s\n"2hP " " ---------- snippet menu ---------------------------------------------------- " noremap nr :call BASH_CodeSnippets("r") noremap nw :call BASH_CodeSnippets("w") vnoremap nw :call BASH_CodeSnippets("wv") noremap ne :call BASH_CodeSnippets("e") " " ---------- run menu ---------------------------------------------------- " if !s:MSWIN map re :call BASH_MakeScriptExecutable() imap re :call BASH_MakeScriptExecutable() endif map rr :call BASH_Run("n") imap rr :call BASH_Run("n") map ra :call BASH_CmdLineArguments() imap ra :call BASH_CmdLineArguments() if !s:MSWIN map rc :call BASH_SyntaxCheck() imap rc :call BASH_SyntaxCheck() map rd :call BASH_Debugger():redraw! imap rd :call BASH_Debugger():redraw! vmap rr :call BASH_Run("v") if has("gui_running") map rt :call BASH_XtermSize() imap rt :call BASH_XtermSize() endif endif map rh :call BASH_Hardcopy("n") imap rh :call BASH_Hardcopy("n") vmap rh :call BASH_Hardcopy("v") " map rs :call BASH_Settings() imap rs :call BASH_Settings() if s:MSWIN map ro :call BASH_Toggle_Gvim_Xterm_MS() imap ro :call BASH_Toggle_Gvim_Xterm_MS() else map ro :call BASH_Toggle_Gvim_Xterm() imap ro :call BASH_Toggle_Gvim_Xterm() endif "------------------------------------------------------------------------------- " additional mapping : single quotes around a Word (non-whitespaces) " masks the normal mode command '' (jump to the position " before the latest jump) " additional mapping : double quotes around a Word (non-whitespaces) " additional mapping : parentheses around a word (word characters) "------------------------------------------------------------------------------- nnoremap '' ciW''P nnoremap "" ciW""P "nnoremap {{ ciw{}PF{