用户讨论:Corey:修订间差异
新页面: 我的一些设置保存,以后修改! plugin<br>---------------<br>taglist.vim<br>encode_japan.vim<br>readcsv.vim<br>NERD_commenter.vim<br>supertab.vim<br>util_corey.vim colors<br>... |
无编辑摘要 |
||
第37行: | 第37行: | ||
func SetHighlightCurrentLine()<br> call CancleHighlightCurrentLine()<br> hi CurrentLine ctermbg=darkgrey guibg=darkgrey term=NONE cterm=NONE gui=NONE<br> au! Cursorhold * exe 'match CurrentLine /\%' . line('.') . 'l.*/'<br> au! InsertEnter * match none<br> set ut=60<br>endfun | func SetHighlightCurrentLine()<br> call CancleHighlightCurrentLine()<br> hi CurrentLine ctermbg=darkgrey guibg=darkgrey term=NONE cterm=NONE gui=NONE<br> au! Cursorhold * exe 'match CurrentLine /\%' . line('.') . 'l.*/'<br> au! InsertEnter * match none<br> set ut=60<br>endfun | ||
" Section: Comment mapping setup {{{1<br>" ===========================================================================<br>" This is where the mappings calls are made that set up the commenting key<br>" mappings.<br>" set up the mappings to trim space at the line's end<br>execute 'nnoremap <silent>' . ',te' . ' :call TrimEndSpace()<cr>'<br>execute 'vnoremap <silent>' . ',te' . ' <ESC>:call TrimEndSpace()<cr>' | " Section: Comment mapping setup {{{1<br>" ===========================================================================<br>" This is where the mappings calls are made that set up the commenting key<br>" mappings.<br>" set up the mappings to trim space at the line's end<br>execute 'nnoremap <silent>' . ',te' . ' :call TrimEndSpace()<cr>'<br>execute 'vnoremap <silent>' . ',te' . ' <ESC>:call TrimEndSpace()<cr>' | ||
" set up the mappings to trim space line<br>execute 'nnoremap <silent>' . ',tl' . ' :call TrimSpaceLine()<cr>'<br>execute 'vnoremap <silent>' . ',tl' . ' <ESC>:call TrimSpaceLine()<cr>' | " set up the mappings to trim space line<br>execute 'nnoremap <silent>' . ',tl' . ' :call TrimSpaceLine()<cr>'<br>execute 'vnoremap <silent>' . ',tl' . ' <ESC>:call TrimSpaceLine()<cr>' | ||
" set up the mappings to Cancle and set Highlight Current Line<br>execute 'nnoremap <silent>' . 'mm' . ' :call CancleHighlightCurrentLine()<cr>'<br>execute 'vnoremap <silent>' . 'mm' . ' <ESC>:call CancleHighlightCurrentLine()<cr>' | " set up the mappings to Cancle and set Highlight Current Line<br>execute 'nnoremap <silent>' . 'mm' . ' :call CancleHighlightCurrentLine()<cr>'<br>execute 'vnoremap <silent>' . 'mm' . ' <ESC>:call CancleHighlightCurrentLine()<cr>' | ||
execute 'nnoremap <silent>' . 'mn' . ' :call SetHighlightCurrentLine()<cr>'<br>execute 'vnoremap <silent>' . 'mn' . ' <ESC>:call SetHighlightCurrentLine()<cr>' | execute 'nnoremap <silent>' . 'mn' . ' :call SetHighlightCurrentLine()<cr>'<br>execute 'vnoremap <silent>' . 'mn' . ' <ESC>:call SetHighlightCurrentLine()<cr>' | ||
execute 'nnoremap <silent>' . 'mv' . ' :call SetHighlightUnderLine()<cr>'<br>execute 'vnoremap <silent>' . 'mv' . ' <ESC>:call SetHighlightUnderLine()<cr>' | execute 'nnoremap <silent>' . 'mv' . ' :call SetHighlightUnderLine()<cr>'<br>execute 'vnoremap <silent>' . 'mv' . ' <ESC>:call SetHighlightUnderLine()<cr>' | ||
"NewTabpage<br>execute 'nnoremap <silent>' . 'tt' . ' :call NewTabpage()<cr>'<br>execute 'vnoremap <silent>' . 'tt' . ' <ESC>:call NewTabpage()<cr>' | "NewTabpage<br>execute 'nnoremap <silent>' . 'tt' . ' :call NewTabpage()<cr>'<br>execute 'vnoremap <silent>' . 'tt' . ' <ESC>:call NewTabpage()<cr>' | ||
" Section: Menu item setup {{{1<br>" ===========================================================================<br>"check if the user wants the menu to be displayed <br>if 1 != 0 | " Section: Menu item setup {{{1<br>" ===========================================================================<br>"check if the user wants the menu to be displayed <br>if 1 != 0 | ||
let menuRoot = '&Plugin.&util'<br> <br> execute 'menu <silent> '. menuRoot .'.-Sep- :'<br> execute 'nmenu <silent> '. menuRoot .'.Trim\ End\ Space<TAB>' .<br>escape(',te', '\') . ' :call TrimEndSpace()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Trim\ Space\ Line<TAB>' . <br>escape(',tl', '\') . ' :call TrimSpaceLine()<CR>' | let menuRoot = '&Plugin.&util'<br> <br> execute 'menu <silent> '. menuRoot .'.-Sep- :'<br> execute 'nmenu <silent> '. menuRoot .'.Trim\ End\ Space<TAB>' .<br>escape(',te', '\') . ' :call TrimEndSpace()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Trim\ Space\ Line<TAB>' . <br>escape(',tl', '\') . ' :call TrimSpaceLine()<CR>' | ||
execute 'menu <silent> '. menuRoot .'.-Sep2- :'<br> execute 'nmenu <silent> '. menuRoot .'.Cancle\ Highlight\ CurrentLine<TAB>' .<br> escape('mm', '\') . ' :call CancleHighlightCurrentLine()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Set\ Highlight\ CurrentLine<TAB>' .<br> escape('mn', '\') . ' :call SetHighlightCurrentLine()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Set\ Underline\ CurrentLine<TAB>' .<br> escape('mv', '\') . ' :call SetHighlightUnderLine()<CR>' | execute 'menu <silent> '. menuRoot .'.-Sep2- :'<br> execute 'nmenu <silent> '. menuRoot .'.Cancle\ Highlight\ CurrentLine<TAB>' .<br> escape('mm', '\') . ' :call CancleHighlightCurrentLine()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Set\ Highlight\ CurrentLine<TAB>' .<br> escape('mn', '\') . ' :call SetHighlightCurrentLine()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Set\ Underline\ CurrentLine<TAB>' .<br> escape('mv', '\') . ' :call SetHighlightUnderLine()<CR>' | ||
execute 'menu <silent> '. menuRoot .'.-Sep3- :'<br> execute 'nmenu <silent> '. menuRoot .'.New\ Tabpage<TAB>' . escape('tt', '\') .<br> ' :call NewTabpage()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Insert\ Number,\ 0\ Ahead<TAB>' .<br> escape(' ', '\') . ' :call Insert_0_Number()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Insert\ Number,\ No\ 0<TAB>' .<br> escape(' ', '\') . ' :call Insert_Number()<CR>' | execute 'menu <silent> '. menuRoot .'.-Sep3- :'<br> execute 'nmenu <silent> '. menuRoot .'.New\ Tabpage<TAB>' . escape('tt', '\') .<br> ' :call NewTabpage()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Insert\ Number,\ 0\ Ahead<TAB>' .<br> escape(' ', '\') . ' :call Insert_0_Number()<CR>'<br> execute 'nmenu <silent> '. menuRoot .'.Insert\ Number,\ No\ 0<TAB>' .<br> escape(' ', '\') . ' :call Insert_Number()<CR>' | ||
endif<br>" vim: set foldmethod=marker : | endif<br>" vim: set foldmethod=marker : | ||
---- | ---- | ||
gvimrc---------------------<br>set nowrap<br>set expandtab<br>set noignorecase<br>set guioptions+=b | |||
:call SetHighlightUnderLine() | :call SetHighlightUnderLine() | ||
第65行: | 第67行: | ||
"au GUIEnter * simalt ~x "maximum the initial window | "au GUIEnter * simalt ~x "maximum the initial window | ||
map <C-tab> :call SelectTabpage()<CR><br>map <F6> :call SaveP()<CR><br>map <F5> :call ReloadP()<CR><br>" input the tab, need to comment out [set expandtab]<br>inoremap <S-t> <tab> | map <C-tab> :call SelectTabpage()<CR><br>map <F6> :call SaveP()<CR><br>map <F5> :call ReloadP()<CR><br>" input the tab, need to comment out [set expandtab]<br>inoremap <S-t> <tab> | ||
if has("statusline")<br> set statusline=%<%f\ %h%m%r%=%{\"[\".<br> (&fenc==\"\"?&enc:&fenc).\"]\ \"}%k\ %-14.(%l,%c%V%)\ %P<br>endif<br>" ==========================================================================<br> | |||
# NSIS file to create a self-installing exe for Vim.<br># It requires NSIS version 2.0 or later.<br># Last change: 2004 May 02 | |||
# WARNING: if you make changes to this script, look out for $0 to be valid,<br># because uninstall deletes most files in $0. | |||
# Location of gvim_ole.exe, vimd32.exe, GvimExt/*, etc.<br>!define VIMSRC "..\src" | |||
# Location of runtime files<br>!define VIMRT ".." | |||
# Location of extra tools: diff.exe<br> !define VIMTOOLS ..\.. | |||
# Comment the next line if you don't have UPX.<br># Get it at http://upx.sourceforge.net<br># !define HAVE_UPX | |||
# comment the next line if you do not want to add Native Language Support<br>!define HAVE_NLS | |||
!define VER_MAJOR 7<br>!define VER_MINOR 1 | |||
# ----------- No configurable settings below this line ----------- | |||
!include UpgradeDLL.nsh # for VisVim.dll | |||
Name "Vim ${VER_MAJOR}.${VER_MINOR}"<br>OutFile gvim${VER_MAJOR}${VER_MINOR}.exe<br>CRCCheck force<br>SetCompressor lzma<br>SetDatablockOptimize on | |||
ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer."<br>DirText "Choose a directory to install Vim (must end in 'vim')"<br>Icon icons\vim_16i.ico<br># NSIS2 uses a different strategy with six diferent images in a strip...<br>#EnabledBitmap icons\enabled.bmp<br>#DisabledBitmap icons\disabled.bmp<br>UninstallText "This will uninstall Vim ${VER_MAJOR}.${VER_MINOR} from your system."<br>UninstallIcon icons\vim_uninst_16c.ico | |||
# On NSIS 2 using the BGGradient causes trouble on Windows 98, in combination<br># with the BringToFront.<br># BGGradient 004000 008200 FFFFFF<br>LicenseText "You should read the following before installing:"<br>LicenseData ${VIMRT}\doc\uganda.nsis.txt | |||
!ifdef HAVE_UPX<br> !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"<br>!endif | |||
# This adds '\vim' to the user choice automagically. The actual value is<br># obtained below with ReadINIStr.<br>InstallDir "$PROGRAMFILES\Vim" | |||
# Types of installs we can perform:<br>InstType Typical<br>InstType Minimal<br>InstType Full | |||
SilentInstall normal | |||
# These are the pages we use<br>Page license<br>Page components<br>Page directory "" "" CheckInstallDir<br>Page instfiles<br>UninstPage uninstConfirm<br>UninstPage instfiles | |||
##########################################################<br># Functions | |||
Function .onInit<br> MessageBox MB_YESNO|MB_ICONQUESTION \<br> "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \<br> IDYES NoAbort<br> Abort ; causes installer to quit.<br> NoAbort: | |||
# run the install program to check for already installed versions<br> SetOutPath $TEMP<br># File /oname=install.exe ${VIMSRC}\installw32.exe<br> File ${VIMRT}\install.exe<br> ExecWait "$TEMP\install.exe -uninstall-check"<br> Delete $TEMP\install.exe | |||
# We may have been put to the background when uninstall did something.<br> BringToFront | |||
# Install will have created a file for us that contains the directory where<br> # we should install. This is $VIM if it's set. This appears to be the only<br> # way to get the value of $VIM here!?<br> ReadINIStr $INSTDIR $TEMP\vimini.ini vimini dir<br> Delete $TEMP\vimini.ini | |||
# If ReadINIStr failed or did not find a path: use the default dir.<br> StrCmp $INSTDIR "" 0 IniOK<br> StrCpy $INSTDIR "$PROGRAMFILES\Vim"<br> IniOK: | |||
# Should check for the value of $VIM and use it. Unfortunately I don't know<br> # how to obtain the value of $VIM<br> # IfFileExists "$VIM" 0 No_Vim<br> # StrCpy $INSTDIR "$VIM"<br> # No_Vim: | |||
# User variables:<br> # $0 - holds the directory the executables are installed to<br> # $1 - holds the parameters to be passed to install.exe. Starts with OLE<br> # registration (since a non-OLE gvim will not complain, and we want to<br> # always register an OLE gvim).<br> # $2 - holds the names to create batch files for<br> StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"<br> StrCpy $1 "-register-OLE"<br> StrCpy $2 "gvim evim gview gvimdiff vimtutor" | |||
FunctionEnd | |||
Function .onUserAbort<br> MessageBox MB_YESNO|MB_ICONQUESTION "Abort install?" IDYES NoCancelAbort<br> Abort ; causes installer to not quit.<br> NoCancelAbort:<br>FunctionEnd | |||
# We only accept the directory if it ends in "vim". Using .onVerifyInstDir has<br># the disadvantage that the browse dialog is difficult to use.<br>Function CheckInstallDir<br> StrCpy $0 $INSTDIR 3 -3<br> StrCmp $0 "vim" PathGood<br> MessageBox MB_OK "The path must end in 'vim'."<br> Abort<br> PathGood:<br>FunctionEnd | |||
Function .onInstSuccess<br> WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe<br> MessageBox MB_YESNO|MB_ICONQUESTION \<br> "The installation process has been successfull. Happy Vimming! \<br> $\n$\n Do you want to see the README file now?" IDNO NoReadme<br> Exec '$0\gvim.exe -R "$0\README.txt"'<br> NoReadme:<br>FunctionEnd | |||
Function .onInstFailed<br> MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed. Better luck next time."<br>FunctionEnd | |||
Function un.onUnInstSuccess<br> MessageBox MB_OK|MB_ICONINFORMATION \<br> "Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system"<br>FunctionEnd | |||
Function un.GetParent<br> Exch $0 ; old $0 is on top of stack<br> Push $1<br> Push $2<br> StrCpy $1 -1<br> loop:<br> StrCpy $2 $0 1 $1<br> StrCmp $2 "" exit<br> StrCmp $2 "\" exit<br> IntOp $1 $1 - 1<br> Goto loop<br> exit:<br> StrCpy $0 $0 $1<br> Pop $2<br> Pop $1<br> Exch $0 ; put $0 on top of stack, restore $0 to original value<br>FunctionEnd | |||
##########################################################<br>Section "Vim executables and runtime files"<br> SectionIn 1 2 3 | |||
# we need also this here if the user changes the instdir<br> StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" | |||
SetOutPath $0<br> File ${VIMRT}\gvim.exe<br> File ${VIMRT}\install.exe<br> File ${VIMRT}\uninstal.exe<br> File ${VIMRT}\vimrun.exe<br> File ${VIMRT}\xxd.exe<br> File ${VIMRT}\diff.exe<br> File ${VIMRT}\vimtutor.bat<br> File ${VIMRT}\README.txt<br> File ${VIMRT}\uninstal.txt<br> File ${VIMRT}\*.vim<br> File ${VIMRT}\rgb.txt<br> File ${VIMRT}\ctags.exe<br> File ${VIMRT}\iconv.dll<br> File ${VIMRT}\intl2.dll<br> File ${VIMRT}\msvcr71.dll | |||
<br> SetOutPath $INSTDIR<br> File ${VIMRT}\gvimrc | |||
SetOutPath $0\colors<br> File ${VIMRT}\colors\*.* | |||
SetOutPath $0\compiler<br> File ${VIMRT}\compiler\*.* | |||
SetOutPath $0\doc<br> File ${VIMRT}\doc\*.txt<br> File ${VIMRT}\doc\tags | |||
SetOutPath $0\ftplugin<br> File ${VIMRT}\ftplugin\*.* | |||
SetOutPath $0\indent<br> File ${VIMRT}\indent\*.* | |||
SetOutPath $0\macros<br> File ${VIMRT}\macros\*.* | |||
SetOutPath $0\plugin<br> File ${VIMRT}\plugin\*.* | |||
SetOutPath $0\autoload<br> File ${VIMRT}\autoload\*.* | |||
SetOutPath $0\autoload\xml<br> File ${VIMRT}\autoload\xml\*.* | |||
SetOutPath $0\syntax<br> File ${VIMRT}\syntax\*.* | |||
SetOutPath $0\spell<br> File ${VIMRT}\spell\*.txt<br> File ${VIMRT}\spell\*.vim<br> File ${VIMRT}\spell\*.spl<br> File ${VIMRT}\spell\*.sug | |||
SetOutPath $0\tools<br> File ${VIMRT}\tools\*.* | |||
SetOutPath $0\tutor<br> File ${VIMRT}\tutor\*.*<br>SectionEnd | |||
##########################################################<br>Section "Vim console program (vim.exe)"<br> SectionIn 1 3 | |||
SetOutPath $0<br> ReadRegStr $R0 HKLM \<br> "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion<br> IfErrors 0 lbl_winnt<br> # Windows 95/98/ME<br> File ${VIMRT}\vim.exe<br> Goto lbl_done<br> lbl_winnt:<br> # Windows NT/2000/XT<br> File ${VIMRT}\vim.exe<br> lbl_done:<br> StrCpy $2 "$2 vim view vimdiff"<br>SectionEnd | |||
##########################################################<br>Section "Create .bat files for command line use"<br> SectionIn 3 | |||
StrCpy $1 "$1 -create-batfiles $2"<br>SectionEnd | |||
##########################################################<br>Section "Create icons on the Desktop"<br> SectionIn 1 3 | |||
StrCpy $1 "$1 -install-icons"<br>SectionEnd | |||
##########################################################<br>Section "Add Vim to the Start Menu"<br> SectionIn 1 3 | |||
StrCpy $1 "$1 -add-start-menu"<br>SectionEnd | |||
##########################################################<br>Section "Add an Edit-with-Vim context menu entry"<br> SectionIn 1 3 | |||
# Be aware of this sequence of events:<br> # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and<br> # is scheduled to be removed at next reboot.<br> # - user installs Vim in same directory, gvimext.dll still exists.<br> # If we now skip installing gvimext.dll, it will disappear at the next<br> # reboot. Thus when copying gvimext.dll fails always schedule it to be<br> # installed at the next reboot. Can't use UpgradeDLL!<br> # We don't ask the user to reboot, the old dll will keep on working.<br> SetOutPath $0<br> ClearErrors<br> SetOverwrite try<br> File ${VIMRT}\gvimext.dll<br> IfErrors 0 GvimExtDone | |||
# Can't copy gvimext.dll, create it under another name and rename it on<br> # next reboot.<br> GetTempFileName $3 $0<br> File /oname=$3 ${VIMRT}\gvimext.dll<br> Rename /REBOOTOK $3 $0\gvimext.dll | |||
GvimExtDone:<br> SetOverwrite lastused | |||
# We don't have a separate entry for the "Open With..." menu, assume<br> # the user wants either both or none.<br> StrCpy $1 "$1 -install-popup -install-openwith"<br>SectionEnd | |||
##########################################################<br>Section "Create a _vimrc if it doesn't exist"<br> SectionIn 1 3 | |||
StrCpy $1 "$1 -create-vimrc"<br>SectionEnd | |||
##########################################################<br>Section "Create plugin directories in HOME or VIM"<br> SectionIn 1 3 | |||
StrCpy $1 "$1 -create-directories home"<br>SectionEnd | |||
##########################################################<br>Section "Create plugin directories in VIM"<br> SectionIn 3 | |||
StrCpy $1 "$1 -create-directories vim"<br>SectionEnd | |||
##########################################################<br>Section "VisVim Extension for MS Visual Studio"<br> SectionIn 3 | |||
SetOutPath $0<br> !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"<br> File ${VIMSRC}\VisVim\README_VisVim.txt<br>SectionEnd | |||
##########################################################<br>!ifdef HAVE_NLS<br> Section "Native Language Support"<br> SectionIn 1 3 | |||
SetOutPath $0\lang<br> File /r ${VIMRT}\lang\*.*<br> SetOutPath $0\keymap<br> File ${VIMRT}\keymap\README.txt<br> File ${VIMRT}\keymap\*.vim<br> SetOutPath $0<br> File ${VIMRT}\libintl.dll<br> SectionEnd<br>!endif | |||
##########################################################<br>Section -call_install_exe<br> SetOutPath $0<br> ExecWait "$0\install.exe $1"<br>SectionEnd | |||
##########################################################<br>Section -post<br> BringToFront<br>SectionEnd | |||
##########################################################<br>Section Uninstall<br> # Apparently $INSTDIR is set to the directory where the uninstaller is<br> # created. Thus the "vim61" directory is included in it.<br> StrCpy $0 "$INSTDIR" | |||
# If VisVim was installed, unregister the DLL.<br> IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim<br> Has_VisVim:<br> ExecWait "regsvr32.exe /u /s $0\VisVim.dll" | |||
No_VisVim: | |||
# delete the context menu entry and batch files<br> ExecWait "$0\uninstal.exe -nsis" | |||
# We may have been put to the background when uninstall did something.<br> BringToFront | |||
# ask the user if the Vim version dir must be removed<br> MessageBox MB_YESNO|MB_ICONQUESTION \<br> "Would you like to delete $0?$\n \<br> $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes | |||
Delete /REBOOTOK $0\*.dll<br> ClearErrors<br> # Remove everything but *.dll files. Avoids that<br> # a lot remains when gvimext.dll cannot be deleted.<br> RMDir /r $0\autoload<br> RMDir /r $0\colors<br> RMDir /r $0\compiler<br> RMDir /r $0\doc<br> RMDir /r $0\ftplugin<br> RMDir /r $0\indent<br> RMDir /r $0\macros<br> RMDir /r $0\plugin<br> RMDir /r $0\spell<br> RMDir /r $0\syntax<br> RMDir /r $0\tools<br> RMDir /r $0\tutor<br> RMDir /r $0\VisVim<br> RMDir /r $0\lang<br> RMDir /r $0\keymap<br> Delete $0\*.exe<br> Delete $0\*.bat<br> Delete $0\*.vim<br> Delete $0\*.txt | |||
IfErrors ErrorMess NoErrorMess<br> ErrorMess:<br> MessageBox MB_OK|MB_ICONEXCLAMATION \<br> "Some files in $0 have not been deleted!$\nYou must do it manually."<br> NoErrorMess: | |||
# No error message if the "vim62" directory can't be removed, the<br> # gvimext.dll may still be there.<br> RMDir $0 | |||
NoRemoveExes:<br> # get the parent dir of the installation<br> Push $INSTDIR<br> Call un.GetParent<br> Pop $0<br> StrCpy $1 $0 | |||
# if a plugin dir was created at installation ask the user to remove it<br> # first look in the root of the installation then in HOME<br> IfFileExists $1\vimfiles AskRemove 0<br> ReadEnvStr $1 "HOME"<br> StrCmp $1 "" NoRemove 0 | |||
IfFileExists $1\vimfiles 0 NoRemove | |||
AskRemove:<br> MessageBox MB_YESNO|MB_ICONQUESTION \<br> "Remove all files in your $1\vimfiles directory? \<br> $\nIf you have created something there that you want to keep, click No" IDNO Fin<br> RMDir /r $1\vimfiles<br> NoRemove: | |||
# ask the user if the Vim root dir must be removed<br> MessageBox MB_YESNO|MB_ICONQUESTION \<br> "Would you like to remove $0?$\n \<br> $\nIt contains your Vim configuration files!" IDNO NoDelete<br> RMDir /r $0 ; skipped if no<br> NoDelete: | |||
Fin:<br> Call un.onUnInstSuccess | |||
SectionEnd<br><br> |
2008年3月7日 (五) 13:08的版本
我的一些设置保存,以后修改!
plugin
---------------
taglist.vim
encode_japan.vim
readcsv.vim
NERD_commenter.vim
supertab.vim
util_corey.vim
colors
---------
corey.vim
exe & dll
---------
ctags.exe
gvimext.dll
iconv.dll
intl2.dll
msvcr71.dll
libint.dll
VisVim.dll
installer
---------------
gvim.nsis
awiconsprosetup.exe
vi.cmd
====================================================
"args **/*.jsp
"argdo %s/old/target/c | update
" Section: utillity tools {{{1
" ===================================================
func Search_Word()
let w = expand("<cword>")
"exe "vimgrep " w "*.java *.jsp *.php *.c *.h *.htm"
exe "vimgrep " w "**/*.*"
exe 'copen'
endfun
func TrimSpaceLine()
execute 'g/^\s*$/d'
endfun
func TrimEndSpace()
execute '%s/\s*$//'
endfun
func SelectTabpage()
execute 'tabn'
endfun
func NewTabpage()
execute 'tabnew'
endfun
func Insert_0_Number()
execute 'g/^/exec "s/^/".strpart("000000000000".line("."). " ",
len("000000000000".line("."). " ")-len(line("$"))-1 ) '
endfun
func Insert_Number()
execute 'g/^/exec "s/^/".strpart(line(".")." ", 0, len(line("$")) + 1)'
endfun
func SaveP()
call inputsave()
let Pname = input('Save Project name?')
call inputrestore()
execute 'mksession! ~\'.Pname.'.vim'
execute 'wviminfo! ~\'.Pname.'.viminfo'
endfun
func ReloadP()
call inputsave()
let Pbname = input('Load Project name?')
call inputrestore()
execute 'source ~\'.Pbname.'.vim'
execute 'rviminfo ~\'.Pbname.'.viminfo'
endfun
func CancleHighlightCurrentLine()
au! Cursorhold
match none
endfun
func SetHighlightUnderLine()
call CancleHighlightCurrentLine()
"highlight CurrentLine guibg=darkgrey guifg=white (or whatever colors you want)
hi CurrentLine term=underline cterm=underline gui=underline ctermbg=NONE guibg=NONE
au! Cursorhold * exe 'match CurrentLine /\%' . line('.') . 'l.*/'
au! InsertEnter * match none
set ut=60
endfun
func SetHighlightCurrentLine()
call CancleHighlightCurrentLine()
hi CurrentLine ctermbg=darkgrey guibg=darkgrey term=NONE cterm=NONE gui=NONE
au! Cursorhold * exe 'match CurrentLine /\%' . line('.') . 'l.*/'
au! InsertEnter * match none
set ut=60
endfun
" Section: Comment mapping setup {{{1
" ===========================================================================
" This is where the mappings calls are made that set up the commenting key
" mappings.
" set up the mappings to trim space at the line's end
execute 'nnoremap <silent>' . ',te' . ' :call TrimEndSpace()<cr>'
execute 'vnoremap <silent>' . ',te' . ' <ESC>:call TrimEndSpace()<cr>'
" set up the mappings to trim space line
execute 'nnoremap <silent>' . ',tl' . ' :call TrimSpaceLine()<cr>'
execute 'vnoremap <silent>' . ',tl' . ' <ESC>:call TrimSpaceLine()<cr>'
" set up the mappings to Cancle and set Highlight Current Line
execute 'nnoremap <silent>' . 'mm' . ' :call CancleHighlightCurrentLine()<cr>'
execute 'vnoremap <silent>' . 'mm' . ' <ESC>:call CancleHighlightCurrentLine()<cr>'
execute 'nnoremap <silent>' . 'mn' . ' :call SetHighlightCurrentLine()<cr>'
execute 'vnoremap <silent>' . 'mn' . ' <ESC>:call SetHighlightCurrentLine()<cr>'
execute 'nnoremap <silent>' . 'mv' . ' :call SetHighlightUnderLine()<cr>'
execute 'vnoremap <silent>' . 'mv' . ' <ESC>:call SetHighlightUnderLine()<cr>'
"NewTabpage
execute 'nnoremap <silent>' . 'tt' . ' :call NewTabpage()<cr>'
execute 'vnoremap <silent>' . 'tt' . ' <ESC>:call NewTabpage()<cr>'
" Section: Menu item setup {{{1
" ===========================================================================
"check if the user wants the menu to be displayed
if 1 != 0
let menuRoot = '&Plugin.&util'
execute 'menu <silent> '. menuRoot .'.-Sep- :'
execute 'nmenu <silent> '. menuRoot .'.Trim\ End\ Space<TAB>' .
escape(',te', '\') . ' :call TrimEndSpace()<CR>'
execute 'nmenu <silent> '. menuRoot .'.Trim\ Space\ Line<TAB>' .
escape(',tl', '\') . ' :call TrimSpaceLine()<CR>'
execute 'menu <silent> '. menuRoot .'.-Sep2- :'
execute 'nmenu <silent> '. menuRoot .'.Cancle\ Highlight\ CurrentLine<TAB>' .
escape('mm', '\') . ' :call CancleHighlightCurrentLine()<CR>'
execute 'nmenu <silent> '. menuRoot .'.Set\ Highlight\ CurrentLine<TAB>' .
escape('mn', '\') . ' :call SetHighlightCurrentLine()<CR>'
execute 'nmenu <silent> '. menuRoot .'.Set\ Underline\ CurrentLine<TAB>' .
escape('mv', '\') . ' :call SetHighlightUnderLine()<CR>'
execute 'menu <silent> '. menuRoot .'.-Sep3- :'
execute 'nmenu <silent> '. menuRoot .'.New\ Tabpage<TAB>' . escape('tt', '\') .
' :call NewTabpage()<CR>'
execute 'nmenu <silent> '. menuRoot .'.Insert\ Number,\ 0\ Ahead<TAB>' .
escape(' ', '\') . ' :call Insert_0_Number()<CR>'
execute 'nmenu <silent> '. menuRoot .'.Insert\ Number,\ No\ 0<TAB>' .
escape(' ', '\') . ' :call Insert_Number()<CR>'
endif
" vim: set foldmethod=marker :
gvimrc---------------------
set nowrap
set expandtab
set noignorecase
set guioptions+=b
- call SetHighlightUnderLine()
"au GUIEnter * simalt ~x "maximum the initial window
map <C-tab> :call SelectTabpage()<CR>
map <F6> :call SaveP()<CR>
map <F5> :call ReloadP()<CR>
" input the tab, need to comment out [set expandtab]
inoremap <S-t> <tab>
if has("statusline")
set statusline=%<%f\ %h%m%r%=%{\"[\".
(&fenc==\"\"?&enc:&fenc).\"]\ \"}%k\ %-14.(%l,%c%V%)\ %P
endif
" ==========================================================================
- NSIS file to create a self-installing exe for Vim.
# It requires NSIS version 2.0 or later.
# Last change: 2004 May 02
- WARNING: if you make changes to this script, look out for $0 to be valid,
# because uninstall deletes most files in $0.
- Location of gvim_ole.exe, vimd32.exe, GvimExt/*, etc.
!define VIMSRC "..\src"
- Location of runtime files
!define VIMRT ".."
- Location of extra tools: diff.exe
!define VIMTOOLS ..\..
- Comment the next line if you don't have UPX.
# Get it at http://upx.sourceforge.net
# !define HAVE_UPX
- comment the next line if you do not want to add Native Language Support
!define HAVE_NLS
!define VER_MAJOR 7
!define VER_MINOR 1
- ----------- No configurable settings below this line -----------
!include UpgradeDLL.nsh # for VisVim.dll
Name "Vim ${VER_MAJOR}.${VER_MINOR}"
OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
CRCCheck force
SetCompressor lzma
SetDatablockOptimize on
ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer."
DirText "Choose a directory to install Vim (must end in 'vim')"
Icon icons\vim_16i.ico
# NSIS2 uses a different strategy with six diferent images in a strip...
#EnabledBitmap icons\enabled.bmp
#DisabledBitmap icons\disabled.bmp
UninstallText "This will uninstall Vim ${VER_MAJOR}.${VER_MINOR} from your system."
UninstallIcon icons\vim_uninst_16c.ico
- On NSIS 2 using the BGGradient causes trouble on Windows 98, in combination
# with the BringToFront.
# BGGradient 004000 008200 FFFFFF
LicenseText "You should read the following before installing:"
LicenseData ${VIMRT}\doc\uganda.nsis.txt
!ifdef HAVE_UPX
!packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
!endif
- This adds '\vim' to the user choice automagically. The actual value is
# obtained below with ReadINIStr.
InstallDir "$PROGRAMFILES\Vim"
- Types of installs we can perform:
InstType Typical
InstType Minimal
InstType Full
SilentInstall normal
- These are the pages we use
Page license
Page components
Page directory "" "" CheckInstallDir
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
# Functions
Function .onInit
MessageBox MB_YESNO|MB_ICONQUESTION \
"This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \
IDYES NoAbort
Abort ; causes installer to quit.
NoAbort:
- run the install program to check for already installed versions
SetOutPath $TEMP
# File /oname=install.exe ${VIMSRC}\installw32.exe
File ${VIMRT}\install.exe
ExecWait "$TEMP\install.exe -uninstall-check"
Delete $TEMP\install.exe
- We may have been put to the background when uninstall did something.
BringToFront
- Install will have created a file for us that contains the directory where
# we should install. This is $VIM if it's set. This appears to be the only
# way to get the value of $VIM here!?
ReadINIStr $INSTDIR $TEMP\vimini.ini vimini dir
Delete $TEMP\vimini.ini
- If ReadINIStr failed or did not find a path: use the default dir.
StrCmp $INSTDIR "" 0 IniOK
StrCpy $INSTDIR "$PROGRAMFILES\Vim"
IniOK:
- Should check for the value of $VIM and use it. Unfortunately I don't know
# how to obtain the value of $VIM
# IfFileExists "$VIM" 0 No_Vim
# StrCpy $INSTDIR "$VIM"
# No_Vim:
- User variables:
# $0 - holds the directory the executables are installed to
# $1 - holds the parameters to be passed to install.exe. Starts with OLE
# registration (since a non-OLE gvim will not complain, and we want to
# always register an OLE gvim).
# $2 - holds the names to create batch files for
StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
StrCpy $1 "-register-OLE"
StrCpy $2 "gvim evim gview gvimdiff vimtutor"
FunctionEnd
Function .onUserAbort
MessageBox MB_YESNO|MB_ICONQUESTION "Abort install?" IDYES NoCancelAbort
Abort ; causes installer to not quit.
NoCancelAbort:
FunctionEnd
- We only accept the directory if it ends in "vim". Using .onVerifyInstDir has
# the disadvantage that the browse dialog is difficult to use.
Function CheckInstallDir
StrCpy $0 $INSTDIR 3 -3
StrCmp $0 "vim" PathGood
MessageBox MB_OK "The path must end in 'vim'."
Abort
PathGood:
FunctionEnd
Function .onInstSuccess
WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
MessageBox MB_YESNO|MB_ICONQUESTION \
"The installation process has been successfull. Happy Vimming! \
$\n$\n Do you want to see the README file now?" IDNO NoReadme
Exec '$0\gvim.exe -R "$0\README.txt"'
NoReadme:
FunctionEnd
Function .onInstFailed
MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed. Better luck next time."
FunctionEnd
Function un.onUnInstSuccess
MessageBox MB_OK|MB_ICONINFORMATION \
"Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system"
FunctionEnd
Function un.GetParent
Exch $0 ; old $0 is on top of stack
Push $1
Push $2
StrCpy $1 -1
loop:
StrCpy $2 $0 1 $1
StrCmp $2 "" exit
StrCmp $2 "\" exit
IntOp $1 $1 - 1
Goto loop
exit:
StrCpy $0 $0 $1
Pop $2
Pop $1
Exch $0 ; put $0 on top of stack, restore $0 to original value
FunctionEnd
Section "Vim executables and runtime files"
SectionIn 1 2 3
- we need also this here if the user changes the instdir
StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
SetOutPath $0
File ${VIMRT}\gvim.exe
File ${VIMRT}\install.exe
File ${VIMRT}\uninstal.exe
File ${VIMRT}\vimrun.exe
File ${VIMRT}\xxd.exe
File ${VIMRT}\diff.exe
File ${VIMRT}\vimtutor.bat
File ${VIMRT}\README.txt
File ${VIMRT}\uninstal.txt
File ${VIMRT}\*.vim
File ${VIMRT}\rgb.txt
File ${VIMRT}\ctags.exe
File ${VIMRT}\iconv.dll
File ${VIMRT}\intl2.dll
File ${VIMRT}\msvcr71.dll
SetOutPath $INSTDIR
File ${VIMRT}\gvimrc
SetOutPath $0\colors
File ${VIMRT}\colors\*.*
SetOutPath $0\compiler
File ${VIMRT}\compiler\*.*
SetOutPath $0\doc
File ${VIMRT}\doc\*.txt
File ${VIMRT}\doc\tags
SetOutPath $0\ftplugin
File ${VIMRT}\ftplugin\*.*
SetOutPath $0\indent
File ${VIMRT}\indent\*.*
SetOutPath $0\macros
File ${VIMRT}\macros\*.*
SetOutPath $0\plugin
File ${VIMRT}\plugin\*.*
SetOutPath $0\autoload
File ${VIMRT}\autoload\*.*
SetOutPath $0\autoload\xml
File ${VIMRT}\autoload\xml\*.*
SetOutPath $0\syntax
File ${VIMRT}\syntax\*.*
SetOutPath $0\spell
File ${VIMRT}\spell\*.txt
File ${VIMRT}\spell\*.vim
File ${VIMRT}\spell\*.spl
File ${VIMRT}\spell\*.sug
SetOutPath $0\tools
File ${VIMRT}\tools\*.*
SetOutPath $0\tutor
File ${VIMRT}\tutor\*.*
SectionEnd
Section "Vim console program (vim.exe)"
SectionIn 1 3
SetOutPath $0
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors 0 lbl_winnt
# Windows 95/98/ME
File ${VIMRT}\vim.exe
Goto lbl_done
lbl_winnt:
# Windows NT/2000/XT
File ${VIMRT}\vim.exe
lbl_done:
StrCpy $2 "$2 vim view vimdiff"
SectionEnd
Section "Create .bat files for command line use"
SectionIn 3
StrCpy $1 "$1 -create-batfiles $2"
SectionEnd
Section "Create icons on the Desktop"
SectionIn 1 3
StrCpy $1 "$1 -install-icons"
SectionEnd
Section "Add Vim to the Start Menu"
SectionIn 1 3
StrCpy $1 "$1 -add-start-menu"
SectionEnd
Section "Add an Edit-with-Vim context menu entry"
SectionIn 1 3
- Be aware of this sequence of events:
# - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and
# is scheduled to be removed at next reboot.
# - user installs Vim in same directory, gvimext.dll still exists.
# If we now skip installing gvimext.dll, it will disappear at the next
# reboot. Thus when copying gvimext.dll fails always schedule it to be
# installed at the next reboot. Can't use UpgradeDLL!
# We don't ask the user to reboot, the old dll will keep on working.
SetOutPath $0
ClearErrors
SetOverwrite try
File ${VIMRT}\gvimext.dll
IfErrors 0 GvimExtDone
- Can't copy gvimext.dll, create it under another name and rename it on
# next reboot.
GetTempFileName $3 $0
File /oname=$3 ${VIMRT}\gvimext.dll
Rename /REBOOTOK $3 $0\gvimext.dll
GvimExtDone:
SetOverwrite lastused
- We don't have a separate entry for the "Open With..." menu, assume
# the user wants either both or none.
StrCpy $1 "$1 -install-popup -install-openwith"
SectionEnd
Section "Create a _vimrc if it doesn't exist"
SectionIn 1 3
StrCpy $1 "$1 -create-vimrc"
SectionEnd
Section "Create plugin directories in HOME or VIM"
SectionIn 1 3
StrCpy $1 "$1 -create-directories home"
SectionEnd
Section "Create plugin directories in VIM"
SectionIn 3
StrCpy $1 "$1 -create-directories vim"
SectionEnd
Section "VisVim Extension for MS Visual Studio"
SectionIn 3
SetOutPath $0
!insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
File ${VIMSRC}\VisVim\README_VisVim.txt
SectionEnd
!ifdef HAVE_NLS
Section "Native Language Support"
SectionIn 1 3
SetOutPath $0\lang
File /r ${VIMRT}\lang\*.*
SetOutPath $0\keymap
File ${VIMRT}\keymap\README.txt
File ${VIMRT}\keymap\*.vim
SetOutPath $0
File ${VIMRT}\libintl.dll
SectionEnd
!endif
Section -call_install_exe
SetOutPath $0
ExecWait "$0\install.exe $1"
SectionEnd
Section -post
BringToFront
SectionEnd
Section Uninstall
# Apparently $INSTDIR is set to the directory where the uninstaller is
# created. Thus the "vim61" directory is included in it.
StrCpy $0 "$INSTDIR"
- If VisVim was installed, unregister the DLL.
IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim
Has_VisVim:
ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
No_VisVim:
- delete the context menu entry and batch files
ExecWait "$0\uninstal.exe -nsis"
- We may have been put to the background when uninstall did something.
BringToFront
- ask the user if the Vim version dir must be removed
MessageBox MB_YESNO|MB_ICONQUESTION \
"Would you like to delete $0?$\n \
$\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes
Delete /REBOOTOK $0\*.dll
ClearErrors
# Remove everything but *.dll files. Avoids that
# a lot remains when gvimext.dll cannot be deleted.
RMDir /r $0\autoload
RMDir /r $0\colors
RMDir /r $0\compiler
RMDir /r $0\doc
RMDir /r $0\ftplugin
RMDir /r $0\indent
RMDir /r $0\macros
RMDir /r $0\plugin
RMDir /r $0\spell
RMDir /r $0\syntax
RMDir /r $0\tools
RMDir /r $0\tutor
RMDir /r $0\VisVim
RMDir /r $0\lang
RMDir /r $0\keymap
Delete $0\*.exe
Delete $0\*.bat
Delete $0\*.vim
Delete $0\*.txt
IfErrors ErrorMess NoErrorMess
ErrorMess:
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Some files in $0 have not been deleted!$\nYou must do it manually."
NoErrorMess:
- No error message if the "vim62" directory can't be removed, the
# gvimext.dll may still be there.
RMDir $0
NoRemoveExes:
# get the parent dir of the installation
Push $INSTDIR
Call un.GetParent
Pop $0
StrCpy $1 $0
- if a plugin dir was created at installation ask the user to remove it
# first look in the root of the installation then in HOME
IfFileExists $1\vimfiles AskRemove 0
ReadEnvStr $1 "HOME"
StrCmp $1 "" NoRemove 0
IfFileExists $1\vimfiles 0 NoRemove
AskRemove:
MessageBox MB_YESNO|MB_ICONQUESTION \
"Remove all files in your $1\vimfiles directory? \
$\nIf you have created something there that you want to keep, click No" IDNO Fin
RMDir /r $1\vimfiles
NoRemove:
- ask the user if the Vim root dir must be removed
MessageBox MB_YESNO|MB_ICONQUESTION \
"Would you like to remove $0?$\n \
$\nIt contains your Vim configuration files!" IDNO NoDelete
RMDir /r $0 ; skipped if no
NoDelete:
Fin:
Call un.onUnInstSuccess
SectionEnd