+ MultipleSearch
GetLatestVimScripts + wget.exe git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@170 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
parent
8c074258bd
commit
5919dd2bca
@ -885,7 +885,7 @@ function s:GetLatestVimScriptsThroughProxy()
|
||||
" reset HOME
|
||||
let $HOME = home
|
||||
endfunction
|
||||
let g:GetLatestVimScripts_wget= "c:/tools/wget/wget.exe"
|
||||
let g:GetLatestVimScripts_wget= expand(g:vimfiles . '/tools/wget.exe')
|
||||
let g:GetLatestVimScripts_mv= "move"
|
||||
|
||||
" merge
|
||||
|
BIN
vimfiles.stefan/tools/wget.exe
Normal file
BIN
vimfiles.stefan/tools/wget.exe
Normal file
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
1075 8501 netrw.vim
|
||||
1502 8515 vimball.vim
|
||||
1075 9221 netrw.vim
|
||||
1502 8743 vimball.vim
|
||||
1008 3118 srec.vim (ftplugin)
|
||||
1009 3119 srec.vim (syntax file)
|
||||
475 2535 latex-suite (install in vimfiles.latex)
|
||||
@ -10,8 +10,8 @@ ScriptID SourceID Filename
|
||||
862 2635 cscope_quickfix.vim
|
||||
51 171 cscope_macros.vim
|
||||
102 5306 DirDiff.vim
|
||||
1189 6533 matrix.vim
|
||||
1173 7588 tcomment
|
||||
1189 8687 matrix.vim
|
||||
1173 8689 tcomment
|
||||
948 2878 Scons Compiler plugin
|
||||
1709 6421 Scons Syntax file
|
||||
1772 7248 DAMOS.zip DAMOS tools (von Stefan)
|
||||
@ -28,6 +28,7 @@ ScriptID SourceID Filename
|
||||
2092 8095 reloaded.vim (matrix colorscheme)
|
||||
848 8203 SrchRplcHiGrp.vim (Search/Replace on Syntax Group)
|
||||
294 8407 Align.vim
|
||||
642 8136 getscript.vim
|
||||
479 9276 MultipleSearch
|
||||
642 8136 :AutoInstall: GetLatestVimScripts.vim
|
||||
1066 7618 :AutoInstall: cecutil.vim
|
||||
642 8136 :AutoInstall: getscript.vim
|
||||
|
343
vimfiles/autoload/MultipleSearch.vim
Normal file
343
vimfiles/autoload/MultipleSearch.vim
Normal file
@ -0,0 +1,343 @@
|
||||
" File: MultipleSearch.vim (global plugin)
|
||||
" Last Changed: 13 Aug 2008
|
||||
" Maintainer: Dan Sharp <dwsharp at hotmail dot com>
|
||||
" Version: 1.3
|
||||
" License: Vim License
|
||||
|
||||
"-----------------------------------------------------------------------------
|
||||
" MultipleSearch allows you to have the results of multiple searches displayed
|
||||
" on the screen at the same time. Each search highlights its results in a
|
||||
" different color, and all searches are displayed at once. After the maximum
|
||||
" number of colors is used, the script starts over with the first color.
|
||||
"
|
||||
" The command syntax is:
|
||||
" :Search <pattern1>
|
||||
" which will highlight all occurrences of <pattern1> in the current buffer. A
|
||||
" subsequent :Search <pattern2> will highlight all occurrences of <pattern2>
|
||||
" in the current buffer, retaining the highlighting of <pattern1> as well.
|
||||
" <pattern1> and <pattern2> are any search pattern like you would use in a
|
||||
" normal /<pattern> search.
|
||||
"
|
||||
" The :Search command honors Vim's 'ignorecase' and 'smartcase' settings for
|
||||
" its own search. You can use the \c and \C flags in the search pattern to
|
||||
" force case matching no matter the setting of 'ignorecase' and 'smartcase'.
|
||||
"
|
||||
" The :SearchBuffers command works just like :Search, but the search occurs in
|
||||
" all currently listed buffers (i.e., those that appear in the output of :ls).
|
||||
" The match in all buffers will have the same color. This is different than
|
||||
" :bufdo Search <pattern> because in that case, each buffer will highlight the
|
||||
" match in a different color.
|
||||
"
|
||||
" To clear the highlighting, issue the command :SearchReset (for the current
|
||||
" buffer) or :SearchBuffersReset (for all buffers).
|
||||
"
|
||||
" You can specify the maximum number of different colors to use by setting the
|
||||
" g:MultipleSearchMaxColors variable in your .vimrc. The default setting is
|
||||
" four, but the script should handle as much as your terminal / GUI can
|
||||
" display. The g:MultipleSearchColorSequence variable lets you list the
|
||||
" colors you want displayed, and in what order. To make the text more
|
||||
" readable, you can set the g:MultipleSearchTextColorSequence variable to a
|
||||
" list of colors for the text, each position corresponding to the color in the
|
||||
" same position in g:MultipleSearchColorSequence.
|
||||
|
||||
" If you change one of the preference variables, you can issue the command
|
||||
" :SearchReinit
|
||||
" to update the script with your new selections.
|
||||
|
||||
" Supporters:
|
||||
" Thanks to Peter Valach for suggestions and testing!
|
||||
" Thanks to Jeff Mei for the suggestion and testing of the :SearchBuffers
|
||||
" command.
|
||||
" Thanks to Amber Hassan for fixing a problem with a search pattern containing
|
||||
" quote characters!
|
||||
" Thanks to Manuel Picaza for the mapping to :Search the word under the
|
||||
" cursor.
|
||||
" ----------------------------------------------------------------------------
|
||||
|
||||
" This script uses continuation lines, so make sure it runs using
|
||||
" Vim-default 'cpoptions'.
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" FUNCTIONS
|
||||
" --------------------------------------------------
|
||||
|
||||
" -----
|
||||
" Strntok: Utility function to implement C-like strntok() by Michael Geddes
|
||||
" and Benji Fisher at http://groups.yahoo.com/group/vimdev/message/26788
|
||||
" -----
|
||||
function! s:Strntok( s, tok, n)
|
||||
return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}')
|
||||
endfun
|
||||
|
||||
" -----
|
||||
" MultipleSearchInit: Initialize the higlight groups. This function will add
|
||||
" highlighting groups if g:MultipSearchMaxColors has increased since the
|
||||
" plugin was first loaded.
|
||||
" -----
|
||||
function! s:MultipleSearchInit()
|
||||
" Specify a maximum number of colors to use.
|
||||
if exists('g:MultipleSearchMaxColors')
|
||||
let s:MaxColors = g:MultipleSearchMaxColors
|
||||
else
|
||||
let s:MaxColors = 4
|
||||
endif
|
||||
|
||||
" Define the sequence of colors to use for searches.
|
||||
if exists('g:MultipleSearchColorSequence')
|
||||
let s:ColorSequence = g:MultipleSearchColorSequence
|
||||
else
|
||||
let s:ColorSequence = "red,yellow,blue,green,magenta,cyan,gray,brown"
|
||||
endif
|
||||
|
||||
" Define the text color for searches, so that it can still be read against the
|
||||
" colored background.
|
||||
if exists('g:MultipleSearchTextColorSequence')
|
||||
let s:TextColorSequence = g:MultipleSearchTextColorSequence
|
||||
else
|
||||
let s:TextColorSequence = "white,black,white,black,white,black,black,white"
|
||||
endif
|
||||
|
||||
" Start off with the first color
|
||||
let s:colorToUse = 0
|
||||
|
||||
let s:colorsInUse = 0
|
||||
|
||||
" Sanity check: make sure MaxColors is not larger than the number of
|
||||
" colors in ColorSequence or the corresponding TextColorSequence.
|
||||
let s:MaxColors = s:Min(s:MaxColors, s:ItemCount(s:ColorSequence . ','),
|
||||
\ s:ItemCount(s:TextColorSequence . ','))
|
||||
|
||||
let loopCount = 0
|
||||
while loopCount < s:MaxColors
|
||||
" Define the colors to use
|
||||
let bgColor = s:Strntok(s:ColorSequence, ',', loopCount + 1)
|
||||
let fgColor = s:Strntok(s:TextColorSequence, ',', loopCount + 1)
|
||||
execute 'highlight MultipleSearch' . loopCount
|
||||
\ . ' ctermbg=' . bgColor . ' guibg=' . bgColor
|
||||
\ . ' ctermfg=' . fgColor . ' guifg=' . fgColor
|
||||
let loopCount = loopCount + 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" -----
|
||||
" ItemCount: Returns the number of items in the given string.
|
||||
" -----
|
||||
function! s:ItemCount(string)
|
||||
let itemCount = 0
|
||||
let newstring = a:string
|
||||
let pos = stridx(newstring, ',')
|
||||
while pos > -1
|
||||
let itemCount = itemCount + 1
|
||||
let newstring = strpart(newstring, pos + 1)
|
||||
let pos = stridx(newstring, ',')
|
||||
endwhile
|
||||
return itemCount
|
||||
endfunction
|
||||
|
||||
" -----
|
||||
" Min: Returns the minimum of the given parameters.
|
||||
" -----
|
||||
function! s:Min(...)
|
||||
let min = a:1
|
||||
let index = 2
|
||||
while index <= a:0
|
||||
execute "if min > a:" . index . " | let min = a:" . index . " | endif"
|
||||
let index = index + 1
|
||||
endwhile
|
||||
return min
|
||||
endfunction
|
||||
|
||||
" -----
|
||||
" GetNextSequenceNumber: Determine the next Search color to use.
|
||||
" -----
|
||||
function! s:GetNextSequenceNumber()
|
||||
let sequenceNumber = s:colorToUse % s:MaxColors
|
||||
let s:colorToUse = s:colorToUse + 1
|
||||
if s:colorToUse >= s:MaxColors
|
||||
let s:colorToUse = 0
|
||||
endif
|
||||
return sequenceNumber
|
||||
endfunction
|
||||
|
||||
" -----
|
||||
" DoSearch: The main searching function that highlights all matches in the
|
||||
" current buffer.
|
||||
" -----
|
||||
function! s:DoSearch(useSearch, forwhat)
|
||||
" Clear the previous highlighting for this color
|
||||
execute 'silent syntax clear ' . a:useSearch
|
||||
|
||||
" Should it be a case-sensitive match or case-insensitive?
|
||||
if &ignorecase == 1
|
||||
" If 'smartcase' is on and our search pattern has an upper-case
|
||||
" character, do a case sensitive match.
|
||||
if &smartcase == 1
|
||||
" match() respects 'ignorecase', so turn it off for now
|
||||
set noignorecase
|
||||
|
||||
if match(a:forwhat, '\u') > -1
|
||||
syntax case match
|
||||
else
|
||||
syntax case ignore
|
||||
endif
|
||||
|
||||
" Be sure to turn 'ignorecase' back on!
|
||||
set ignorecase
|
||||
else
|
||||
syntax case ignore
|
||||
endif
|
||||
else
|
||||
syntax case match
|
||||
endif
|
||||
|
||||
" Highlight the new search
|
||||
execute 'syntax match ' . a:useSearch . ' "' . a:forwhat . '" containedin=ALL'
|
||||
let @/ = a:forwhat
|
||||
endfunction
|
||||
|
||||
" -----
|
||||
" MultipleSearch: Highlight the given pattern in the next available color.
|
||||
" Vim versions prior to 7.0 don't support the autoload mechanism, so define
|
||||
" the main function without the autoload prefix.
|
||||
" -----
|
||||
if v:version < 700
|
||||
function! MultipleSearch(allBuffers, forwhat)
|
||||
call s:MultipleSearchCommon(a:allBuffers, a:forwhat)
|
||||
endfunction
|
||||
else
|
||||
function! MultipleSearch#MultipleSearch(allBuffers, forwhat)
|
||||
call s:MultipleSearchCommon(a:allBuffers, a:forwhat)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" -----
|
||||
" MultipleSearchCommon: Highlight the given pattern in the next available color.
|
||||
" -----
|
||||
function! s:MultipleSearchCommon(allBuffers, forwhat)
|
||||
let patt = a:forwhat
|
||||
|
||||
if( l:patt =~ "[^\\\\]'" ) " if single quote not escaped
|
||||
let l:patt = escape(l:patt,"'") " escape single quotes with a \ char
|
||||
endif
|
||||
|
||||
if( l:patt =~ '[^\\]"' ) " if double quote not escaped
|
||||
let l:patt = escape(l:patt, '"') " escape double quotes with a \ char
|
||||
endif
|
||||
|
||||
"let patt = escape(a:forwhat,"'") " escape single quotes with a \ char
|
||||
"let l:patt = escape(l:patt, '"') " escape double quotes with a \ char
|
||||
|
||||
" Determine which search color to use.
|
||||
let s:curr_sequence = s:GetNextSequenceNumber()
|
||||
let s:patterns{s:curr_sequence} = l:patt
|
||||
let s:searchSequence = s:curr_sequence
|
||||
if s:colorsInUse < s:MaxColors
|
||||
let s:colorsInUse += 1
|
||||
endif
|
||||
let useSearch = "MultipleSearch" . s:curr_sequence
|
||||
|
||||
if a:allBuffers
|
||||
" If a:allBuffers is on, we want to show the match in all currently
|
||||
" listed buffers.
|
||||
let counter = 1
|
||||
let bufCount = bufnr("$")
|
||||
let current = bufnr("%")
|
||||
let lz_save = &lazyredraw
|
||||
|
||||
" Loop through all the buffers and perform the search in each one.
|
||||
while counter <= bufCount
|
||||
if buflisted(counter)
|
||||
exec "buffer " . counter
|
||||
call s:DoSearch(useSearch, l:patt)
|
||||
endif
|
||||
let counter = counter + 1
|
||||
endwhile
|
||||
exec "buffer " . current
|
||||
let &lazyredraw = lz_save
|
||||
else
|
||||
" Otherwise, just search in the current buffer.
|
||||
call s:DoSearch(useSearch, l:patt)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" ---
|
||||
" DoReset: Clear the highlighting
|
||||
" ---
|
||||
function! s:DoReset()
|
||||
let seq = 0
|
||||
while seq < s:MaxColors
|
||||
execute 'syntax clear MultipleSearch' . seq
|
||||
let seq = seq + 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" -----
|
||||
" MultipleSearchReset: Clear all the current search selections.
|
||||
" -----
|
||||
function! s:MultipleSearchReset(allBuffers)
|
||||
let s:colorToUse = 0
|
||||
let s:colorsInUse = 0
|
||||
if a:allBuffers == 1
|
||||
" If a:allBuffers is on, we want to clear the match in all
|
||||
" currently listed buffers.
|
||||
let current = bufnr("%")
|
||||
bufdo call s:DoReset()
|
||||
execute "buffer " . current
|
||||
else
|
||||
" Otherwise, just clear the current buffer.
|
||||
call s:DoReset()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" -----
|
||||
" SearchNext: Switch to the next search item to cycle through with n and N
|
||||
" -----
|
||||
function! s:SearchNext(direction)
|
||||
if a:direction == 0
|
||||
let s:searchSequence += 1
|
||||
if s:searchSequence >= s:colorsInUse
|
||||
let s:searchSequence = 0
|
||||
endif
|
||||
else
|
||||
let s:searchSequence -= 1
|
||||
if s:searchSequence < 0
|
||||
let s:searchSequence = s:colorsInUse - 1
|
||||
endif
|
||||
endif
|
||||
|
||||
let @/ = s:patterns{s:searchSequence}
|
||||
call search(s:patterns{s:searchSequence})
|
||||
endfunction
|
||||
|
||||
|
||||
" Initialize the script the first time through.
|
||||
call <SID>MultipleSearchInit()
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
||||
" COMMANDS
|
||||
" ------------------------------------------------
|
||||
|
||||
" Clear the current search selections and start over with the first color in
|
||||
" the sequence.
|
||||
if !(exists(":SearchReset") == 2)
|
||||
command -nargs=0 SearchReset :silent call <SID>MultipleSearchReset(0)
|
||||
endif
|
||||
|
||||
" Clear the current search selections and start over with the first color in
|
||||
" the sequence.
|
||||
if !(exists(":SearchBuffersReset") == 2)
|
||||
command -nargs=0 SearchBuffersReset :silent call <SID>MultipleSearchReset(1)
|
||||
endif
|
||||
|
||||
" Reinitialize the script after changing one of the global preferences.
|
||||
if !(exists(":SearchReinit") == 2)
|
||||
command -nargs=0 SearchReinit :silent call <SID>MultipleSearchInit()
|
||||
endif
|
||||
|
||||
" Set the current search pattern to the next one in the list
|
||||
nnoremap <silent> <Leader>n :call <SID>SearchNext(0)<CR>
|
||||
"
|
||||
" Set the current search pattern to the previous one in the list
|
||||
nnoremap <silent> <Leader>N :call <SID>SearchNext(1)<CR>
|
File diff suppressed because it is too large
Load Diff
@ -1,210 +1,201 @@
|
||||
" netrwSettings.vim: makes netrw settings simpler
|
||||
" Date: Mar 11, 2008
|
||||
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
||||
" Version: 11
|
||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" netrwSettings.vim is provided *as is* and comes with no
|
||||
" warranty of any kind, either expressed or implied. By using
|
||||
" this plugin, you agree that in no event will the copyright
|
||||
" holder be liable for any damages resulting from the use
|
||||
" of this software.
|
||||
"
|
||||
" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
|
||||
" synagogues, preaching the gospel of the kingdom, and healing
|
||||
" every disease and every sickness among the people.
|
||||
" Load Once: {{{1
|
||||
if exists("g:loaded_netrwSettings") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwSettings = "v11"
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" NetrwSettings: {{{1
|
||||
fun! netrwSettings#NetrwSettings()
|
||||
" this call is here largely just to insure that netrw has been loaded
|
||||
call netrw#NetrwSavePosn()
|
||||
if !exists("g:loaded_netrw")
|
||||
echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
above wincmd s
|
||||
enew
|
||||
setlocal noswapfile bh=wipe
|
||||
set ft=vim
|
||||
file Netrw\ Settings
|
||||
|
||||
" these variables have the following default effects when they don't
|
||||
" exist (ie. have not been set by the user in his/her .vimrc)
|
||||
if !exists("g:netrw_liststyle")
|
||||
let g:netrw_liststyle= 0
|
||||
let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
|
||||
endif
|
||||
if !exists("g:netrw_silent")
|
||||
let g:netrw_silent= 0
|
||||
endif
|
||||
if !exists("g:netrw_use_nt_rcp")
|
||||
let g:netrw_use_nt_rcp= 0
|
||||
endif
|
||||
if !exists("g:netrw_ftp")
|
||||
let g:netrw_ftp= 0
|
||||
endif
|
||||
if !exists("g:netrw_ignorenetrc")
|
||||
let g:netrw_ignorenetrc= 0
|
||||
endif
|
||||
|
||||
put ='+ ---------------------------------------------'
|
||||
put ='+ NetrwSettings: by Charles E. Campbell, Jr.'
|
||||
put ='+ Press <F1> with cursor atop any line for help'
|
||||
put ='+ ---------------------------------------------'
|
||||
let s:netrw_settings_stop= line(".")
|
||||
|
||||
put =''
|
||||
put ='+ Netrw Protocol Commands'
|
||||
put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd
|
||||
put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd
|
||||
put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd
|
||||
put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd
|
||||
put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd
|
||||
put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd
|
||||
put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd
|
||||
put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
|
||||
put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
|
||||
let s:netrw_protocol_stop= line(".")
|
||||
put = ''
|
||||
|
||||
put ='+Netrw Transfer Control'
|
||||
put = 'let g:netrw_cygwin = '.g:netrw_cygwin
|
||||
put = 'let g:netrw_ftp = '.g:netrw_ftp
|
||||
put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
|
||||
put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
|
||||
put = 'let g:netrw_sshport = '.g:netrw_sshport
|
||||
let shqline= line("$")
|
||||
put = 'let g:netrw_shq...'
|
||||
put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
|
||||
put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
|
||||
let s:netrw_xfer_stop= line(".")
|
||||
put =''
|
||||
put ='+ Netrw Messages'
|
||||
put ='let g:netrw_use_errorwindow = '.g:netrw_use_errorwindow
|
||||
|
||||
put = ''
|
||||
put ='+ Netrw Browser Control'
|
||||
put = 'let g:netrw_alto = '.g:netrw_alto
|
||||
put = 'let g:netrw_altv = '.g:netrw_altv
|
||||
put = 'let g:netrw_browse_split = '.g:netrw_browse_split
|
||||
if exists("g:netrw_browsex_viewer")
|
||||
put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
|
||||
else
|
||||
put = 'let g:netrw_browsex_viewer = (not defined)'
|
||||
endif
|
||||
let cdescline= line("$")
|
||||
put ='let g:netrw_cd_escape...'
|
||||
put = 'let g:netrw_compress = '.g:netrw_compress
|
||||
let decompressline= line("$")
|
||||
put ='let g:netrw_decompress...'
|
||||
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
|
||||
put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
|
||||
let fnameescline= line("$")
|
||||
put = 'let g:netrw_fname_escape...'
|
||||
put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
|
||||
put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
|
||||
put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
|
||||
put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
|
||||
let globescline= line("$")
|
||||
put ='let g:netrw_glob_escape...'
|
||||
put = 'let g:netrw_hide = '.g:netrw_hide
|
||||
put = 'let g:netrw_keepdir = '.g:netrw_keepdir
|
||||
put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
|
||||
put = 'let g:netrw_list_hide = '.g:netrw_list_hide
|
||||
put = 'let g:netrw_liststyle = '.g:netrw_liststyle
|
||||
put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
|
||||
put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir
|
||||
put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
|
||||
put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir
|
||||
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
|
||||
put = 'let g:netrw_menu = '.g:netrw_menu
|
||||
put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
|
||||
put = 'let g:netrw_preview = '.g:netrw_preview
|
||||
put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
|
||||
put = 'let g:netrw_retmap = '.g:netrw_retmap
|
||||
put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
|
||||
put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
|
||||
put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
|
||||
put = 'let g:netrw_silent = '.g:netrw_silent
|
||||
put = 'let g:netrw_sort_by = '.g:netrw_sort_by
|
||||
put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
|
||||
put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
|
||||
put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax
|
||||
put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
|
||||
put = 'let g:netrw_scpport = '.g:netrw_scpport
|
||||
put = 'let g:netrw_sshport = '.g:netrw_sshport
|
||||
put = 'let g:netrw_timefmt = '.g:netrw_timefmt
|
||||
let tmpfileescline= line("$")
|
||||
put ='let g:netrw_tmpfile_escape...'
|
||||
put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf
|
||||
put = 'let g:netrw_winsize = '.g:netrw_winsize
|
||||
|
||||
put =''
|
||||
put ='+ For help, place cursor on line and press <F1>'
|
||||
|
||||
1d
|
||||
silent %s/^+/"/e
|
||||
res 99
|
||||
silent %s/= \([^0-9].*\)$/= '\1'/e
|
||||
silent %s/= $/= ''/e
|
||||
1
|
||||
|
||||
" Put in g:netrw_shq setting and g:netrw_cd_escape
|
||||
" (deferred so as to avoid the quote manipulation just preceding)
|
||||
if g:netrw_shq == "'"
|
||||
call setline(shqline, 'let g:netrw_shq = "'.g:netrw_shq.'"')
|
||||
else
|
||||
call setline(shqline, "let g:netrw_shq = '".g:netrw_shq."'")
|
||||
endif
|
||||
call setline(cdescline, "let g:netrw_cd_escape = ".'"'.escape(g:netrw_cd_escape,'\"').'"')
|
||||
call setline(decompressline,"let g:netrw_decompress = ".substitute(string(g:netrw_decompress),"^'\\(.*\\)'$",'\1',''))
|
||||
call setline(fnameescline, "let g:netrw_fname_escape = '".escape(g:netrw_fname_escape,"'")."'")
|
||||
call setline(globescline, "let g:netrw_glob_escape = '".escape(g:netrw_glob_escape,"'")."'")
|
||||
call setline(tmpfileescline,"let g:netrw_tmpfile_escape = '".escape(g:netrw_tmpfile_escape,"'")."'")
|
||||
|
||||
set nomod
|
||||
|
||||
nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr>
|
||||
nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr>
|
||||
let tmpfile= tempname()
|
||||
exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" NetrwSettingHelp: {{{2
|
||||
fun! NetrwSettingHelp()
|
||||
" call Dfunc("NetrwSettingHelp()")
|
||||
let curline = getline(".")
|
||||
if curline =~ '='
|
||||
let varhelp = substitute(curline,'^\s*let ','','e')
|
||||
let varhelp = substitute(varhelp,'\s*=.*$','','e')
|
||||
" call Decho("trying help ".varhelp)
|
||||
try
|
||||
exe "he ".varhelp
|
||||
catch /^Vim\%((\a\+)\)\=:E149/
|
||||
echo "***sorry*** no help available for <".varhelp.">"
|
||||
endtry
|
||||
elseif line(".") < s:netrw_settings_stop
|
||||
he netrw-settings
|
||||
elseif line(".") < s:netrw_protocol_stop
|
||||
he netrw-externapp
|
||||
elseif line(".") < s:netrw_xfer_stop
|
||||
he netrw-variables
|
||||
else
|
||||
he netrw-browse-var
|
||||
endif
|
||||
" call Dret("NetrwSettingHelp")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Modelines: {{{1
|
||||
" vim:ts=8 fdm=marker
|
||||
" netrwSettings.vim: makes netrw settings simpler
|
||||
" Date: Sep 03, 2008
|
||||
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
||||
" Version: 13
|
||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" netrwSettings.vim is provided *as is* and comes with no
|
||||
" warranty of any kind, either expressed or implied. By using
|
||||
" this plugin, you agree that in no event will the copyright
|
||||
" holder be liable for any damages resulting from the use
|
||||
" of this software.
|
||||
"
|
||||
" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
|
||||
" synagogues, preaching the gospel of the kingdom, and healing
|
||||
" every disease and every sickness among the people.
|
||||
" Load Once: {{{1
|
||||
if exists("g:loaded_netrwSettings") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwSettings = "v13"
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" NetrwSettings: {{{1
|
||||
fun! netrwSettings#NetrwSettings()
|
||||
" this call is here largely just to insure that netrw has been loaded
|
||||
call netrw#NetrwSavePosn()
|
||||
if !exists("g:loaded_netrw")
|
||||
echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
above wincmd s
|
||||
enew
|
||||
setlocal noswapfile bh=wipe
|
||||
set ft=vim
|
||||
file Netrw\ Settings
|
||||
|
||||
" these variables have the following default effects when they don't
|
||||
" exist (ie. have not been set by the user in his/her .vimrc)
|
||||
if !exists("g:netrw_liststyle")
|
||||
let g:netrw_liststyle= 0
|
||||
let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
|
||||
endif
|
||||
if !exists("g:netrw_silent")
|
||||
let g:netrw_silent= 0
|
||||
endif
|
||||
if !exists("g:netrw_use_nt_rcp")
|
||||
let g:netrw_use_nt_rcp= 0
|
||||
endif
|
||||
if !exists("g:netrw_ftp")
|
||||
let g:netrw_ftp= 0
|
||||
endif
|
||||
if !exists("g:netrw_ignorenetrc")
|
||||
let g:netrw_ignorenetrc= 0
|
||||
endif
|
||||
|
||||
put ='+ ---------------------------------------------'
|
||||
put ='+ NetrwSettings: by Charles E. Campbell, Jr.'
|
||||
put ='+ Press <F1> with cursor atop any line for help'
|
||||
put ='+ ---------------------------------------------'
|
||||
let s:netrw_settings_stop= line(".")
|
||||
|
||||
put =''
|
||||
put ='+ Netrw Protocol Commands'
|
||||
put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd
|
||||
put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd
|
||||
put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd
|
||||
put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd
|
||||
put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd
|
||||
put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd
|
||||
put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd
|
||||
put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
|
||||
put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
|
||||
let s:netrw_protocol_stop= line(".")
|
||||
put = ''
|
||||
|
||||
put ='+Netrw Transfer Control'
|
||||
put = 'let g:netrw_cygwin = '.g:netrw_cygwin
|
||||
put = 'let g:netrw_ftp = '.g:netrw_ftp
|
||||
put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
|
||||
put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
|
||||
put = 'let g:netrw_sshport = '.g:netrw_sshport
|
||||
put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
|
||||
put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
|
||||
let s:netrw_xfer_stop= line(".")
|
||||
put =''
|
||||
put ='+ Netrw Messages'
|
||||
put ='let g:netrw_use_errorwindow = '.g:netrw_use_errorwindow
|
||||
|
||||
put = ''
|
||||
put ='+ Netrw Browser Control'
|
||||
put = 'let g:netrw_alto = '.g:netrw_alto
|
||||
put = 'let g:netrw_altv = '.g:netrw_altv
|
||||
put = 'let g:netrw_browse_split = '.g:netrw_browse_split
|
||||
if exists("g:netrw_browsex_viewer")
|
||||
put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
|
||||
else
|
||||
put = 'let g:netrw_browsex_viewer = (not defined)'
|
||||
endif
|
||||
put = 'let g:netrw_compress = '.g:netrw_compress
|
||||
put = 'let g:netrw_cursorline = '.g:netrw_cursorline
|
||||
let decompressline= line("$")
|
||||
put ='let g:netrw_decompress...'
|
||||
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
|
||||
put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
|
||||
let fnameescline= line("$")
|
||||
put = 'let g:netrw_fname_escape...'
|
||||
put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
|
||||
put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
|
||||
put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
|
||||
put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
|
||||
let globescline= line("$")
|
||||
put ='let g:netrw_glob_escape...'
|
||||
put = 'let g:netrw_hide = '.g:netrw_hide
|
||||
put = 'let g:netrw_keepdir = '.g:netrw_keepdir
|
||||
put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
|
||||
put = 'let g:netrw_list_hide = '.g:netrw_list_hide
|
||||
put = 'let g:netrw_liststyle = '.g:netrw_liststyle
|
||||
put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
|
||||
put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir
|
||||
put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
|
||||
put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir
|
||||
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
|
||||
put = 'let g:netrw_menu = '.g:netrw_menu
|
||||
put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
|
||||
put = 'let g:netrw_preview = '.g:netrw_preview
|
||||
put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
|
||||
put = 'let g:netrw_retmap = '.g:netrw_retmap
|
||||
put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
|
||||
put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
|
||||
put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
|
||||
put = 'let g:netrw_silent = '.g:netrw_silent
|
||||
put = 'let g:netrw_sort_by = '.g:netrw_sort_by
|
||||
put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
|
||||
put = 'let g:netrw_sort_options = '.g:netrw_sort_options
|
||||
put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
|
||||
put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax
|
||||
put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
|
||||
put = 'let g:netrw_scpport = '.g:netrw_scpport
|
||||
put = 'let g:netrw_sshport = '.g:netrw_sshport
|
||||
put = 'let g:netrw_timefmt = '.g:netrw_timefmt
|
||||
let tmpfileescline= line("$")
|
||||
put ='let g:netrw_tmpfile_escape...'
|
||||
put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf
|
||||
put = 'let g:netrw_xstrlen = '.g:netrw_xstrlen
|
||||
put = 'let g:netrw_winsize = '.g:netrw_winsize
|
||||
|
||||
put =''
|
||||
put ='+ For help, place cursor on line and press <F1>'
|
||||
|
||||
1d
|
||||
silent %s/^+/"/e
|
||||
res 99
|
||||
silent %s/= \([^0-9].*\)$/= '\1'/e
|
||||
silent %s/= $/= ''/e
|
||||
1
|
||||
|
||||
call setline(decompressline,"let g:netrw_decompress = ".substitute(string(g:netrw_decompress),"^'\\(.*\\)'$",'\1',''))
|
||||
call setline(fnameescline, "let g:netrw_fname_escape = '".escape(g:netrw_fname_escape,"'")."'")
|
||||
call setline(globescline, "let g:netrw_glob_escape = '".escape(g:netrw_glob_escape,"'")."'")
|
||||
call setline(tmpfileescline,"let g:netrw_tmpfile_escape = '".escape(g:netrw_tmpfile_escape,"'")."'")
|
||||
|
||||
set nomod
|
||||
|
||||
nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr>
|
||||
nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr>
|
||||
let tmpfile= tempname()
|
||||
exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" NetrwSettingHelp: {{{2
|
||||
fun! NetrwSettingHelp()
|
||||
" call Dfunc("NetrwSettingHelp()")
|
||||
let curline = getline(".")
|
||||
if curline =~ '='
|
||||
let varhelp = substitute(curline,'^\s*let ','','e')
|
||||
let varhelp = substitute(varhelp,'\s*=.*$','','e')
|
||||
" call Decho("trying help ".varhelp)
|
||||
try
|
||||
exe "he ".varhelp
|
||||
catch /^Vim\%((\a\+)\)\=:E149/
|
||||
echo "***sorry*** no help available for <".varhelp.">"
|
||||
endtry
|
||||
elseif line(".") < s:netrw_settings_stop
|
||||
he netrw-settings
|
||||
elseif line(".") < s:netrw_protocol_stop
|
||||
he netrw-externapp
|
||||
elseif line(".") < s:netrw_xfer_stop
|
||||
he netrw-variables
|
||||
else
|
||||
he netrw-browse-var
|
||||
endif
|
||||
" call Dret("NetrwSettingHelp")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Modelines: {{{1
|
||||
" vim:ts=8 fdm=marker
|
||||
|
557
vimfiles/autoload/tcomment.vim
Normal file
557
vimfiles/autoload/tcomment.vim
Normal file
@ -0,0 +1,557 @@
|
||||
" tcomment.vim
|
||||
" @Author: Thomas Link (mailto:micathom AT gmail com?subject=[vim])
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-09-17.
|
||||
" @Last Change: 2008-05-07.
|
||||
" @Revision: 0.0.46
|
||||
|
||||
if &cp || exists("loaded_tcomment_autoload")
|
||||
finish
|
||||
endif
|
||||
let loaded_tcomment_autoload = 1
|
||||
|
||||
|
||||
function! s:DefaultValue(option)
|
||||
exec 'let '. a:option .' = &'. a:option
|
||||
exec 'set '. a:option .'&'
|
||||
exec 'let default = &'. a:option
|
||||
exec 'let &'. a:option .' = '. a:option
|
||||
return default
|
||||
endf
|
||||
|
||||
let s:defaultComments = s:DefaultValue('comments')
|
||||
let s:defaultCommentString = s:DefaultValue('commentstring')
|
||||
let s:nullCommentString = '%s'
|
||||
|
||||
" tcomment#Comment(line1, line2, ?commentMode, ?commentAnyway, ?commentBegin, ?commentEnd)
|
||||
" commentMode:
|
||||
" G ... guess
|
||||
" B ... block
|
||||
" i ... maybe inline, guess
|
||||
" I ... inline
|
||||
" R ... right
|
||||
" v ... visual
|
||||
" o ... operator
|
||||
function! tcomment#Comment(beg, end, ...)
|
||||
" save the cursor position
|
||||
let co = col('.')
|
||||
let li = line('.')
|
||||
let s:pos_end = getpos("'>")
|
||||
let commentMode = a:0 >= 1 ? a:1 : 'G'
|
||||
let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0
|
||||
" TLogVAR a:beg, a:end, a:1, commentMode, commentAnyway
|
||||
if commentMode =~# 'i'
|
||||
let commentMode = substitute(commentMode, '\Ci', line("'<") == line("'>") ? 'I' : 'G', 'g')
|
||||
endif
|
||||
if commentMode =~# 'R' || commentMode =~# 'I'
|
||||
let cstart = col("'<")
|
||||
if cstart == 0
|
||||
let cstart = col('.')
|
||||
endif
|
||||
if commentMode =~# 'R'
|
||||
let commentMode = substitute(commentMode, '\CR', 'G', 'g')
|
||||
let cend = 0
|
||||
else
|
||||
let cend = col("'>")
|
||||
if commentMode =~# 'o'
|
||||
let cend += 1
|
||||
endif
|
||||
endif
|
||||
else
|
||||
let cstart = 0
|
||||
let cend = 0
|
||||
endif
|
||||
" TLogVAR commentMode, cstart, cend
|
||||
" get the correct commentstring
|
||||
if a:0 >= 3 && a:3 != ''
|
||||
let cms = s:EncodeCommentPart(a:3) .'%s'
|
||||
if a:0 >= 4 && a:4 != ''
|
||||
let cms = cms . s:EncodeCommentPart(a:4)
|
||||
endif
|
||||
else
|
||||
let [cms, commentMode] = s:GetCommentString(a:beg, a:end, commentMode)
|
||||
endif
|
||||
let cms0 = s:BlockGetCommentString(cms)
|
||||
let cms0 = escape(cms0, '\')
|
||||
" make whitespace optional; this conflicts with comments that require some
|
||||
" whitespace
|
||||
let cmtCheck = substitute(cms0, '\([ ]\)', '\1\\?', 'g')
|
||||
" turn commentstring into a search pattern
|
||||
let cmtCheck = s:SPrintF(cmtCheck, '\(\_.\{-}\)')
|
||||
" set commentMode and indentStr
|
||||
let [indentStr, uncomment] = s:CommentDef(a:beg, a:end, cmtCheck, commentMode, cstart, cend)
|
||||
" TLogVAR indentStr, uncomment
|
||||
if commentAnyway
|
||||
let uncomment = 0
|
||||
endif
|
||||
" go
|
||||
if commentMode =~# 'B'
|
||||
" We want a comment block
|
||||
call s:CommentBlock(a:beg, a:end, uncomment, cmtCheck, cms, indentStr)
|
||||
else
|
||||
" We want commented lines
|
||||
" final search pattern for uncommenting
|
||||
let cmtCheck = escape('\V\^\(\s\{-}\)'. cmtCheck .'\$', '"/\')
|
||||
" final pattern for commenting
|
||||
let cmtReplace = escape(cms0, '"/')
|
||||
silent exec a:beg .','. a:end .'s/\V'.
|
||||
\ s:StartRx(cstart) . indentStr .'\zs\(\.\{-}\)'. s:EndRx(cend) .'/'.
|
||||
\ '\=s:ProcessedLine('. uncomment .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
|
||||
endif
|
||||
" reposition cursor
|
||||
" TLogVAR commentMode
|
||||
if commentMode =~ '>'
|
||||
call setpos('.', s:pos_end)
|
||||
else
|
||||
" TLogVAR li, co
|
||||
call cursor(li, co)
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tcomment#Operator(type, ...) "{{{3
|
||||
let commentMode = a:0 >= 1 ? a:1 : ''
|
||||
let bang = a:0 >= 2 ? a:2 : ''
|
||||
let sel_save = &selection
|
||||
let &selection = "inclusive"
|
||||
let reg_save = @@
|
||||
" let pos = getpos('.')
|
||||
" TLogVAR a:type
|
||||
try
|
||||
if a:type == 'line'
|
||||
silent exe "normal! '[V']"
|
||||
let commentMode1 = 'G'
|
||||
elseif a:type == 'block'
|
||||
silent exe "normal! `[\<C-V>`]"
|
||||
let commentMode1 = 'I'
|
||||
else
|
||||
silent exe "normal! `[v`]"
|
||||
let commentMode1 = 'i'
|
||||
endif
|
||||
if empty(commentMode)
|
||||
let commentMode = commentMode1
|
||||
endif
|
||||
let beg = line("'[")
|
||||
let end = line("']")
|
||||
norm!
|
||||
let commentMode .= g:tcommentOpModeExtra
|
||||
call tcomment#Comment(beg, end, commentMode.'o', bang)
|
||||
finally
|
||||
let &selection = sel_save
|
||||
let @@ = reg_save
|
||||
if g:tcommentOpModeExtra !~ '>'
|
||||
" TLogVAR pos
|
||||
" call setpos('.', pos)
|
||||
call setpos('.', w:tcommentPos)
|
||||
unlet! w:tcommentPos
|
||||
endif
|
||||
endtry
|
||||
endf
|
||||
|
||||
|
||||
function! tcomment#OperatorLine(type) "{{{3
|
||||
call tcomment#Operator(a:type, 'G')
|
||||
endf
|
||||
|
||||
|
||||
function! tcomment#OperatorAnyway(type) "{{{3
|
||||
call tcomment#Operator(a:type, '', '!')
|
||||
endf
|
||||
|
||||
|
||||
function! tcomment#OperatorLineAnyway(type) "{{{3
|
||||
call tcomment#Operator(a:type, 'G', '!')
|
||||
endf
|
||||
|
||||
|
||||
" comment text as if it were of a specific filetype
|
||||
function! tcomment#CommentAs(beg, end, commentAnyway, filetype, ...)
|
||||
let ccount = a:0 >= 1 ? a:1 : 1
|
||||
" TLogVAR ccount
|
||||
if a:filetype =~ '_block$'
|
||||
let commentMode = 'B'
|
||||
let ft = substitute(a:filetype, '_block$', '', '')
|
||||
elseif a:filetype =~ '_inline$'
|
||||
let commentMode = 'I'
|
||||
let ft = substitute(a:filetype, '_inline$', '', '')
|
||||
else
|
||||
let commentMode = 'G'
|
||||
let ft = a:filetype
|
||||
endif
|
||||
let [cms, commentMode] = s:GetCommentString(a:beg, a:end, commentMode, ft)
|
||||
let pre = substitute(cms, '%s.*$', '', '')
|
||||
let pre = substitute(pre, '%%', '%', 'g')
|
||||
let post = substitute(cms, '^.\{-}%s', '', '')
|
||||
let post = substitute(post, '%%', '%', 'g')
|
||||
if ccount > 1
|
||||
let pre_l = matchlist(pre, '^\(\S\+\)\(.*\)$')
|
||||
" TLogVAR pre_l
|
||||
if !empty(get(pre_l, 1))
|
||||
let pre = repeat(pre_l[1], ccount) . pre_l[2]
|
||||
endif
|
||||
let post_l = matchlist(post, '^\(\s*\)\(.\+\)$')
|
||||
" TLogVAR post_l
|
||||
if !empty(get(post_l, 2))
|
||||
let post = post_l[1] . repeat(post_l[2], ccount)
|
||||
endif
|
||||
endif
|
||||
keepjumps call tcomment#Comment(a:beg, a:end, commentMode, a:commentAnyway, pre, post)
|
||||
endf
|
||||
|
||||
|
||||
" ----------------------------------------------------------------
|
||||
" collect all variables matching ^tcomment_
|
||||
function! tcomment#CollectFileTypes()
|
||||
if g:tcommentFileTypesDirty
|
||||
redir => vars
|
||||
silent let
|
||||
redir END
|
||||
let g:tcommentFileTypes = split(vars, '\n')
|
||||
call filter(g:tcommentFileTypes, 'v:val =~ "tcomment_"')
|
||||
call map(g:tcommentFileTypes, 'matchstr(v:val, ''tcomment_\zs\S\+'')')
|
||||
call sort(g:tcommentFileTypes)
|
||||
let g:tcommentFileTypesRx = '\V\^\('. join(g:tcommentFileTypes, '\|') .'\)\(\u\.\*\)\?\$'
|
||||
let g:tcommentFileTypesDirty = 0
|
||||
endif
|
||||
endf
|
||||
|
||||
call tcomment#CollectFileTypes()
|
||||
|
||||
" return a list of filetypes for which a tcomment_{&ft} is defined
|
||||
function! tcomment#FileTypes(ArgLead, CmdLine, CursorPos)
|
||||
" TLogVAR a:ArgLead, a:CmdLine, a:CursorPos
|
||||
call tcomment#CollectFileTypes()
|
||||
let types = copy(g:tcommentFileTypes)
|
||||
if index(g:tcommentFileTypes, &filetype) != -1
|
||||
" TLogVAR &filetype
|
||||
call insert(types, &filetype)
|
||||
endif
|
||||
if empty(a:ArgLead)
|
||||
return types
|
||||
else
|
||||
return filter(types, 'v:val =~ ''\V''.a:ArgLead')
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:EncodeCommentPart(string)
|
||||
return substitute(a:string, '%', '%%', 'g')
|
||||
endf
|
||||
|
||||
" s:GetCommentString(beg, end, commentMode, ?filetype="")
|
||||
function! s:GetCommentString(beg, end, commentMode, ...)
|
||||
let ft = a:0 >= 1 ? a:1 : ''
|
||||
if ft != ''
|
||||
let [cms, commentMode] = s:GetCustomCommentString(ft, a:commentMode)
|
||||
else
|
||||
let cms = ''
|
||||
let commentMode = a:commentMode
|
||||
endif
|
||||
if empty(cms)
|
||||
if exists('b:commentstring')
|
||||
let cms = b:commentstring
|
||||
return s:GetCustomCommentString(&filetype, a:commentMode, cms)
|
||||
elseif exists('b:commentStart') && b:commentStart != ''
|
||||
let cms = s:EncodeCommentPart(b:commentStart) .' %s'
|
||||
if exists('b:commentEnd') && b:commentEnd != ''
|
||||
let cms = cms .' '. s:EncodeCommentPart(b:commentEnd)
|
||||
endif
|
||||
return s:GetCustomCommentString(&filetype, a:commentMode, cms)
|
||||
elseif g:tcommentGuessFileType || (exists('g:tcommentGuessFileType_'. &filetype)
|
||||
\ && g:tcommentGuessFileType_{&filetype} =~ '[^0]')
|
||||
if g:tcommentGuessFileType_{&filetype} == 1
|
||||
let altFiletype = ''
|
||||
else
|
||||
let altFiletype = g:tcommentGuessFileType_{&filetype}
|
||||
endif
|
||||
return s:GuessFileType(a:beg, a:end, a:commentMode, &filetype, altFiletype)
|
||||
else
|
||||
return s:GetCustomCommentString(&filetype, a:commentMode, s:GuessCurrentCommentString(a:commentMode))
|
||||
endif
|
||||
endif
|
||||
return [cms, commentMode]
|
||||
endf
|
||||
|
||||
" s:SPrintF(formatstring, ?values ...)
|
||||
" => string
|
||||
function! s:SPrintF(string, ...)
|
||||
let n = 1
|
||||
let r = ''
|
||||
let s = a:string
|
||||
while 1
|
||||
let i = match(s, '%\(.\)')
|
||||
if i >= 0
|
||||
let x = s[i + 1]
|
||||
let r = r . strpart(s, 0, i)
|
||||
let s = strpart(s, i + 2)
|
||||
if x == '%'
|
||||
let r = r.'%'
|
||||
else
|
||||
if a:0 >= n
|
||||
let v = a:{n}
|
||||
let n = n + 1
|
||||
else
|
||||
echoerr 'Malformed format string (too many arguments required): '. a:string
|
||||
endif
|
||||
if x ==# 's'
|
||||
let r = r.v
|
||||
elseif x ==# 'S'
|
||||
let r = r.'"'.v.'"'
|
||||
else
|
||||
echoerr 'Malformed format string: '. a:string
|
||||
endif
|
||||
endif
|
||||
else
|
||||
return r.s
|
||||
endif
|
||||
endwh
|
||||
endf
|
||||
|
||||
function! s:StartRx(pos)
|
||||
if a:pos == 0
|
||||
return '\^'
|
||||
else
|
||||
return '\%'. a:pos .'c'
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:EndRx(pos)
|
||||
if a:pos == 0
|
||||
return '\$'
|
||||
else
|
||||
return '\%'. a:pos .'c'
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:GetIndentString(line, start)
|
||||
let start = a:start > 0 ? a:start - 1 : 0
|
||||
return substitute(strpart(getline(a:line), start), '\V\^\s\*\zs\.\*\$', '', '')
|
||||
endf
|
||||
|
||||
function! s:CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
||||
let mdrx = '\V'. s:StartRx(a:cstart) .'\s\*'. a:checkRx .'\s\*'. s:EndRx(0)
|
||||
let line = getline(a:beg)
|
||||
if a:cstart != 0 && a:cend != 0
|
||||
let line = strpart(line, 0, a:cend - 1)
|
||||
endif
|
||||
let uncomment = (line =~ mdrx)
|
||||
let it = s:GetIndentString(a:beg, a:cstart)
|
||||
let il = indent(a:beg)
|
||||
let n = a:beg + 1
|
||||
while n <= a:end
|
||||
if getline(n) =~ '\S'
|
||||
let jl = indent(n)
|
||||
if jl < il
|
||||
let it = s:GetIndentString(n, a:cstart)
|
||||
let il = jl
|
||||
endif
|
||||
if a:commentMode =~# 'G'
|
||||
if !(getline(n) =~ mdrx)
|
||||
let uncomment = 0
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let n = n + 1
|
||||
endwh
|
||||
if a:commentMode =~# 'B'
|
||||
let t = @t
|
||||
try
|
||||
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"ty'
|
||||
let uncomment = (@t =~ mdrx)
|
||||
finally
|
||||
let @t = t
|
||||
endtry
|
||||
endif
|
||||
return [it, uncomment]
|
||||
endf
|
||||
|
||||
function! s:ProcessedLine(uncomment, match, checkRx, replace)
|
||||
if !(a:match =~ '\S' || g:tcommentBlankLines)
|
||||
return a:match
|
||||
endif
|
||||
let ml = len(a:match)
|
||||
if a:uncomment
|
||||
let rv = substitute(a:match, a:checkRx, '\1\2', '')
|
||||
else
|
||||
let rv = s:SPrintF(a:replace, a:match)
|
||||
endif
|
||||
" let md = len(rv) - ml
|
||||
let s:pos_end = getpos('.')
|
||||
let s:pos_end[2] += len(rv)
|
||||
" TLogVAR pe, md, a:match
|
||||
let rv = escape(rv, '\
')
|
||||
let rv = substitute(rv, '\n', '\\\n', 'g')
|
||||
return rv
|
||||
endf
|
||||
|
||||
function! s:CommentBlock(beg, end, uncomment, checkRx, replace, indentStr)
|
||||
let t = @t
|
||||
try
|
||||
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td'
|
||||
let ms = s:BlockGetMiddleString(a:replace)
|
||||
let mx = escape(ms, '\')
|
||||
if a:uncomment
|
||||
let @t = substitute(@t, '\V\^\s\*'. a:checkRx .'\$', '\1', '')
|
||||
if ms != ''
|
||||
let @t = substitute(@t, '\V\n'. a:indentStr . mx, '\n'. a:indentStr, 'g')
|
||||
endif
|
||||
let @t = substitute(@t, '^\n', '', '')
|
||||
let @t = substitute(@t, '\n\s*$', '', '')
|
||||
else
|
||||
let cs = s:BlockGetCommentString(a:replace)
|
||||
let cs = a:indentStr . substitute(cs, '%s', '%s'. a:indentStr, '')
|
||||
if ms != ''
|
||||
let ms = a:indentStr . ms
|
||||
let mx = a:indentStr . mx
|
||||
let @t = substitute(@t, '^'. a:indentStr, '', 'g')
|
||||
let @t = ms . substitute(@t, '\n'. a:indentStr, '\n'. mx, 'g')
|
||||
endif
|
||||
let @t = s:SPrintF(cs, "\n". @t ."\n")
|
||||
endif
|
||||
silent norm! "tP
|
||||
finally
|
||||
let @t = t
|
||||
endtry
|
||||
endf
|
||||
|
||||
" inspired by Meikel Brandmeyer's EnhancedCommentify.vim
|
||||
" this requires that a syntax names are prefixed by the filetype name
|
||||
" s:GuessFileType(beg, end, commentMode, filetype, ?fallbackFiletype)
|
||||
function! s:GuessFileType(beg, end, commentMode, filetype, ...)
|
||||
if a:0 >= 1 && a:1 != ''
|
||||
let [cms, commentMode] = s:GetCustomCommentString(a:1, a:commentMode)
|
||||
if cms == ''
|
||||
let cms = s:GuessCurrentCommentString(a:commentMode)
|
||||
endif
|
||||
else
|
||||
let commentMode = s:CommentMode(a:commentMode, 'G')
|
||||
let cms = s:GuessCurrentCommentString(0)
|
||||
endif
|
||||
let n = a:beg
|
||||
while n <= a:end
|
||||
let m = indent(n) + 1
|
||||
let le = col('$')
|
||||
while m < le
|
||||
let syntaxName = synIDattr(synID(n, m, 1), 'name')
|
||||
let ftypeMap = get(g:tcommentSyntaxMap, syntaxName)
|
||||
if !empty(ftypeMap)
|
||||
return s:GetCustomCommentString(ftypeMap, a:commentMode, cms)
|
||||
elseif syntaxName =~ g:tcommentFileTypesRx
|
||||
let ft = substitute(syntaxName, g:tcommentFileTypesRx, '\1', '')
|
||||
if exists('g:tcommentIgnoreTypes_'. a:filetype) && g:tcommentIgnoreTypes_{a:filetype} =~ '\<'.ft.'\>'
|
||||
let m = m + 1
|
||||
else
|
||||
return s:GetCustomCommentString(ft, a:commentMode, cms)
|
||||
endif
|
||||
elseif syntaxName == '' || syntaxName == 'None' || syntaxName =~ '^\u\+$' || syntaxName =~ '^\u\U*$'
|
||||
let m = m + 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwh
|
||||
let n = n + 1
|
||||
endwh
|
||||
return [cms, commentMode]
|
||||
endf
|
||||
|
||||
function! s:CommentMode(commentMode, newmode) "{{{3
|
||||
return substitute(a:commentMode, '\w\+', a:newmode, 'g')
|
||||
endf
|
||||
|
||||
function! s:GuessCurrentCommentString(commentMode)
|
||||
let valid_cms = (stridx(&commentstring, '%s') != -1)
|
||||
if &commentstring != s:defaultCommentString && valid_cms
|
||||
" The &commentstring appears to have been set and to be valid
|
||||
return &commentstring
|
||||
endif
|
||||
if &comments != s:defaultComments
|
||||
" the commentstring is the default one, so we assume that it wasn't
|
||||
" explicitly set; we then try to reconstruct &cms from &comments
|
||||
let cms = s:ConstructFromComments(a:commentMode)
|
||||
if cms != s:nullCommentString
|
||||
return cms
|
||||
endif
|
||||
endif
|
||||
if valid_cms
|
||||
" Before &commentstring appeared not to be set. As we don't know
|
||||
" better we return it anyway if it is valid
|
||||
return &commentstring
|
||||
else
|
||||
" &commentstring is invalid. So we return the identity string.
|
||||
return s:nullCommentString
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:ConstructFromComments(commentMode)
|
||||
exec s:ExtractCommentsPart('')
|
||||
if a:commentMode =~# 'G' && line != ''
|
||||
return line .' %s'
|
||||
endif
|
||||
exec s:ExtractCommentsPart('s')
|
||||
if s != ''
|
||||
exec s:ExtractCommentsPart('e')
|
||||
" if a:commentMode
|
||||
" exec s:ExtractCommentsPart("m")
|
||||
" if m != ""
|
||||
" let m = "\n". m
|
||||
" endif
|
||||
" return s.'%s'.e.m
|
||||
" else
|
||||
return s.' %s '.e
|
||||
" endif
|
||||
endif
|
||||
if line != ''
|
||||
return line .' %s'
|
||||
else
|
||||
return s:nullCommentString
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:ExtractCommentsPart(key)
|
||||
" let key = a:key != "" ? a:key .'[^:]*' : ""
|
||||
let key = a:key . '[bnflrxO0-9-]*'
|
||||
let val = substitute(&comments, '^\(.\{-},\)\{-}'. key .':\([^,]\+\).*$', '\2', '')
|
||||
if val == &comments
|
||||
let val = ''
|
||||
else
|
||||
let val = substitute(val, '%', '%%', 'g')
|
||||
endif
|
||||
let var = a:key == '' ? 'line' : a:key
|
||||
return 'let '. var .'="'. escape(val, '"') .'"'
|
||||
endf
|
||||
|
||||
" s:GetCustomCommentString(ft, commentMode, ?default="")
|
||||
function! s:GetCustomCommentString(ft, commentMode, ...)
|
||||
let commentMode = a:commentMode
|
||||
let customComment = exists('g:tcomment_'. a:ft)
|
||||
if commentMode =~# 'B' && exists('g:tcomment_'. a:ft .'_block')
|
||||
let cms = g:tcomment_{a:ft}_block
|
||||
elseif commentMode =~? 'I' && exists('g:tcomment_'. a:ft .'_inline')
|
||||
let cms = g:tcomment_{a:ft}_inline
|
||||
elseif customComment
|
||||
let cms = g:tcomment_{a:ft}
|
||||
let commentMode = s:CommentMode(commentMode, 'G')
|
||||
elseif a:0 >= 1
|
||||
let cms = a:1
|
||||
let commentMode = s:CommentMode(commentMode, 'G')
|
||||
else
|
||||
let cms = ''
|
||||
let commentMode = s:CommentMode(commentMode, 'G')
|
||||
endif
|
||||
return [cms, commentMode]
|
||||
endf
|
||||
|
||||
function! s:BlockGetCommentString(cms)
|
||||
" return substitute(a:cms, '\n.*$', '', '')
|
||||
return matchstr(a:cms, '^.\{-}\ze\(\n\|$\)')
|
||||
endf
|
||||
|
||||
function! s:BlockGetMiddleString(cms)
|
||||
" let rv = substitute(a:cms, '^.\{-}\n\([^\n]*\)', '\1', '')
|
||||
let rv = matchstr(a:cms, '\n\zs.*')
|
||||
return rv == a:cms ? '' : rv
|
||||
endf
|
||||
|
||||
|
||||
redraw
|
||||
|
@ -1,7 +1,7 @@
|
||||
" vimball.vim : construct a file containing both paths and files
|
||||
" Author: Charles E. Campbell, Jr.
|
||||
" Date: Apr 01, 2008
|
||||
" Version: 25
|
||||
" Date: May 30, 2008
|
||||
" Version: 26
|
||||
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
|
||||
" Copyright: (c) 2004-2007 by Charles E. Campbell, Jr.
|
||||
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
||||
@ -15,7 +15,7 @@ if &cp || exists("g:loaded_vimball") || v:version < 700
|
||||
finish
|
||||
endif
|
||||
let s:keepcpo = &cpo
|
||||
let g:loaded_vimball = "v25"
|
||||
let g:loaded_vimball = "v26"
|
||||
set cpo&vim
|
||||
"DechoTabOn
|
||||
|
||||
@ -25,9 +25,8 @@ if !exists("s:USAGE")
|
||||
let s:USAGE = 0
|
||||
let s:WARNING = 1
|
||||
let s:ERROR = 2
|
||||
if exists("g:vimball_shq") && !exists("g:netrw_shq")
|
||||
let g:netrw_shq= g:vimball_shq
|
||||
endif
|
||||
|
||||
" determine if cygwin is in use or not
|
||||
if !exists("g:netrw_cygwin")
|
||||
if has("win32") || has("win95") || has("win64") || has("win16")
|
||||
if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
|
||||
@ -39,6 +38,25 @@ if !exists("s:USAGE")
|
||||
let g:netrw_cygwin= 0
|
||||
endif
|
||||
endif
|
||||
|
||||
" set up g:vimball_mkdir if the mkdir() call isn't defined
|
||||
if !exists("*mkdir")
|
||||
if exists("g:netrw_local_mkdir")
|
||||
let g:vimball_mkdir= g:netrw_local_mkdir
|
||||
elseif executable("mkdir")
|
||||
let g:vimball_mkdir= "mkdir"
|
||||
elseif executable("makedir")
|
||||
let g:vimball_mkdir= "makedir"
|
||||
endif
|
||||
if !exists(g:vimball_mkdir)
|
||||
call vimball#ShowMesg(s:WARNING,"(vimball) g:vimball_mkdir undefined")
|
||||
endif
|
||||
endif
|
||||
|
||||
" set up shell quoting character
|
||||
if exists("g:vimball_shq") && !exists("g:netrw_shq")
|
||||
let g:netrw_shq= g:vimball_shq
|
||||
endif
|
||||
if !exists("g:netrw_shq")
|
||||
if exists("&shq") && &shq != ""
|
||||
let g:netrw_shq= &shq
|
||||
@ -53,6 +71,8 @@ if !exists("s:USAGE")
|
||||
endif
|
||||
" call Decho("g:netrw_shq<".g:netrw_shq.">")
|
||||
endif
|
||||
|
||||
" set up escape string (used to protect paths)
|
||||
if !exists("g:vimball_path_escape")
|
||||
let g:vimball_path_escape= ' ;#%'
|
||||
endif
|
||||
@ -77,7 +97,7 @@ endif
|
||||
" [file]
|
||||
fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
||||
" call Dfunc("MkVimball(line1=".a:line1." line2=".a:line2." writelevel=".a:writelevel." vimballname<".a:1.">) a:0=".a:0)
|
||||
if a:1 =~ '.vim' || a:1 =~ '.txt'
|
||||
if a:1 =~ '\.vim$' || a:1 =~ '\.txt$'
|
||||
let vbname= substitute(a:1,'\.\a\{3}$','.vba','')
|
||||
else
|
||||
let vbname= a:1
|
||||
@ -98,7 +118,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
||||
endif
|
||||
|
||||
" user option bypass
|
||||
call s:SaveSettings()
|
||||
call vimball#SaveSettings()
|
||||
|
||||
if a:0 >= 2
|
||||
" allow user to specify where to get the files
|
||||
@ -124,7 +144,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
||||
if !filereadable(svfile)
|
||||
call vimball#ShowMesg(s:ERROR,"unable to read file<".svfile.">")
|
||||
call s:ChgDir(curdir)
|
||||
call s:RestoreSettings()
|
||||
call vimball#RestoreSettings()
|
||||
" call Dret("MkVimball")
|
||||
return
|
||||
endif
|
||||
@ -150,8 +170,8 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
||||
|
||||
" write the file from the tab
|
||||
let svfilepath= s:Path(svfile,'')
|
||||
" call Decho("exe $r ".svfilepath)
|
||||
exe "$r ".svfilepath
|
||||
" call Decho("exe $r ".fnameescape(svfilepath))
|
||||
exe "$r ".fnameescape(svfilepath)
|
||||
|
||||
call setline(lastline+1,line("$") - lastline - 1)
|
||||
" call Decho("lastline=".lastline." line$=".line("$"))
|
||||
@ -167,12 +187,12 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
||||
setlocal ff=unix
|
||||
if a:writelevel
|
||||
let vbnamepath= s:Path(vbname,'')
|
||||
" call Decho("exe w! ".vbnamepath)
|
||||
exe "w! ".vbnamepath
|
||||
" call Decho("exe w! ".fnameescape(vbnamepath))
|
||||
exe "w! ".fnameescape(vbnamepath)
|
||||
else
|
||||
let vbnamepath= s:Path(vbname,'')
|
||||
" call Decho("exe w ".vbnamepath)
|
||||
exe "w ".vbnamepath
|
||||
" call Decho("exe w ".fnameescape(vbnamepath))
|
||||
exe "w ".fnameescape(vbnamepath)
|
||||
endif
|
||||
" call Decho("Vimball<".vbname."> created")
|
||||
echo "Vimball<".vbname."> created"
|
||||
@ -183,7 +203,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
||||
exe "tabc ".vbtabnr
|
||||
|
||||
" restore options
|
||||
call s:RestoreSettings()
|
||||
call vimball#RestoreSettings()
|
||||
|
||||
" call Dret("MkVimball")
|
||||
endfun
|
||||
@ -202,7 +222,7 @@ fun! vimball#Vimball(really,...)
|
||||
endif
|
||||
|
||||
" set up standard settings
|
||||
call s:SaveSettings()
|
||||
call vimball#SaveSettings()
|
||||
let curtabnr = tabpagenr()
|
||||
let vimballfile = expand("%:tr")
|
||||
|
||||
@ -262,10 +282,10 @@ fun! vimball#Vimball(really,...)
|
||||
" call Decho("using L#".(linenr+1).": fsize=".fsize)
|
||||
|
||||
" Allow AsNeeded/ directory to take place of plugin/ directory
|
||||
" when AsNeeded/filename is filereadable
|
||||
" when AsNeeded/filename is filereadable or was present in VimballRecord
|
||||
if fname =~ '\<plugin/'
|
||||
let anfname= substitute(fname,'\<plugin/','AsNeeded/','')
|
||||
if filereadable(anfname)
|
||||
if filereadable(anfname) || (exists("s:VBRstring") && s:VBRstring =~ anfname)
|
||||
" call Decho("using anfname<".anfname."> instead of <".fname.">")
|
||||
let fname= anfname
|
||||
endif
|
||||
@ -283,7 +303,11 @@ fun! vimball#Vimball(really,...)
|
||||
" call Decho("dirname<".dirname.">")
|
||||
if !isdirectory(dirname)
|
||||
" call Decho("making <".dirname.">")
|
||||
call mkdir(dirname)
|
||||
if exists("g:vimball_mkdir")
|
||||
call system(g:vimball_mkdir." ".s:Escape(dirname))
|
||||
else
|
||||
call mkdir(dirname)
|
||||
endif
|
||||
call s:RecordInVar(home,"rmdir('".dirname."')")
|
||||
endif
|
||||
endwhile
|
||||
@ -309,10 +333,10 @@ fun! vimball#Vimball(really,...)
|
||||
" write tab to file
|
||||
if a:really
|
||||
let fnamepath= s:Path(home."/".fname,'')
|
||||
" call Decho("exe w! ".fnamepath)
|
||||
exe "silent w! ".fnamepath
|
||||
" call Decho("exe w! ".fnameescape(fnamepath))
|
||||
exe "silent w! ".fnameescape(fnamepath)
|
||||
echo "wrote ".fnamepath
|
||||
call s:RecordInVar(home,"call delete('".fnamepath."')")
|
||||
call s:RecordInVar(home,"call delete('".fnameescape(fnamepath)."')")
|
||||
endif
|
||||
|
||||
" return to tab with vimball
|
||||
@ -354,7 +378,7 @@ fun! vimball#Vimball(really,...)
|
||||
setlocal nomod bh=wipe
|
||||
exe "tabn ".curtabnr
|
||||
exe "tabc ".vbtabnr
|
||||
call s:RestoreSettings()
|
||||
call vimball#RestoreSettings()
|
||||
call s:ChgDir(curdir)
|
||||
|
||||
" call Dret("vimball#Vimball")
|
||||
@ -372,9 +396,6 @@ fun! vimball#RmVimball(...)
|
||||
" call Dret("vimball#RmVimball : (g:vimball_norecord)")
|
||||
return
|
||||
endif
|
||||
let eikeep= &ei
|
||||
set ei=all
|
||||
" call Decho("turned off all events")
|
||||
|
||||
if a:0 == 0
|
||||
let curfile= expand("%:tr")
|
||||
@ -420,7 +441,9 @@ fun! vimball#RmVimball(...)
|
||||
let foundit = 0
|
||||
endif
|
||||
if foundit
|
||||
let exestring= substitute(getline("."),'^'.curfile.'\S\{-}\.vba: ','','')
|
||||
let exestring = substitute(getline("."),'^'.curfile.'\S\{-}\.vba: ','','')
|
||||
let s:VBRstring= substitute(exestring,'call delete(','','g')
|
||||
let s:VBRstring= substitute(s:VBRstring,"[')]",'','g')
|
||||
" call Decho("exe ".exestring)
|
||||
silent! keepalt keepjumps exe exestring
|
||||
silent! keepalt keepjumps d
|
||||
@ -428,7 +451,8 @@ fun! vimball#RmVimball(...)
|
||||
" call Decho("exestring<".exestring.">")
|
||||
echomsg "removed ".exestring." files"
|
||||
else
|
||||
let curfile= substitute(curfile,'\.vba','','')
|
||||
let s:VBRstring= ''
|
||||
let curfile = substitute(curfile,'\.vba','','')
|
||||
" call Decho("unable to find <".curfile."> in .VimballRecord")
|
||||
if !exists("s:ok_unablefind")
|
||||
call vimball#ShowMesg(s:WARNING,"(RmVimball) unable to find <".curfile."> in .VimballRecord")
|
||||
@ -440,10 +464,6 @@ fun! vimball#RmVimball(...)
|
||||
endif
|
||||
call s:ChgDir(curdir)
|
||||
|
||||
" restoring events
|
||||
" call Decho("restoring events")
|
||||
let &ei= eikeep
|
||||
|
||||
" call Dret("vimball#RmVimball")
|
||||
endfun
|
||||
|
||||
@ -454,6 +474,7 @@ fun! vimball#Decompress(fname)
|
||||
|
||||
" decompression:
|
||||
if expand("%") =~ '.*\.gz' && executable("gunzip")
|
||||
" handle *.gz with gunzip
|
||||
silent exe "!gunzip ".s:Escape(a:fname)
|
||||
if v:shell_error != 0
|
||||
call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) gunzip may have failed with <".a:fname.">")
|
||||
@ -461,7 +482,19 @@ fun! vimball#Decompress(fname)
|
||||
let fname= substitute(a:fname,'\.gz$','','')
|
||||
exe "e ".escape(fname,' \')
|
||||
call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
|
||||
|
||||
elseif expand("%") =~ '.*\.gz' && executable("gzip")
|
||||
" handle *.gz with gzip -d
|
||||
silent exe "!gzip -d ".s:Escape(a:fname)
|
||||
if v:shell_error != 0
|
||||
call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "gzip -d" may have failed with <'.a:fname.">")
|
||||
endif
|
||||
let fname= substitute(a:fname,'\.gz$','','')
|
||||
exe "e ".escape(fname,' \')
|
||||
call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
|
||||
|
||||
elseif expand("%") =~ '.*\.bz2' && executable("bunzip2")
|
||||
" handle *.bz2 with bunzip2
|
||||
silent exe "!bunzip2 ".s:Escape(a:fname)
|
||||
if v:shell_error != 0
|
||||
call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) bunzip2 may have failed with <".a:fname.">")
|
||||
@ -469,7 +502,19 @@ fun! vimball#Decompress(fname)
|
||||
let fname= substitute(a:fname,'\.bz2$','','')
|
||||
exe "e ".escape(fname,' \')
|
||||
call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
|
||||
|
||||
elseif expand("%") =~ '.*\.bz2' && executable("bzip2")
|
||||
" handle *.bz2 with bzip2 -d
|
||||
silent exe "!bzip2 -d ".s:Escape(a:fname)
|
||||
if v:shell_error != 0
|
||||
call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "bzip2 -d" may have failed with <'.a:fname.">")
|
||||
endif
|
||||
let fname= substitute(a:fname,'\.bz2$','','')
|
||||
exe "e ".escape(fname,' \')
|
||||
call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
|
||||
|
||||
elseif expand("%") =~ '.*\.zip' && executable("unzip")
|
||||
" handle *.zip with unzip
|
||||
silent exe "!unzip ".s:Escape(a:fname)
|
||||
if v:shell_error != 0
|
||||
call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) unzip may have failed with <".a:fname.">")
|
||||
@ -478,6 +523,7 @@ fun! vimball#Decompress(fname)
|
||||
exe "e ".escape(fname,' \')
|
||||
call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
|
||||
endif
|
||||
|
||||
set noma bt=nofile fmr=[[[,]]] fdm=marker
|
||||
|
||||
" call Dret("Decompress")
|
||||
@ -518,9 +564,9 @@ endfun
|
||||
fun! s:ChgDir(newdir)
|
||||
" call Dfunc("ChgDir(newdir<".a:newdir.">)")
|
||||
if (has("win32") || has("win95") || has("win64") || has("win16"))
|
||||
exe 'silent cd '.escape(substitute(a:newdir,'/','\\','g'),' ')
|
||||
exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g'))
|
||||
else
|
||||
exe 'silent cd '.escape(a:newdir,' ')
|
||||
exe 'silent cd '.fnameescape(a:newdir)
|
||||
endif
|
||||
" call Dret("ChgDir : curdir<".getcwd().">")
|
||||
endfun
|
||||
@ -627,6 +673,11 @@ fun! s:VimballHome()
|
||||
" go to vim plugin home
|
||||
for home in split(&rtp,',') + ['']
|
||||
if isdirectory(home) && filewritable(home) | break | endif
|
||||
let basehome= substitute(home,'[/\\]\.vim$','','')
|
||||
if isdirectory(basehome) && filewritable(basehome)
|
||||
let home= basehome."/.vim"
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if home == ""
|
||||
" just pick the first directory
|
||||
@ -636,13 +687,25 @@ fun! s:VimballHome()
|
||||
let home= substitute(home,'/','\\','g')
|
||||
endif
|
||||
endif
|
||||
" insure that the home directory exists
|
||||
" call Decho("picked home<".home.">")
|
||||
if !isdirectory(home)
|
||||
if exists("g:vimball_mkdir")
|
||||
" call Decho("home<".home."> isn't a directory -- making it now with g:vimball_mkdir<".g:vimball_mkdir.">")
|
||||
" call Decho("system(".g:vimball_mkdir." ".s:Escape(home).")")
|
||||
call system(g:vimball_mkdir." ".s:Escape(home))
|
||||
else
|
||||
" call Decho("home<".home."> isn't a directory -- making it now with mkdir()")
|
||||
call mkdir(home)
|
||||
endif
|
||||
endif
|
||||
" call Dret("VimballHome <".home.">")
|
||||
return home
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:SaveSettings: {{{2
|
||||
fun! s:SaveSettings()
|
||||
" vimball#SaveSettings: {{{2
|
||||
fun! vimball#SaveSettings()
|
||||
" call Dfunc("SaveSettings()")
|
||||
let s:makeep = getpos("'a")
|
||||
let s:regakeep= @a
|
||||
@ -669,8 +732,8 @@ fun! s:SaveSettings()
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:RestoreSettings: {{{2
|
||||
fun! s:RestoreSettings()
|
||||
" vimball#RestoreSettings: {{{2
|
||||
fun! vimball#RestoreSettings()
|
||||
" call Dfunc("RestoreSettings()")
|
||||
let @a = s:regakeep
|
||||
if exists("&acd")
|
||||
|
106
vimfiles/doc/MultipleSearch.txt
Normal file
106
vimfiles/doc/MultipleSearch.txt
Normal file
@ -0,0 +1,106 @@
|
||||
*MultipleSearch.txt* Simultaneously show multiple search results Ver. 1.3
|
||||
|
||||
Maintainer: Dan Sharp <dwsharp at hotmail dot com>
|
||||
Last Changed: 13 Aug 2008
|
||||
License: Vim License
|
||||
|
||||
==============================================================================
|
||||
1. MultipleSearch Plugin *MultipleSearch*
|
||||
|
||||
MultipleSearch allows you to have the results of multiple searches displayed
|
||||
on the screen at the same time. Each search highlights its results in a
|
||||
different color, and all searches are displayed at once. After the maximum
|
||||
number of colors is used, the script starts over with the first color.
|
||||
|
||||
Special thanks to:
|
||||
Peter Valach for suggestions and testing!
|
||||
Jeff Mei for the suggesting and testing the :SearchBuffers command.
|
||||
Amber Hassan for fixing problems with a search pattern containing quote
|
||||
characters!
|
||||
Manuel Picaza for the mapping to :Search the word under the cursor.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2. Commands *MultipleSearch-commands*
|
||||
|
||||
:Search <pattern> *:Search*
|
||||
will highlight all occurrences of <pattern> in the current buffer. A
|
||||
subsequent :Search <pattern2> will highlight all occurrences of <pattern2>
|
||||
in the current buffer, retaining the highlighting of <pattern1> as well.
|
||||
<pattern1> and <pattern2> are any search pattern like you would use in a
|
||||
normal /<pattern> search.
|
||||
|
||||
The :Search command honors Vim's 'ignorecase' and 'smartcase' settings for
|
||||
its own search. You can use the |\c| and |\C| flags in the search pattern to
|
||||
force case matching no matter the setting of 'ignorecase' and 'smartcase'.
|
||||
|
||||
:SearchBuffers <pattern> *:SearchBuffers*
|
||||
The :SearchBuffers command works just like :Search, but the search occurs in
|
||||
all currently listed buffers (i.e., those that appear in the output of :ls).
|
||||
The match in all buffers will have the same color. This is different than
|
||||
:bufdo Search <pattern> because in that case, each buffer will highlight the
|
||||
match in a different color.
|
||||
|
||||
" Clear the current search selections and start over with the first color in
|
||||
" the sequence.
|
||||
:SearchReset
|
||||
To clear the highlighting, issue the command :SearchReset (for the current
|
||||
buffer) or :SearchBuffersReset (for all buffers).
|
||||
|
||||
" Clear the current search selections and start over with the first color in
|
||||
" the sequence.
|
||||
:SearchBuffersReset
|
||||
To clear the highlighting, issue the command :SearchReset (for the current
|
||||
buffer) or :SearchBuffersReset (for all buffers).
|
||||
|
||||
" Reinitialize the script after changing one of the global preferences.
|
||||
:SearchReinit
|
||||
If you change one of the preference variables, you can issue the command
|
||||
:SearchReinit
|
||||
to update the script with your new selections.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3. Mappings *MultipleSearch-mappings*
|
||||
|
||||
" Thanks to Manuel Picaza for the following mapping to :Search the word under
|
||||
" the cursor.
|
||||
nnoremap <silent> <Leader>*
|
||||
|
||||
" Following Manuel's idea, adapt the former 'Super Star' tip from vim.org to work with
|
||||
" :Search on a visual selection.
|
||||
vnoremap <silent> <Leader>*
|
||||
|
||||
" Set the current search pattern to the next one in the list
|
||||
nnoremap <silent> <Leader>n
|
||||
|
||||
" Set the current search pattern to the previous one in the list
|
||||
nnoremap <silent> <Leader>N
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4. Settings *MultipleSearch-settings*
|
||||
|
||||
You can specify the maximum number of different colors to use by setting the
|
||||
g:MultipleSearchMaxColors variable in your .vimrc. The default setting is
|
||||
four, but the script should handle as much as your terminal / GUI can
|
||||
display. The g:MultipleSearchColorSequence variable lets you list the
|
||||
colors you want displayed, and in what order. To make the text more
|
||||
readable, you can set the g:MultipleSearchTextColorSequence variable to a
|
||||
list of colors for the text, each position corresponding to the color in the
|
||||
same position in g:MultipleSearchColorSequence.
|
||||
|
||||
*g:MultipleSearchMaxColors*
|
||||
g:MultipleSearchMaxColors (Default: 8)
|
||||
Specifes a maximum number of colors to use.
|
||||
|
||||
*g:MultipleSearchColorSequence*
|
||||
g:MultipleSearchColorSequence (Default: "red,yellow,blue,green,magenta,
|
||||
cyan,gray,brown")
|
||||
Defines the sequence of colors to use for searches.
|
||||
|
||||
*g:MultipleSearchTextColorSequence*
|
||||
g:MultipleSearchTextColorSequence (Default: "white,black,white,black,white,
|
||||
black,black,white")
|
||||
Defines the text color for searches, so that it can still be read against
|
||||
the colored background.
|
||||
|
||||
==============================================================================
|
||||
vim: ft=help:norl:ts=8:tw=78
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
*pi_vimball.txt* For Vim version 7.1. Last change: 2008 Apr 01
|
||||
*pi_vimball.txt* For Vim version 7.1. Last change: 2008 May 30
|
||||
|
||||
----------------
|
||||
Vimball Archiver
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
|
||||
(remove NOSPAM from Campbell's email first)
|
||||
Copyright: (c) 2004-2007 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
||||
(see |copyright|) except use "Vimball" instead of "Vim".
|
||||
No warranty, express or implied.
|
||||
@ -16,15 +16,44 @@ Copyright: (c) 2004-2007 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
1. Contents *vba* *vimball* *vimball-contents*
|
||||
|
||||
1. Contents......................................: |vimball-contents|
|
||||
2. Vimball Manual................................: |vimball-manual|
|
||||
3. Vimball Manual................................: |vimball-manual|
|
||||
MkVimball.....................................: |:MkVimball|
|
||||
UseVimball....................................: |:UseVimball|
|
||||
RmVimball.....................................: |:RmVimball|
|
||||
3. Vimball History...............................: |vimball-history|
|
||||
4. Vimball History...............................: |vimball-history|
|
||||
|
||||
|
||||
==============================================================================
|
||||
2. Vimball Manual *vimball-manual*
|
||||
2. Vimball Introduction *vimball-intro*
|
||||
|
||||
Vimball is intended to make life simpler for users of plugins. All
|
||||
a user needs to do with a vimball is: >
|
||||
vim someplugin.vba
|
||||
:so %
|
||||
:q
|
||||
< and the plugin and all its components will be installed into their
|
||||
appropriate directories. Note that one doesn't need to be in any
|
||||
particular directory when one does this. Plus, any help for the
|
||||
plugin will also be automatically installed.
|
||||
|
||||
If a user has decided to use the AsNeeded plugin, vimball is smart
|
||||
enough to put scripts nominally intended for .vim/plugin/ into
|
||||
.vim/AsNeeded/ instead.
|
||||
|
||||
Removing a plugin that was installed with vimball is really easy: >
|
||||
vim
|
||||
:RmVimball someplugin
|
||||
< This operation is not at all easy for zips and tarballs, for example.
|
||||
|
||||
Vimball examines the user's |'runtimepath'| to determine where to put
|
||||
the scripts. The first directory mentioned on the runtimepath is
|
||||
usually used if possible. Use >
|
||||
:echo &rtp
|
||||
< to see that directory.
|
||||
|
||||
|
||||
==============================================================================
|
||||
3. Vimball Manual *vimball-manual*
|
||||
|
||||
*:MkVimball*
|
||||
:[range]MkVimball[!] filename [path]
|
||||
@ -49,6 +78,19 @@ Copyright: (c) 2004-2007 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
If you use the exclamation point (!), then MkVimball will create the
|
||||
"filename.vba" file, overwriting it if it already exists. This
|
||||
behavior resembles that for |:w|.
|
||||
|
||||
*g:vimball_mkdir*
|
||||
First, the |mkdir()| command is tried (not all systems support it).
|
||||
|
||||
If it doesn't exist, then g:vimball_mkdir doesn't exist, it is set to:
|
||||
|g:netrw_local_mkdir|, if it exists
|
||||
"mkdir", if it is executable
|
||||
"makedir", if it is executable
|
||||
Otherwise, it is undefined.
|
||||
One may explicitly specify the directory making command using
|
||||
g:vimball_mkdir. This command is used to make directories that
|
||||
are needed as indicated by the vimball.
|
||||
|
||||
*g:vimball_home*
|
||||
You may override the use of the |'runtimepath'| by specifying a
|
||||
variable, g:vimball_home.
|
||||
@ -96,10 +138,19 @@ Copyright: (c) 2004-2007 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
|
||||
|
||||
==============================================================================
|
||||
3. Vimball History *vimball-history* {{{1
|
||||
4. Vimball History *vimball-history* {{{1
|
||||
|
||||
26 : May 27, 2008 * g:vimball_mkdir usage installed. Makes the
|
||||
$HOME/.vim (or $HOME\vimfiles) directory if
|
||||
necessary.
|
||||
May 30, 2008 * (tnx to Bill McCarthy) found and fixed a bug:
|
||||
vimball wasn't updating plugins to AsNeeded/
|
||||
when it should
|
||||
25 : Mar 24, 2008 * changed vimball#Vimball() to recognize doc/*.??x
|
||||
files as help files, too.
|
||||
Apr 18, 2008 * RmVimball command is now protected by saving and
|
||||
restoring settings -- in particular, acd was
|
||||
causing problems as reported by Zhang Shuhan
|
||||
24 : Nov 15, 2007 * |g:vimball_path_escape| used by s:Path() to
|
||||
prevent certain characters from causing trouble
|
||||
22 : Mar 21, 2007 * uses setlocal instead of set during BufEnter
|
||||
|
@ -34,7 +34,7 @@ regions in vim scripts, HTML or JavaScript in php code etc.
|
||||
Key bindings~
|
||||
|
||||
Most of the time the default toggle keys will do what you want (or to be
|
||||
more precise: what I think it should to ;-).
|
||||
more precise: what I think you want it to do ;-).
|
||||
|
||||
*g:tcommentMapLeaderOp1*
|
||||
*g:tcommentMapLeaderOp2*
|
||||
|
@ -30,6 +30,8 @@
|
||||
:RM visincr.txt /*:RM*
|
||||
:Rexplore pi_netrw.txt /*:Rexplore*
|
||||
:RmVimball pi_vimball.txt /*:RmVimball*
|
||||
:Search MultipleSearch.txt /*:Search*
|
||||
:SearchBuffers MultipleSearch.txt /*:SearchBuffers*
|
||||
:Sexplore pi_netrw.txt /*:Sexplore*
|
||||
:TComment tComment.txt /*:TComment*
|
||||
:TCommentAs tComment.txt /*:TCommentAs*
|
||||
@ -51,6 +53,11 @@ IYMD visincr.txt /*IYMD*
|
||||
LogiPat() LogiPat.txt /*LogiPat()*
|
||||
LogiPat-flags LogiPat.txt /*LogiPat-flags*
|
||||
MatchError matchit.txt /*MatchError*
|
||||
MultipleSearch MultipleSearch.txt /*MultipleSearch*
|
||||
MultipleSearch-commands MultipleSearch.txt /*MultipleSearch-commands*
|
||||
MultipleSearch-mappings MultipleSearch.txt /*MultipleSearch-mappings*
|
||||
MultipleSearch-settings MultipleSearch.txt /*MultipleSearch-settings*
|
||||
MultipleSearch.txt MultipleSearch.txt /*MultipleSearch.txt*
|
||||
Nread pi_netrw.txt /*Nread*
|
||||
Nsource pi_netrw.txt /*Nsource*
|
||||
Nwrite pi_netrw.txt /*Nwrite*
|
||||
@ -1396,6 +1403,7 @@ crvdoc-licLGPL crefvimdoc.txt /*crvdoc-licLGPL*
|
||||
crvdoc-limbugs crefvimdoc.txt /*crvdoc-limbugs*
|
||||
crvdoc-usage crefvimdoc.txt /*crvdoc-usage*
|
||||
dav pi_netrw.txt /*dav*
|
||||
davs pi_netrw.txt /*davs*
|
||||
drv-dtArrayInit crefvim.txt /*drv-dtArrayInit*
|
||||
drv-dtIncompleteArrayDecl crefvim.txt /*drv-dtIncompleteArrayDecl*
|
||||
ex-visincr-I visincr.txt /*ex-visincr-I*
|
||||
@ -1409,13 +1417,17 @@ ex-visincr-IYMD visincr.txt /*ex-visincr-IYMD*
|
||||
fetch pi_netrw.txt /*fetch*
|
||||
ftp pi_netrw.txt /*ftp*
|
||||
g% matchit.txt /*g%*
|
||||
g:MultipleSearchColorSequence MultipleSearch.txt /*g:MultipleSearchColorSequence*
|
||||
g:MultipleSearchMaxColors MultipleSearch.txt /*g:MultipleSearchMaxColors*
|
||||
g:MultipleSearchTextColorSequence MultipleSearch.txt /*g:MultipleSearchTextColorSequence*
|
||||
g:NetrwTopLvlMenu pi_netrw.txt /*g:NetrwTopLvlMenu*
|
||||
g:netrw_alto pi_netrw.txt /*g:netrw_alto*
|
||||
g:netrw_altv pi_netrw.txt /*g:netrw_altv*
|
||||
g:netrw_browse_split pi_netrw.txt /*g:netrw_browse_split*
|
||||
g:netrw_browsex_viewer pi_netrw.txt /*g:netrw_browsex_viewer*
|
||||
g:netrw_cd_escape pi_netrw.txt /*g:netrw_cd_escape*
|
||||
g:netrw_compress pi_netrw.txt /*g:netrw_compress*
|
||||
g:netrw_ctags pi_netrw.txt /*g:netrw_ctags*
|
||||
g:netrw_cursorline pi_netrw.txt /*g:netrw_cursorline*
|
||||
g:netrw_cygwin pi_netrw.txt /*g:netrw_cygwin*
|
||||
g:netrw_dav_cmd pi_netrw.txt /*g:netrw_dav_cmd*
|
||||
g:netrw_decompress pi_netrw.txt /*g:netrw_decompress*
|
||||
@ -1456,10 +1468,10 @@ g:netrw_rsync_cmd pi_netrw.txt /*g:netrw_rsync_cmd*
|
||||
g:netrw_scp_cmd pi_netrw.txt /*g:netrw_scp_cmd*
|
||||
g:netrw_scpport pi_netrw.txt /*g:netrw_scpport*
|
||||
g:netrw_sftp_cmd pi_netrw.txt /*g:netrw_sftp_cmd*
|
||||
g:netrw_shq pi_netrw.txt /*g:netrw_shq*
|
||||
g:netrw_silent pi_netrw.txt /*g:netrw_silent*
|
||||
g:netrw_sort_by pi_netrw.txt /*g:netrw_sort_by*
|
||||
g:netrw_sort_direction pi_netrw.txt /*g:netrw_sort_direction*
|
||||
g:netrw_sort_options pi_netrw.txt /*g:netrw_sort_options*
|
||||
g:netrw_sort_sequence pi_netrw.txt /*g:netrw_sort_sequence*
|
||||
g:netrw_special_syntax pi_netrw.txt /*g:netrw_special_syntax*
|
||||
g:netrw_ssh_browse_reject pi_netrw.txt /*g:netrw_ssh_browse_reject*
|
||||
@ -1473,12 +1485,14 @@ g:netrw_use_noswf pi_netrw.txt /*g:netrw_use_noswf*
|
||||
g:netrw_use_nt_rcp pi_netrw.txt /*g:netrw_use_nt_rcp*
|
||||
g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp*
|
||||
g:netrw_winsize pi_netrw.txt /*g:netrw_winsize*
|
||||
g:netrw_xstrlen pi_netrw.txt /*g:netrw_xstrlen*
|
||||
g:tcommentMapLeader1 tComment.txt /*g:tcommentMapLeader1*
|
||||
g:tcommentMapLeader2 tComment.txt /*g:tcommentMapLeader2*
|
||||
g:tcommentMapLeaderOp1 tComment.txt /*g:tcommentMapLeaderOp1*
|
||||
g:tcommentMapLeaderOp2 tComment.txt /*g:tcommentMapLeaderOp2*
|
||||
g:tcommentOpModeExtra tComment.txt /*g:tcommentOpModeExtra*
|
||||
g:vimball_home pi_vimball.txt /*g:vimball_home*
|
||||
g:vimball_path_escape pi_vimball.txt /*g:vimball_path_escape*
|
||||
g:visincr_datedivset visincr.txt /*g:visincr_datedivset*
|
||||
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
||||
getscript pi_getscript.txt /*getscript*
|
||||
@ -1543,6 +1557,7 @@ matchit.txt matchit.txt /*matchit.txt*
|
||||
matchit.vim matchit.txt /*matchit.vim*
|
||||
netreadfixup pi_netrw.txt /*netreadfixup*
|
||||
netrw pi_netrw.txt /*netrw*
|
||||
netrw-% pi_netrw.txt /*netrw-%*
|
||||
netrw-- pi_netrw.txt /*netrw--*
|
||||
netrw-D pi_netrw.txt /*netrw-D*
|
||||
netrw-O pi_netrw.txt /*netrw-O*
|
||||
@ -1556,7 +1571,6 @@ netrw-bookmark pi_netrw.txt /*netrw-bookmark*
|
||||
netrw-bookmarks pi_netrw.txt /*netrw-bookmarks*
|
||||
netrw-browse pi_netrw.txt /*netrw-browse*
|
||||
netrw-browse-cmds pi_netrw.txt /*netrw-browse-cmds*
|
||||
netrw-browse-intro pi_netrw.txt /*netrw-browse-intro*
|
||||
netrw-browse-maps pi_netrw.txt /*netrw-browse-maps*
|
||||
netrw-browser pi_netrw.txt /*netrw-browser*
|
||||
netrw-browser-options pi_netrw.txt /*netrw-browser-options*
|
||||
@ -1571,7 +1585,6 @@ netrw-cr pi_netrw.txt /*netrw-cr*
|
||||
netrw-credits pi_netrw.txt /*netrw-credits*
|
||||
netrw-ctrl-h pi_netrw.txt /*netrw-ctrl-h*
|
||||
netrw-ctrl-l pi_netrw.txt /*netrw-ctrl-l*
|
||||
netrw-ctrl_h pi_netrw.txt /*netrw-ctrl_h*
|
||||
netrw-ctrl_l pi_netrw.txt /*netrw-ctrl_l*
|
||||
netrw-curdir pi_netrw.txt /*netrw-curdir*
|
||||
netrw-d pi_netrw.txt /*netrw-d*
|
||||
@ -1595,11 +1608,13 @@ netrw-gx pi_netrw.txt /*netrw-gx*
|
||||
netrw-handler pi_netrw.txt /*netrw-handler*
|
||||
netrw-help pi_netrw.txt /*netrw-help*
|
||||
netrw-hexplore pi_netrw.txt /*netrw-hexplore*
|
||||
netrw-hide pi_netrw.txt /*netrw-hide*
|
||||
netrw-hiding pi_netrw.txt /*netrw-hiding*
|
||||
netrw-history pi_netrw.txt /*netrw-history*
|
||||
netrw-horiz pi_netrw.txt /*netrw-horiz*
|
||||
netrw-i pi_netrw.txt /*netrw-i*
|
||||
netrw-incompatible pi_netrw.txt /*netrw-incompatible*
|
||||
netrw-intro-browse pi_netrw.txt /*netrw-intro-browse*
|
||||
netrw-list pi_netrw.txt /*netrw-list*
|
||||
netrw-listbookmark pi_netrw.txt /*netrw-listbookmark*
|
||||
netrw-listhack pi_netrw.txt /*netrw-listhack*
|
||||
@ -1610,6 +1625,7 @@ netrw-mc pi_netrw.txt /*netrw-mc*
|
||||
netrw-md pi_netrw.txt /*netrw-md*
|
||||
netrw-me pi_netrw.txt /*netrw-me*
|
||||
netrw-mf pi_netrw.txt /*netrw-mf*
|
||||
netrw-mg pi_netrw.txt /*netrw-mg*
|
||||
netrw-mh pi_netrw.txt /*netrw-mh*
|
||||
netrw-ml_get pi_netrw.txt /*netrw-ml_get*
|
||||
netrw-mm pi_netrw.txt /*netrw-mm*
|
||||
@ -1652,6 +1668,11 @@ netrw-psftp pi_netrw.txt /*netrw-psftp*
|
||||
netrw-putty pi_netrw.txt /*netrw-putty*
|
||||
netrw-qb pi_netrw.txt /*netrw-qb*
|
||||
netrw-qf pi_netrw.txt /*netrw-qf*
|
||||
netrw-quickcom pi_netrw.txt /*netrw-quickcom*
|
||||
netrw-quickcoms pi_netrw.txt /*netrw-quickcoms*
|
||||
netrw-quickhelp pi_netrw.txt /*netrw-quickhelp*
|
||||
netrw-quickmap pi_netrw.txt /*netrw-quickmap*
|
||||
netrw-quickmaps pi_netrw.txt /*netrw-quickmaps*
|
||||
netrw-r pi_netrw.txt /*netrw-r*
|
||||
netrw-read pi_netrw.txt /*netrw-read*
|
||||
netrw-ref pi_netrw.txt /*netrw-ref*
|
||||
|
51
vimfiles/plugin/MultipleSearch.vim
Normal file
51
vimfiles/plugin/MultipleSearch.vim
Normal file
@ -0,0 +1,51 @@
|
||||
" File: MultipleSearch.vim (global plugin)
|
||||
" Last Changed: 14 Aug 2008
|
||||
" Maintainer: Dan Sharp <dwsharp at hotmail dot com>
|
||||
" Version: 1.3
|
||||
" License: Vim License
|
||||
" GetLatestVimScripts: 479 1 :AutoInstall: MultipleSearch.vba
|
||||
|
||||
if exists('loaded_multiplesearch')
|
||||
finish
|
||||
endif
|
||||
let loaded_multiplesearch = 1
|
||||
|
||||
|
||||
" Vim versions prior to 7.0 don't support the autoload mechanism, so go ahead
|
||||
" and load the 'autoload' segment of the code and map the commands using the
|
||||
" non-autoload format.
|
||||
if v:version < 700
|
||||
runtime autoload/MultipleSearch.vim
|
||||
|
||||
if !(exists(":SearchBuffers") == 2)
|
||||
command -nargs=* SearchBuffers :silent call MultipleSearch(1, <q-args>)
|
||||
endif
|
||||
|
||||
if !(exists(":Search") == 2)
|
||||
command -nargs=* Search :silent call MultipleSearch(0, <q-args>)
|
||||
endif
|
||||
|
||||
" Following Manuel's idea, adapt the former 'Super Star' tip from vim.org to work with
|
||||
" :Search on a visual selection.
|
||||
"vnoremap <silent> <Leader>* y:execute ':Search \V<C-R>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR>'<CR>
|
||||
vnoremap <silent> <Leader>* y:call MultipleSearch(0,'\V'.substitute(escape(@@,"\\/\"'"),"\n",'\\n','ge'))<CR>
|
||||
else
|
||||
" Only autoload the Search commands, since we shouldn't need to use
|
||||
" :SearchReset and :SearchReinit until after the first :Search.
|
||||
if !(exists(":SearchBuffers") == 2)
|
||||
command -nargs=* SearchBuffers :silent call MultipleSearch#MultipleSearch(1, <q-args>)
|
||||
endif
|
||||
|
||||
if !(exists(":Search") == 2)
|
||||
command -nargs=* Search :silent call MultipleSearch#MultipleSearch(0, <q-args>)
|
||||
endif
|
||||
|
||||
" Following Manuel's idea, adapt the former 'Super Star' tip from vim.org to work with
|
||||
" :Search on a visual selection.
|
||||
vnoremap <silent> <Leader>* y:call MultipleSearch#MultipleSearch(0,'\V'.substitute(escape(@@,"\\/\"'"),"\n",'\\n','ge'))<CR>
|
||||
endif
|
||||
|
||||
" Thanks to Manuel Picaza for the following mapping to :Search the word under
|
||||
" the cursor.
|
||||
nnoremap <silent> <Leader>* :execute ':Search \<' . expand('<cword>') . '\>'<cr>
|
||||
|
@ -22,10 +22,16 @@
|
||||
" Doesn't work if multiple windows exist before script started. In
|
||||
" that case the script will abort with error message.
|
||||
"
|
||||
" If the current buffer is modified, some error messages will appear
|
||||
" before the script starts, and an extra window is left behind after
|
||||
" the script exits. Workaround: save your buffers first.
|
||||
"
|
||||
"Other Info:
|
||||
" Inspired by cmatrix...
|
||||
" Didn't feel inspired enough to start using pico/nano, of course ^_^;
|
||||
"
|
||||
" 05/13/08 - disable cursorline, cursorcolumn and spell
|
||||
" (thanks to Diederick Niehorster for the suggestion).
|
||||
" 12/21/06 - multiwindow support by S. Lockwood-Childs.
|
||||
" 10/03/05 - added silent! to cursor positioning code to stop drawing
|
||||
" numbers during animation (thanks to David Eggum for the
|
||||
@ -199,6 +205,12 @@ function! s:Init()
|
||||
let s:o_ts = &titlestring
|
||||
exec 'set titlestring=\ '
|
||||
endif
|
||||
if v:version >= 700
|
||||
let s:o_spell = &spell
|
||||
let s:o_cul = &cul
|
||||
let s:o_cuc = &cuc
|
||||
set nospell nocul nocuc
|
||||
endif
|
||||
let s:o_ch = &ch
|
||||
let s:o_ls = &ls
|
||||
let s:o_lz = &lz
|
||||
@ -259,6 +271,12 @@ function! s:Cleanup()
|
||||
let &titlestring = s:o_ts
|
||||
unlet s:o_ts
|
||||
endif
|
||||
if v:version >= 700
|
||||
let &spell = s:o_spell
|
||||
let &cul = s:o_cul
|
||||
let &cuc = s:o_cuc
|
||||
unlet s:o_cul s:o_cuc
|
||||
endif
|
||||
let &ch = s:o_ch
|
||||
let &ls = s:o_ls
|
||||
let &lz = s:o_lz
|
||||
@ -298,9 +316,9 @@ function! Matrix()
|
||||
endfunction
|
||||
|
||||
|
||||
if !has('virtualedit') || !has('windows')
|
||||
if !has('virtualedit') || !has('windows') || !has('syntax')
|
||||
echohl ErrorMsg
|
||||
echon 'Not enough features, need at least +virtualedit and +windows'
|
||||
echon 'Not enough features, need at least +virtualedit, +windows and +syntax'
|
||||
echohl None
|
||||
else
|
||||
command! Matrix call Matrix()
|
||||
|
@ -1,9 +1,9 @@
|
||||
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
|
||||
" PLUGIN SECTION
|
||||
" Date: Aug 09, 2007
|
||||
" Date: Aug 10, 2008
|
||||
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
|
||||
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
|
||||
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
|
||||
" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
@ -22,7 +22,7 @@
|
||||
if &cp || exists("g:loaded_netrwPlugin")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwPlugin = "v123"
|
||||
let g:loaded_netrwPlugin = "v133"
|
||||
let s:keepcpo = &cpo
|
||||
if v:version < 700
|
||||
echohl WarningMsg | echo "***netrw*** you need vim version 7.0 for this version of netrw" | echohl None
|
||||
@ -47,19 +47,19 @@ augroup END
|
||||
augroup Network
|
||||
au!
|
||||
if has("win32") || has("win95") || has("win64") || has("win16")
|
||||
au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',"")|exe "bwipe ".expand("<amatch>")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>"))
|
||||
au BufReadCmd file://* exe "silent doau BufReadPre ".fnameescape(netrw#RFC2396(expand("<amatch>")))|exe 'e '.fnameescape(substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',""))|exe "bwipe ".fnameescape(expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(netrw#RFC2396(expand("<amatch>")))
|
||||
else
|
||||
au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',"")|exe "bwipe ".expand("<amatch>")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>"))
|
||||
au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://localhost/\(.*\)','\1',"")|exe "bwipe ".substitute(expand("<amatch>"),'file://\(\k\+@\)\=','','')|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>"))
|
||||
au BufReadCmd file://* exe "silent doau BufReadPre ".fnameescape(netrw#RFC2396(expand("<amatch>")))|exe 'e '.fnameescape(substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',""))|exe "bwipe ".fnameescape(expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(netrw#RFC2396(expand("<amatch>")))
|
||||
au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".fnameescape(netrw#RFC2396(expand("<amatch>")))|exe 'e '.fnameescape(substitute(netrw#RFC2396(expand("<amatch>")),'file://localhost/\(.*\)','\1',""))|exe "bwipe ".fnameescape(substitute(expand("<amatch>"),'file://\(\k\+@\)\=','',''))|exe "silent doau BufReadPost ".fnameescape(netrw#RFC2396(expand("<amatch>")))
|
||||
endif
|
||||
au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<amatch>")|exe '2Nread "'.expand("<amatch>").'"'|exe "silent doau BufReadPost ".expand("<amatch>")
|
||||
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau FileReadPre ".expand("<amatch>")|exe 'Nread "' .expand("<amatch>").'"'|exe "silent doau FileReadPost ".expand("<amatch>")
|
||||
au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<amatch>")|exe 'Nwrite "' .expand("<amatch>").'"'|exe "silent doau BufWritePost ".expand("<amatch>")
|
||||
au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau FileWritePre ".expand("<amatch>")|exe "'[,']".'Nwrite "' .expand("<amatch>").'"'|exe "silent doau FileWritePost ".expand("<amatch>")
|
||||
au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufReadPre ".fnameescape(expand("<amatch>"))|exe '2Nread '.fnameescape(expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(expand("<amatch>"))
|
||||
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau FileReadPre ".fnameescape(expand("<amatch>"))|exe 'Nread '.fnameescape(expand("<amatch>"))|exe "silent doau FileReadPost ".fnameescape(expand("<amatch>"))
|
||||
au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "silent doau BufWritePost ".fnameescape(expand("<amatch>"))
|
||||
au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "silent doau FileWritePost ".fnameescape(expand("<amatch>"))
|
||||
try
|
||||
au SourceCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("<amatch>").'"'
|
||||
au SourceCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
|
||||
catch /^Vim\%((\a\+)\)\=:E216/
|
||||
au SourcePre ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("<amatch>").'"'
|
||||
au SourcePre ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
|
||||
endtry
|
||||
augroup END
|
||||
|
||||
@ -87,7 +87,7 @@ if !exists("g:netrw_nogx") && maparg('g','n') == ""
|
||||
if !hasmapto('<Plug>NetrwBrowseX')
|
||||
nmap <unique> gx <Plug>NetrwBrowseX
|
||||
endif
|
||||
nno <silent> <Plug>NetrwBrowseX :call netrw#NetBrowseX(expand("<cWORD>"),0)<cr>
|
||||
nno <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<cr>
|
||||
endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
@ -155,24 +155,6 @@ fun! NetUserPass(...)
|
||||
" call Dret("NetUserPass")
|
||||
endfun
|
||||
|
||||
" ------------------------------------------------------------------------
|
||||
" NetReadFixup: this sort of function is typically written by the user {{{1
|
||||
" to handle extra junk that their system's ftp dumps
|
||||
" into the transfer. This function is provided as an
|
||||
" example and as a fix for a Windows 95 problem: in my
|
||||
" experience, win95's ftp always dumped four blank lines
|
||||
" at the end of the transfer.
|
||||
if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
|
||||
fun! NetReadFixup(method, line1, line2)
|
||||
" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
|
||||
if method == 3 " ftp (no <.netrc>)
|
||||
let fourblanklines= line2 - 3
|
||||
silent fourblanklines.",".line2."g/^\s*/d"
|
||||
endif
|
||||
" call Dret("NetReadFixup")
|
||||
endfun
|
||||
endif
|
||||
|
||||
" ------------------------------------------------------------------------
|
||||
" Modelines And Restoration: {{{1
|
||||
let &cpo= s:keepcpo
|
||||
|
@ -2,44 +2,62 @@
|
||||
" @Author: Thomas Link (micathom AT gmail com)
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 27-Dez-2004.
|
||||
" @Last Change: 2007-08-30.
|
||||
" @Revision: 1.7.608
|
||||
" @Last Change: 2008-05-15.
|
||||
" @Revision: 1.9.664
|
||||
"
|
||||
" vimscript #1173
|
||||
" GetLatestVimScripts: 1173 1 tComment.vim
|
||||
|
||||
if &cp || exists('loaded_tcomment')
|
||||
finish
|
||||
endif
|
||||
let loaded_tcomment = 107
|
||||
|
||||
function! s:DefVar(name, val)
|
||||
if !exists(a:name)
|
||||
" exec "let ". a:name ."='". a:val ."'"
|
||||
exec 'let '. a:name .'="'. escape(a:val, '"\') .'"'
|
||||
endif
|
||||
endf
|
||||
let loaded_tcomment = 109
|
||||
|
||||
" If true, comment blank lines too
|
||||
call s:DefVar('g:tcommentBlankLines', 1)
|
||||
if !exists("g:tcommentBlankLines")
|
||||
let g:tcommentBlankLines = 1
|
||||
endif
|
||||
|
||||
call s:DefVar('g:tcommentMapLeader1', '<c-_>')
|
||||
call s:DefVar('g:tcommentMapLeader2', '<Leader>_')
|
||||
" call s:DefVar('g:tcommentMapLeaderOp1', '<Leader>-')
|
||||
call s:DefVar('g:tcommentMapLeaderOp1', 'gc')
|
||||
call s:DefVar('g:tcommentMapLeaderOp2', 'gC')
|
||||
call s:DefVar('g:tcommentOpModeExtra', '')
|
||||
if !exists("g:tcommentMapLeader1")
|
||||
let g:tcommentMapLeader1 = '<c-_>'
|
||||
endif
|
||||
if !exists("g:tcommentMapLeader2")
|
||||
let g:tcommentMapLeader2 = '<Leader>_'
|
||||
endif
|
||||
if !exists("g:tcommentMapLeaderOp1")
|
||||
let g:tcommentMapLeaderOp1 = 'gc'
|
||||
endif
|
||||
if !exists("g:tcommentMapLeaderOp2")
|
||||
let g:tcommentMapLeaderOp2 = 'gC'
|
||||
endif
|
||||
if !exists("g:tcommentOpModeExtra")
|
||||
let g:tcommentOpModeExtra = ''
|
||||
endif
|
||||
|
||||
" Guess the file type based on syntax names always or for some fileformat only
|
||||
call s:DefVar('g:tcommentGuessFileType', 0)
|
||||
if !exists("g:tcommentGuessFileType")
|
||||
let g:tcommentGuessFileType = 0
|
||||
endif
|
||||
" In php documents, the php part is usually marked as phpRegion. We thus
|
||||
" assume that the buffers default comment style isn't php but html
|
||||
call s:DefVar('g:tcommentGuessFileType_dsl', 'xml')
|
||||
call s:DefVar('g:tcommentGuessFileType_php', 'html')
|
||||
call s:DefVar('g:tcommentGuessFileType_html', 1)
|
||||
call s:DefVar('g:tcommentGuessFileType_tskeleton', 1)
|
||||
call s:DefVar('g:tcommentGuessFileType_vim', 1)
|
||||
if !exists("g:tcommentGuessFileType_dsl")
|
||||
let g:tcommentGuessFileType_dsl = 'xml'
|
||||
endif
|
||||
if !exists("g:tcommentGuessFileType_php")
|
||||
let g:tcommentGuessFileType_php = 'html'
|
||||
endif
|
||||
if !exists("g:tcommentGuessFileType_html")
|
||||
let g:tcommentGuessFileType_html = 1
|
||||
endif
|
||||
if !exists("g:tcommentGuessFileType_tskeleton")
|
||||
let g:tcommentGuessFileType_tskeleton = 1
|
||||
endif
|
||||
if !exists("g:tcommentGuessFileType_vim")
|
||||
let g:tcommentGuessFileType_vim = 1
|
||||
endif
|
||||
|
||||
call s:DefVar('g:tcommentIgnoreTypes_php', 'sql')
|
||||
if !exists("g:tcommentIgnoreTypes_php")
|
||||
let g:tcommentIgnoreTypes_php = 'sql'
|
||||
endif
|
||||
|
||||
if !exists('g:tcommentSyntaxMap') "{{{2
|
||||
let g:tcommentSyntaxMap = {
|
||||
@ -61,30 +79,45 @@ endif
|
||||
|
||||
" I personally find this style rather irritating but here is an alternative
|
||||
" definition that does this left-handed bar thing
|
||||
call s:DefVar('g:tcommentBlockC', "/*%s */\n * ")
|
||||
call s:DefVar('g:tcommentBlockC2', "/**%s */\n * ")
|
||||
" call s:DefVar('g:tcommentBlockC', "/*%s */\n ")
|
||||
call s:DefVar('g:tcommentInlineC', "/* %s */")
|
||||
if !exists("g:tcommentBlockC")
|
||||
let g:tcommentBlockC = "/*%s */\n * "
|
||||
endif
|
||||
if !exists("g:tcommentBlockC2")
|
||||
let g:tcommentBlockC2 = "/**%s */\n * "
|
||||
endif
|
||||
if !exists("g:tcommentInlineC")
|
||||
let g:tcommentInlineC = "/* %s */"
|
||||
endif
|
||||
|
||||
call s:DefVar('g:tcommentBlockXML', "<!--%s-->\n ")
|
||||
call s:DefVar('g:tcommentInlineXML', "<!-- %s -->")
|
||||
if !exists("g:tcommentBlockXML")
|
||||
let g:tcommentBlockXML = "<!--%s-->\n "
|
||||
endif
|
||||
if !exists("g:tcommentInlineXML")
|
||||
let g:tcommentInlineXML = "<!-- %s -->"
|
||||
endif
|
||||
|
||||
let g:tcommentFileTypesDirty = 1
|
||||
|
||||
" Currently this function just sets a variable
|
||||
function! TCommentDefineType(name, commentstring)
|
||||
call s:DefVar('g:tcomment_'. a:name, a:commentstring)
|
||||
let s:tcommentFileTypesDirty = 1
|
||||
if !exists('g:tcomment_'. a:name)
|
||||
let g:tcomment_{a:name} = a:commentstring
|
||||
endif
|
||||
let g:tcommentFileTypesDirty = 1
|
||||
endf
|
||||
|
||||
function! TCommentTypeExists(name)
|
||||
return exists('g:tcomment_'. a:name)
|
||||
endf
|
||||
|
||||
call TCommentDefineType('aap', '# %s' )
|
||||
call TCommentDefineType('ada', '-- %s' )
|
||||
call TCommentDefineType('apache', '# %s' )
|
||||
call TCommentDefineType('autoit', '; %s' )
|
||||
call TCommentDefineType('asm', '; %s' )
|
||||
call TCommentDefineType('awk', '# %s' )
|
||||
call TCommentDefineType('catalog', '-- %s --' )
|
||||
call TCommentDefineType('catalog_block', '--%s--\n ' )
|
||||
call TCommentDefineType('catalog_block', "--%s--\n " )
|
||||
call TCommentDefineType('cpp', '// %s' )
|
||||
call TCommentDefineType('cpp_inline', g:tcommentInlineC )
|
||||
call TCommentDefineType('cpp_block', g:tcommentBlockC )
|
||||
@ -105,9 +138,11 @@ call TCommentDefineType('dosini', '; %s' )
|
||||
call TCommentDefineType('dsl', '; %s' )
|
||||
call TCommentDefineType('dylan', '// %s' )
|
||||
call TCommentDefineType('eiffel', '-- %s' )
|
||||
call TCommentDefineType('eruby', '<%%# %s%%>' )
|
||||
call TCommentDefineType('gtkrc', '# %s' )
|
||||
call TCommentDefineType('gitcommit', '# %s' )
|
||||
call TCommentDefineType('haskell', '-- %s' )
|
||||
call TCommentDefineType('haskell_block', '{-%s-}\n ' )
|
||||
call TCommentDefineType('haskell_block', "{-%s-}\n " )
|
||||
call TCommentDefineType('haskell_inline', '{- %s -}' )
|
||||
call TCommentDefineType('html', '<!-- %s -->' )
|
||||
call TCommentDefineType('html_inline', g:tcommentInlineXML)
|
||||
@ -122,32 +157,37 @@ call TCommentDefineType('javascript_block', g:tcommentBlockC )
|
||||
call TCommentDefineType('java', '/* %s */' )
|
||||
call TCommentDefineType('java_inline', g:tcommentInlineC )
|
||||
call TCommentDefineType('java_block', g:tcommentBlockC )
|
||||
call TCommentDefineType('java_doc_block', g:tcommentBlockC2 )
|
||||
call TCommentDefineType('lisp', '; %s' )
|
||||
call TCommentDefineType('m4', 'dnl %s' )
|
||||
call TCommentDefineType('mail', '> %s' )
|
||||
call TCommentDefineType('msidl', '// %s' )
|
||||
call TCommentDefineType('msidl_block', g:tcommentBlockC )
|
||||
call TCommentDefineType('nroff', '.\\" %s' )
|
||||
call TCommentDefineType('nsis', '# %s' )
|
||||
call TCommentDefineType('objc', '/* %s */' )
|
||||
call TCommentDefineType('objc_inline', g:tcommentInlineC )
|
||||
call TCommentDefineType('objc_block', g:tcommentBlockC )
|
||||
call TCommentDefineType('ocaml', '(* %s *)' )
|
||||
call TCommentDefineType('ocaml_inline', '(* %s *)' )
|
||||
call TCommentDefineType('ocaml_block', '(*%s*)\n ' )
|
||||
call TCommentDefineType('ocaml_block', "(*%s*)\n " )
|
||||
call TCommentDefineType('pascal', '(* %s *)' )
|
||||
call TCommentDefineType('pascal_inline', '(* %s *)' )
|
||||
call TCommentDefineType('pascal_block', '(*%s*)\n ' )
|
||||
call TCommentDefineType('pascal_block', "(*%s*)\n " )
|
||||
call TCommentDefineType('perl', '# %s' )
|
||||
call TCommentDefineType('perl_block', '=cut%s=cut' )
|
||||
call TCommentDefineType('perl_block', "=cut%s=cut" )
|
||||
call TCommentDefineType('php', '// %s' )
|
||||
call TCommentDefineType('php_inline', g:tcommentInlineC )
|
||||
call TCommentDefineType('php_block', g:tcommentBlockC )
|
||||
call TCommentDefineType('php_2_block', g:tcommentBlockC2 )
|
||||
call TCommentDefineType('po', '# %s' )
|
||||
call TCommentDefineType('prolog', '%% %s' )
|
||||
call TCommentDefineType('rc', '// %s' )
|
||||
call TCommentDefineType('readline', '# %s' )
|
||||
call TCommentDefineType('ruby', '# %s' )
|
||||
call TCommentDefineType('ruby_3', '### %s' )
|
||||
call TCommentDefineType('ruby_block', '=begin rdoc%s=end')
|
||||
call TCommentDefineType('ruby_nodoc_block', '=begin%s=end' )
|
||||
call TCommentDefineType('ruby_block', "=begin rdoc%s=end")
|
||||
call TCommentDefineType('ruby_nodoc_block', "=begin%s=end" )
|
||||
call TCommentDefineType('r', '# %s' )
|
||||
call TCommentDefineType('sbs', "' %s" )
|
||||
call TCommentDefineType('scheme', '; %s' )
|
||||
@ -159,7 +199,9 @@ call TCommentDefineType('sh', '# %s' )
|
||||
call TCommentDefineType('sql', '-- %s' )
|
||||
call TCommentDefineType('spec', '# %s' )
|
||||
call TCommentDefineType('sps', '* %s.' )
|
||||
call TCommentDefineType('sps_block', '* %s.' )
|
||||
call TCommentDefineType('sps_block', "* %s." )
|
||||
call TCommentDefineType('spss', '* %s.' )
|
||||
call TCommentDefineType('spss_block', "* %s." )
|
||||
call TCommentDefineType('tcl', '# %s' )
|
||||
call TCommentDefineType('tex', '%% %s' )
|
||||
call TCommentDefineType('tpl', '<!-- %s -->' )
|
||||
@ -172,211 +214,34 @@ call TCommentDefineType('websec', '# %s' )
|
||||
call TCommentDefineType('xml', '<!-- %s -->' )
|
||||
call TCommentDefineType('xml_inline', g:tcommentInlineXML)
|
||||
call TCommentDefineType('xml_block', g:tcommentBlockXML )
|
||||
call TCommentDefineType('xs', '// %s' )
|
||||
call TCommentDefineType('xs_block', g:tcommentBlockC )
|
||||
call TCommentDefineType('xslt', '<!-- %s -->' )
|
||||
call TCommentDefineType('xslt_inline', g:tcommentInlineXML)
|
||||
call TCommentDefineType('xslt_block', g:tcommentBlockXML )
|
||||
call TCommentDefineType('yaml', '# %s' )
|
||||
|
||||
let s:tcommentFileTypesDirty = 1
|
||||
|
||||
function! s:DefaultValue(option)
|
||||
exec 'let '. a:option .' = &'. a:option
|
||||
exec 'set '. a:option .'&'
|
||||
exec 'let default = &'. a:option
|
||||
exec 'let &'. a:option .' = '. a:option
|
||||
return default
|
||||
endf
|
||||
|
||||
let s:defaultComments = s:DefaultValue('comments')
|
||||
let s:defaultCommentString = s:DefaultValue('commentstring')
|
||||
let s:nullCommentString = '%s'
|
||||
|
||||
" TComment(line1, line2, ?commentMode, ?commentAnyway, ?commentBegin, ?commentEnd)
|
||||
" commentMode:
|
||||
" G ... guess
|
||||
" B ... block
|
||||
" I ... inline
|
||||
" R ... right
|
||||
function! TComment(beg, end, ...)
|
||||
" save the cursor position
|
||||
let co = col('.')
|
||||
let li = line('.')
|
||||
let s:pos_end = getpos("'>")
|
||||
let commentMode = a:0 >= 1 ? a:1 : 'G'
|
||||
let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0
|
||||
if commentMode =~# 'i'
|
||||
let commentMode = substitute(commentMode, '\Ci', line("'<") == line("'>") ? 'I' : 'G', 'g')
|
||||
endif
|
||||
if commentMode =~# 'R' || commentMode =~# 'I'
|
||||
let cstart = col("'<")
|
||||
if cstart == 0
|
||||
let cstart = col('.')
|
||||
endif
|
||||
if commentMode =~# 'R'
|
||||
let commentMode = substitute(commentMode, '\CR', 'G', 'g')
|
||||
let cend = 0
|
||||
else
|
||||
let cend = col("'>")
|
||||
endif
|
||||
else
|
||||
let cstart = 0
|
||||
let cend = 0
|
||||
endif
|
||||
" TLogVAR commentMode, cstart, cend
|
||||
" get the correct commentstring
|
||||
if a:0 >= 3 && a:3 != ''
|
||||
let cms = s:EncodeCommentPart(a:3) .'%s'
|
||||
if a:0 >= 4 && a:4 != ''
|
||||
let cms = cms . s:EncodeCommentPart(a:4)
|
||||
endif
|
||||
else
|
||||
let [cms, commentMode] = s:GetCommentString(a:beg, a:end, commentMode)
|
||||
endif
|
||||
let cms0 = s:BlockGetCommentString(cms)
|
||||
let cms0 = escape(cms0, '\')
|
||||
" make whitespace optional; this conflicts with comments that require some
|
||||
" whitespace
|
||||
let cmtCheck = substitute(cms0, '\([ ]\)', '\1\\?', 'g')
|
||||
" turn commentstring into a search pattern
|
||||
let cmtCheck = s:SPrintF(cmtCheck, '\(\_.\{-}\)')
|
||||
" set commentMode and indentStr
|
||||
let [indentStr, uncomment] = s:CommentDef(a:beg, a:end, cmtCheck, commentMode, cstart, cend)
|
||||
" TLogVAR indentStr, uncomment
|
||||
if commentAnyway
|
||||
let uncomment = 0
|
||||
endif
|
||||
" go
|
||||
if commentMode =~# 'B'
|
||||
" We want a comment block
|
||||
call s:CommentBlock(a:beg, a:end, uncomment, cmtCheck, cms, indentStr)
|
||||
else
|
||||
" We want commented lines
|
||||
" final search pattern for uncommenting
|
||||
let cmtCheck = escape('\V\^\(\s\{-}\)'. cmtCheck .'\$', '"/\')
|
||||
" final pattern for commenting
|
||||
let cmtReplace = escape(cms0, '"/')
|
||||
silent exec a:beg .','. a:end .'s/\V'.
|
||||
\ s:StartRx(cstart) . indentStr .'\zs\(\.\*\)'. s:EndRx(cend) .'/'.
|
||||
\ '\=s:ProcessedLine('. uncomment .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
|
||||
endif
|
||||
" reposition cursor
|
||||
" TLogVAR commentMode
|
||||
if commentMode =~ '>'
|
||||
call setpos('.', s:pos_end)
|
||||
else
|
||||
" TLogVAR li, co
|
||||
call cursor(li, co)
|
||||
endif
|
||||
endf
|
||||
|
||||
" :line1,line2 TComment ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TComment keepjumps call TComment(<line1>, <line2>, 'G', "<bang>", <f-args>)
|
||||
|
||||
" :line1,line2 TCommentRight ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TCommentRight keepjumps call TComment(<line1>, <line2>, 'R', "<bang>", <f-args>)
|
||||
|
||||
" :line1,line2 TCommentBlock ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TCommentBlock keepjumps call TComment(<line1>, <line2>, 'B', "<bang>", <f-args>)
|
||||
|
||||
" :line1,line2 TCommentInline ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TCommentInline keepjumps call TComment(<line1>, <line2>, 'I', "<bang>", <f-args>)
|
||||
|
||||
" :line1,line2 TCommentMaybeInline ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TCommentMaybeInline keepjumps call TComment(<line1>, <line2>, 'i', "<bang>", <f-args>)
|
||||
|
||||
|
||||
function! TCommentOperator(type, ...) "{{{3
|
||||
let commentMode = a:0 >= 1 ? a:1 : ''
|
||||
let bang = a:0 >= 2 ? a:2 : ''
|
||||
let sel_save = &selection
|
||||
let &selection = "inclusive"
|
||||
let reg_save = @@
|
||||
" let pos = getpos('.')
|
||||
" TLogVAR a:type
|
||||
try
|
||||
if a:type == 'line'
|
||||
silent exe "normal! '[V']"
|
||||
let commentMode1 = 'G'
|
||||
elseif a:type == 'block'
|
||||
silent exe "normal! `[\<C-V>`]"
|
||||
let commentMode1 = 'I'
|
||||
else
|
||||
silent exe "normal! `[v`]"
|
||||
let commentMode1 = 'i'
|
||||
endif
|
||||
if empty(commentMode)
|
||||
let commentMode = commentMode1
|
||||
endif
|
||||
let beg = line("'[")
|
||||
let end = line("']")
|
||||
norm!
|
||||
let commentMode .= g:tcommentOpModeExtra
|
||||
call TComment(beg, end, commentMode, bang)
|
||||
finally
|
||||
let &selection = sel_save
|
||||
let @@ = reg_save
|
||||
if g:tcommentOpModeExtra !~ '>'
|
||||
" TLogVAR pos
|
||||
" call setpos('.', pos)
|
||||
call setpos('.', w:tcommentPos)
|
||||
unlet! w:tcommentPos
|
||||
endif
|
||||
endtry
|
||||
endf
|
||||
|
||||
|
||||
function! TCommentOperatorLine(type) "{{{3
|
||||
call TCommentOperator(a:type, 'G')
|
||||
endf
|
||||
|
||||
|
||||
function! TCommentOperatorAnyway(type) "{{{3
|
||||
call TCommentOperator(a:type, '', '!')
|
||||
endf
|
||||
|
||||
|
||||
function! TCommentOperatorLineAnyway(type) "{{{3
|
||||
call TCommentOperator(a:type, 'G', '!')
|
||||
endf
|
||||
|
||||
|
||||
" comment text as if it were of a specific filetype
|
||||
function! TCommentAs(beg, end, commentAnyway, filetype, ...)
|
||||
let ccount = a:0 >= 1 ? a:1 : 1
|
||||
" TLogVAR ccount
|
||||
if a:filetype =~ '_block$'
|
||||
let commentMode = 'B'
|
||||
let ft = substitute(a:filetype, '_block$', '', '')
|
||||
elseif a:filetype =~ '_inline$'
|
||||
let commentMode = 'I'
|
||||
let ft = substitute(a:filetype, '_inline$', '', '')
|
||||
else
|
||||
let commentMode = 'G'
|
||||
let ft = a:filetype
|
||||
endif
|
||||
let [cms, commentMode] = s:GetCommentString(a:beg, a:end, commentMode, ft)
|
||||
let pre = substitute(cms, '%s.*$', '', '')
|
||||
let pre = substitute(pre, '%%', '%', 'g')
|
||||
let post = substitute(cms, '^.\{-}%s', '', '')
|
||||
let post = substitute(post, '%%', '%', 'g')
|
||||
if ccount > 1
|
||||
let pre_l = matchlist(pre, '^\(\S\+\)\(.*\)$')
|
||||
" TLogVAR pre_l
|
||||
if !empty(get(pre_l, 1))
|
||||
let pre = repeat(pre_l[1], ccount) . pre_l[2]
|
||||
endif
|
||||
let post_l = matchlist(post, '^\(\s*\)\(.\+\)$')
|
||||
" TLogVAR post_l
|
||||
if !empty(get(post_l, 2))
|
||||
let post = post_l[1] . repeat(post_l[2], ccount)
|
||||
endif
|
||||
endif
|
||||
keepjumps call TComment(a:beg, a:end, commentMode, a:commentAnyway, pre, post)
|
||||
endf
|
||||
|
||||
" :line1,line2 TCommentAs commenttype
|
||||
command! -bang -complete=custom,TCommentFileTypes -range -nargs=+ TCommentAs
|
||||
\ call TCommentAs(<line1>, <line2>, "<bang>", <f-args>)
|
||||
command! -bang -complete=customlist,tcomment#FileTypes -range -nargs=+ TCommentAs
|
||||
\ call tcomment#CommentAs(<line1>, <line2>, "<bang>", <f-args>)
|
||||
|
||||
" :line1,line2 TComment ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TComment keepjumps call tcomment#Comment(<line1>, <line2>, 'G', "<bang>", <f-args>)
|
||||
|
||||
" :line1,line2 TCommentRight ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TCommentRight keepjumps call tcomment#Comment(<line1>, <line2>, 'R', "<bang>", <f-args>)
|
||||
|
||||
" :line1,line2 TCommentBlock ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TCommentBlock keepjumps call tcomment#Comment(<line1>, <line2>, 'B', "<bang>", <f-args>)
|
||||
|
||||
" :line1,line2 TCommentInline ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TCommentInline keepjumps call tcomment#Comment(<line1>, <line2>, 'I', "<bang>", <f-args>)
|
||||
|
||||
" :line1,line2 TCommentMaybeInline ?commentBegin ?commentEnd
|
||||
command! -bang -range -nargs=* TCommentMaybeInline keepjumps call tcomment#Comment(<line1>, <line2>, 'i', "<bang>", <f-args>)
|
||||
|
||||
|
||||
|
||||
if (g:tcommentMapLeader1 != '')
|
||||
exec 'noremap <silent> '. g:tcommentMapLeader1 .'<c-_> :TComment<cr>'
|
||||
@ -413,363 +278,16 @@ if (g:tcommentMapLeader2 != '')
|
||||
exec 'noremap '. g:tcommentMapLeader2 .'s :TCommentAs <c-r>=&ft<cr>_'
|
||||
endif
|
||||
if (g:tcommentMapLeaderOp1 != '')
|
||||
exec 'noremap <silent> '. g:tcommentMapLeaderOp1 .' :let w:tcommentPos = getpos(".") \| set opfunc=TCommentOperator<cr>g@'
|
||||
exec 'noremap <silent> '. g:tcommentMapLeaderOp1 .'c :let w:tcommentPos = getpos(".") \| set opfunc=TCommentOperatorLine<cr>g@$'
|
||||
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp1 .' :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#Operator<cr>g@'
|
||||
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp1 .'c :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorLine<cr>g@$'
|
||||
exec 'vnoremap <silent> '. g:tcommentMapLeaderOp1 .' :TCommentMaybeInline<cr>'
|
||||
endif
|
||||
if (g:tcommentMapLeaderOp2 != '')
|
||||
exec 'noremap <silent> '. g:tcommentMapLeaderOp2 .' :let w:tcommentPos = getpos(".") \| set opfunc=TCommentOperatorAnyway<cr>g@'
|
||||
exec 'noremap <silent> '. g:tcommentMapLeaderOp2 .'c :let w:tcommentPos = getpos(".") \| set opfunc=TCommentOperatorLineAnyway<cr>g@$'
|
||||
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp2 .' :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorAnyway<cr>g@'
|
||||
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp2 .'c :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorLineAnyway<cr>g@$'
|
||||
exec 'vnoremap <silent> '. g:tcommentMapLeaderOp2 .' :TCommentMaybeInline<cr>'
|
||||
endif
|
||||
|
||||
|
||||
" ----------------------------------------------------------------
|
||||
" collect all variables matching ^tcomment_
|
||||
function! TCommentCollectFileTypes()
|
||||
if s:tcommentFileTypesDirty
|
||||
let t = @t
|
||||
try
|
||||
redir @t
|
||||
silent let
|
||||
redir END
|
||||
let g:tcommentFileTypes = substitute("\n". @t ."\n", '\n\(tcomment_\(\w\+\)\|\w\+\).\{-}\ze\n', '\n\2', 'g')
|
||||
let g:tcommentFileTypes = substitute(g:tcommentFileTypes, '\(\n\)\n\+', '\1', 'g')
|
||||
let g:tcommentFileTypes = strpart(g:tcommentFileTypes, 1, strlen(g:tcommentFileTypes) - 2)
|
||||
finally
|
||||
let @t = t
|
||||
endtry
|
||||
let g:tcommentFileTypesRx = '\V\^\('. substitute(g:tcommentFileTypes, '\n', '\\|', 'g') .'\)\(\u\.\*\)\?\$'
|
||||
let s:tcommentFileTypesDirty = 0
|
||||
endif
|
||||
endf
|
||||
|
||||
call TCommentCollectFileTypes()
|
||||
|
||||
" return a list of filetypes for which a tcomment_{&ft} is defined
|
||||
function! TCommentFileTypes(ArgLead, CmdLine, CursorPos)
|
||||
call TCommentCollectFileTypes()
|
||||
if a:ArgLead == ''
|
||||
return &filetype ."\n". g:tcommentFileTypes
|
||||
else
|
||||
return g:tcommentFileTypes
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:EncodeCommentPart(string)
|
||||
return substitute(a:string, '%', '%%', 'g')
|
||||
endf
|
||||
|
||||
" s:GetCommentString(beg, end, commentMode, ?filetype="")
|
||||
function! s:GetCommentString(beg, end, commentMode, ...)
|
||||
let ft = a:0 >= 1 ? a:1 : ''
|
||||
if ft != ''
|
||||
let [cms, commentMode] = s:GetCustomCommentString(ft, a:commentMode)
|
||||
else
|
||||
let cms = ''
|
||||
let commentMode = a:commentMode
|
||||
endif
|
||||
if cms == ''
|
||||
if exists('b:commentstring')
|
||||
let cms = b:commentstring
|
||||
return s:GetCustomCommentString(&filetype, a:commentMode, cms)
|
||||
elseif exists('b:commentStart') && b:commentStart != ''
|
||||
let cms = s:EncodeCommentPart(b:commentStart) .' %s'
|
||||
if exists('b:commentEnd') && b:commentEnd != ''
|
||||
let cms = cms .' '. s:EncodeCommentPart(b:commentEnd)
|
||||
endif
|
||||
return s:GetCustomCommentString(&filetype, a:commentMode, cms)
|
||||
elseif g:tcommentGuessFileType || (exists('g:tcommentGuessFileType_'. &filetype)
|
||||
\ && g:tcommentGuessFileType_{&filetype} =~ '[^0]')
|
||||
if g:tcommentGuessFileType_{&filetype} == 1
|
||||
let altFiletype = ''
|
||||
else
|
||||
let altFiletype = g:tcommentGuessFileType_{&filetype}
|
||||
endif
|
||||
return s:GuessFileType(a:beg, a:end, a:commentMode, &filetype, altFiletype)
|
||||
else
|
||||
return s:GetCustomCommentString(&filetype, a:commentMode, s:GuessCurrentCommentString(a:commentMode))
|
||||
endif
|
||||
endif
|
||||
return [cms, commentMode]
|
||||
endf
|
||||
|
||||
" s:SPrintF(formatstring, ?values ...)
|
||||
" => string
|
||||
function! s:SPrintF(string, ...)
|
||||
let n = 1
|
||||
let r = ''
|
||||
let s = a:string
|
||||
while 1
|
||||
let i = match(s, '%\(.\)')
|
||||
if i >= 0
|
||||
let x = s[i + 1]
|
||||
let r = r . strpart(s, 0, i)
|
||||
let s = strpart(s, i + 2)
|
||||
if x == '%'
|
||||
let r = r.'%'
|
||||
else
|
||||
if a:0 >= n
|
||||
exec 'let v = a:'. n
|
||||
let n = n + 1
|
||||
else
|
||||
echoerr 'Malformed format string (too many arguments required): '. a:string
|
||||
endif
|
||||
if x ==# 's'
|
||||
let r = r.v
|
||||
elseif x ==# 'S'
|
||||
let r = r.'"'.v.'"'
|
||||
else
|
||||
echoerr 'Malformed format string: '. a:string
|
||||
endif
|
||||
endif
|
||||
else
|
||||
return r.s
|
||||
endif
|
||||
endwh
|
||||
endf
|
||||
|
||||
function! s:StartRx(pos)
|
||||
if a:pos == 0
|
||||
return '\^'
|
||||
else
|
||||
return '\%'. a:pos .'c'
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:EndRx(pos)
|
||||
if a:pos == 0
|
||||
return '\$'
|
||||
else
|
||||
return '\%'. a:pos .'c'
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:GetIndentString(line, start)
|
||||
let start = a:start > 0 ? a:start - 1 : 0
|
||||
return substitute(strpart(getline(a:line), start), '\V\^\s\*\zs\.\*\$', '', '')
|
||||
endf
|
||||
|
||||
function! s:CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
||||
let mdrx = '\V'. s:StartRx(a:cstart) .'\s\*'. a:checkRx .'\s\*'. s:EndRx(0)
|
||||
let line = getline(a:beg)
|
||||
if a:cstart != 0 && a:cend != 0
|
||||
let line = strpart(line, 0, a:cend - 1)
|
||||
endif
|
||||
let uncomment = (line =~ mdrx)
|
||||
let it = s:GetIndentString(a:beg, a:cstart)
|
||||
let il = indent(a:beg)
|
||||
let n = a:beg + 1
|
||||
while n <= a:end
|
||||
if getline(n) =~ '\S'
|
||||
let jl = indent(n)
|
||||
if jl < il
|
||||
let it = s:GetIndentString(n, a:cstart)
|
||||
let il = jl
|
||||
endif
|
||||
if a:commentMode =~# 'G'
|
||||
if !(getline(n) =~ mdrx)
|
||||
let uncomment = 0
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let n = n + 1
|
||||
endwh
|
||||
if a:commentMode =~# 'B'
|
||||
let t = @t
|
||||
try
|
||||
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"ty'
|
||||
let uncomment = (@t =~ mdrx)
|
||||
finally
|
||||
let @t = t
|
||||
endtry
|
||||
endif
|
||||
return [it, uncomment]
|
||||
endf
|
||||
|
||||
function! s:ProcessedLine(uncomment, match, checkRx, replace)
|
||||
if !(a:match =~ '\S' || g:tcommentBlankLines)
|
||||
return a:match
|
||||
endif
|
||||
let ml = len(a:match)
|
||||
if a:uncomment
|
||||
let rv = substitute(a:match, a:checkRx, '\1\2', '')
|
||||
else
|
||||
let rv = s:SPrintF(a:replace, a:match)
|
||||
endif
|
||||
" let md = len(rv) - ml
|
||||
let s:pos_end = getpos('.')
|
||||
let s:pos_end[2] += len(rv)
|
||||
" TLogVAR pe, md, a:match
|
||||
let rv = escape(rv, '\
')
|
||||
let rv = substitute(rv, '\n', '\\\n', 'g')
|
||||
return rv
|
||||
endf
|
||||
|
||||
function! s:CommentBlock(beg, end, uncomment, checkRx, replace, indentStr)
|
||||
let t = @t
|
||||
try
|
||||
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td'
|
||||
let ms = s:BlockGetMiddleString(a:replace)
|
||||
let mx = escape(ms, '\')
|
||||
if a:uncomment
|
||||
let @t = substitute(@t, '\V\^\s\*'. a:checkRx .'\$', '\1', '')
|
||||
if ms != ''
|
||||
let @t = substitute(@t, '\V\n'. a:indentStr . mx, '\n'. a:indentStr, 'g')
|
||||
endif
|
||||
let @t = substitute(@t, '^\n', '', '')
|
||||
let @t = substitute(@t, '\n\s*$', '', '')
|
||||
else
|
||||
let cs = s:BlockGetCommentString(a:replace)
|
||||
let cs = a:indentStr . substitute(cs, '%s', '%s'. a:indentStr, '')
|
||||
if ms != ''
|
||||
let ms = a:indentStr . ms
|
||||
let mx = a:indentStr . mx
|
||||
let @t = substitute(@t, '^'. a:indentStr, '', 'g')
|
||||
let @t = ms . substitute(@t, '\n'. a:indentStr, '\n'. mx, 'g')
|
||||
endif
|
||||
let @t = s:SPrintF(cs, "\n". @t ."\n")
|
||||
endif
|
||||
silent norm! "tP
|
||||
finally
|
||||
let @t = t
|
||||
endtry
|
||||
endf
|
||||
|
||||
" inspired by Meikel Brandmeyer's EnhancedCommentify.vim
|
||||
" this requires that a syntax names are prefixed by the filetype name
|
||||
" s:GuessFileType(beg, end, commentMode, filetype, ?fallbackFiletype)
|
||||
function! s:GuessFileType(beg, end, commentMode, filetype, ...)
|
||||
if a:0 >= 1 && a:1 != ''
|
||||
let [cms, commentMode] = s:GetCustomCommentString(a:1, a:commentMode)
|
||||
if cms == ''
|
||||
let cms = s:GuessCurrentCommentString(a:commentMode)
|
||||
endif
|
||||
else
|
||||
let commentMode = s:CommentMode(a:commentMode, 'G')
|
||||
let cms = s:GuessCurrentCommentString(0)
|
||||
endif
|
||||
let n = a:beg
|
||||
while n <= a:end
|
||||
let m = indent(n) + 1
|
||||
let le = col('$')
|
||||
while m < le
|
||||
let syntaxName = synIDattr(synID(n, m, 1), 'name')
|
||||
let ftypeMap = get(g:tcommentSyntaxMap, syntaxName)
|
||||
if !empty(ftypeMap)
|
||||
return s:GetCustomCommentString(ftypeMap, a:commentMode, cms)
|
||||
elseif syntaxName =~ g:tcommentFileTypesRx
|
||||
let ft = substitute(syntaxName, g:tcommentFileTypesRx, '\1', '')
|
||||
if exists('g:tcommentIgnoreTypes_'. a:filetype) && g:tcommentIgnoreTypes_{a:filetype} =~ '\<'.ft.'\>'
|
||||
let m = m + 1
|
||||
else
|
||||
return s:GetCustomCommentString(ft, a:commentMode, cms)
|
||||
endif
|
||||
elseif syntaxName == '' || syntaxName == 'None' || syntaxName =~ '^\u\+$' || syntaxName =~ '^\u\U*$'
|
||||
let m = m + 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwh
|
||||
let n = n + 1
|
||||
endwh
|
||||
return [cms, commentMode]
|
||||
endf
|
||||
|
||||
function! s:CommentMode(commentMode, newmode) "{{{3
|
||||
return substitute(a:commentMode, '\w\+', a:newmode, 'g')
|
||||
endf
|
||||
|
||||
function! s:GuessCurrentCommentString(commentMode)
|
||||
let valid_cms = (stridx(&commentstring, '%s') != -1)
|
||||
if &commentstring != s:defaultCommentString && valid_cms
|
||||
" The &commentstring appears to have been set and to be valid
|
||||
return &commentstring
|
||||
endif
|
||||
if &comments != s:defaultComments
|
||||
" the commentstring is the default one, so we assume that it wasn't
|
||||
" explicitly set; we then try to reconstruct &cms from &comments
|
||||
let cms = s:ConstructFromComments(a:commentMode)
|
||||
if cms != s:nullCommentString
|
||||
return cms
|
||||
endif
|
||||
endif
|
||||
if valid_cms
|
||||
" Before &commentstring appeared not to be set. As we don't know
|
||||
" better we return it anyway if it is valid
|
||||
return &commentstring
|
||||
else
|
||||
" &commentstring is invalid. So we return the identity string.
|
||||
return s:nullCommentString
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:ConstructFromComments(commentMode)
|
||||
exec s:ExtractCommentsPart('')
|
||||
if a:commentMode =~# 'G' && line != ''
|
||||
return line .' %s'
|
||||
endif
|
||||
exec s:ExtractCommentsPart('s')
|
||||
if s != ''
|
||||
exec s:ExtractCommentsPart('e')
|
||||
" if a:commentMode
|
||||
" exec s:ExtractCommentsPart("m")
|
||||
" if m != ""
|
||||
" let m = "\n". m
|
||||
" endif
|
||||
" return s.'%s'.e.m
|
||||
" else
|
||||
return s.' %s '.e
|
||||
" endif
|
||||
endif
|
||||
if line != ''
|
||||
return line .' %s'
|
||||
else
|
||||
return s:nullCommentString
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:ExtractCommentsPart(key)
|
||||
" let key = a:key != "" ? a:key .'[^:]*' : ""
|
||||
let key = a:key . '[bnflrxO0-9-]*'
|
||||
let val = substitute(&comments, '^\(.\{-},\)\{-}'. key .':\([^,]\+\).*$', '\2', '')
|
||||
if val == &comments
|
||||
let val = ''
|
||||
else
|
||||
let val = substitute(val, '%', '%%', 'g')
|
||||
endif
|
||||
let var = a:key == '' ? 'line' : a:key
|
||||
return 'let '. var .'="'. escape(val, '"') .'"'
|
||||
endf
|
||||
|
||||
" s:GetCustomCommentString(ft, commentMode, ?default="")
|
||||
function! s:GetCustomCommentString(ft, commentMode, ...)
|
||||
let commentMode = a:commentMode
|
||||
let customComment = exists('g:tcomment_'. a:ft)
|
||||
if commentMode =~# 'B' && exists('g:tcomment_'. a:ft .'_block')
|
||||
let cms = g:tcomment_{a:ft}_block
|
||||
elseif commentMode =~? 'I' && exists('g:tcomment_'. a:ft .'_inline')
|
||||
let cms = g:tcomment_{a:ft}_inline
|
||||
elseif customComment
|
||||
let cms = g:tcomment_{a:ft}
|
||||
let commentMode = s:CommentMode(commentMode, 'G')
|
||||
elseif a:0 >= 1
|
||||
let cms = a:1
|
||||
let commentMode = s:CommentMode(commentMode, 'G')
|
||||
else
|
||||
let cms = ''
|
||||
let commentMode = s:CommentMode(commentMode, 'G')
|
||||
endif
|
||||
return [cms, commentMode]
|
||||
endf
|
||||
|
||||
function! s:BlockGetCommentString(cms)
|
||||
return substitute(a:cms, '\n.*$', '', '')
|
||||
endf
|
||||
|
||||
function! s:BlockGetMiddleString(cms)
|
||||
let rv = substitute(a:cms, '^.\{-}\n\([^\n]*\)', '\1', '')
|
||||
return rv == a:cms ? '' : rv
|
||||
endf
|
||||
|
||||
finish
|
||||
|
||||
|
||||
@ -847,3 +365,14 @@ syntax)
|
||||
- TComment: The use of the type argument has slightly changed (IG -> i,
|
||||
new: >)
|
||||
|
||||
1.8
|
||||
- Definitly require vim7
|
||||
- Split the plugin into autoload & plugin.
|
||||
- g:TCommentFileTypes is a list
|
||||
- Fixed some block comment strings
|
||||
- Removed extraneous newline in some block comments.
|
||||
- Maps for visal mode (thanks Krzysztof Goj)
|
||||
|
||||
1.9
|
||||
- Fix left offset for inline comments (via operator binding)
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
if &cp || exists("g:loaded_vimballPlugin")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimballPlugin = "v25"
|
||||
let g:loaded_vimballPlugin = "v26"
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -25,7 +25,7 @@ set cpo&vim
|
||||
com! -ra -complete=file -na=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>)
|
||||
com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>)
|
||||
com! -na=0 VimballList call vimball#Vimball(0)
|
||||
com! -na=* -complete=dir RmVimball call vimball#RmVimball(<f-args>)
|
||||
com! -na=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings()
|
||||
au BufEnter *.vba.gz,*.vba.bz2,*.vba.zip call vimball#Decompress(expand("<amatch>"))
|
||||
au BufEnter *.vba setlocal ff=unix noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
|
||||
|
||||
|
@ -1,103 +1,104 @@
|
||||
" Language : Netrw Remote-Directory Listing Syntax
|
||||
" Maintainer : Charles E. Campbell, Jr.
|
||||
" Last change: Feb 06, 2008
|
||||
" Version : 12
|
||||
" ---------------------------------------------------------------------
|
||||
|
||||
" Syntax Clearing: {{{1
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Directory List Syntax Highlighting: {{{1
|
||||
syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion,netrwCopyTgt
|
||||
syn cluster NetrwTreeGroup contains=netrwDir,netrwSymLink,netrwExe
|
||||
|
||||
syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify
|
||||
syn match netrwDir "\.\{1,2}/" contains=netrwClassify
|
||||
syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify
|
||||
syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" contains=netrwDateSep skipwhite nextgroup=netrwTime
|
||||
syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify
|
||||
syn match netrwExe "\%(\S\+ \)*\S\+\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify
|
||||
syn match netrwTreeBar "^\%(| \)*" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup
|
||||
syn match netrwTreeBarSpace " " contained
|
||||
|
||||
syn match netrwClassify "[*=|@/]\ze\%(\s\{2,}\|$\)" contained
|
||||
syn match netrwDateSep "/" contained
|
||||
syn match netrwTime "\d\{1,2}:\d\{2}:\d\{2}" contained contains=netrwTimeSep
|
||||
syn match netrwTimeSep ":"
|
||||
|
||||
syn match netrwComment '".*\%(\t\|$\)' contains=@NetrwGroup
|
||||
syn match netrwHide '^"\s*\(Hid\|Show\)ing:' skipwhite nextgroup=netrwHidePat
|
||||
syn match netrwSlash "/" contained
|
||||
syn match netrwHidePat "[^,]\+" contained skipwhite nextgroup=netrwHideSep
|
||||
syn match netrwHideSep "," contained transparent skipwhite nextgroup=netrwHidePat
|
||||
syn match netrwSortBy "Sorted by" contained transparent skipwhite nextgroup=netrwList
|
||||
syn match netrwSortSeq "Sort sequence:" contained transparent skipwhite nextgroup=netrwList
|
||||
syn match netrwCopyTgt "Copy/Move Tgt:" contained transparent skipwhite nextgroup=netrwList
|
||||
syn match netrwList ".*$" contained contains=netrwComma
|
||||
syn match netrwComma "," contained
|
||||
syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd keepend contained
|
||||
syn match netrwHelpCmd "\S\ze:" contained skipwhite nextgroup=netrwCmdSep
|
||||
syn match netrwCmdSep ":" contained nextgroup=netrwCmdNote
|
||||
syn match netrwCmdNote ".\{-}\ze " contained
|
||||
syn match netrwVersion "(netrw.*)" contained
|
||||
|
||||
" -----------------------------
|
||||
" Special filetype highlighting {{{1
|
||||
" -----------------------------
|
||||
if exists("g:netrw_special_syntax") && netrw_special_syntax
|
||||
syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar
|
||||
syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar
|
||||
syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar
|
||||
syn match netrwHdr "\(\S\+ \)*\S\+\.h\>" contains=netrwTreeBar
|
||||
syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar
|
||||
syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar
|
||||
syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar
|
||||
syn match netrwTags "\<tags\>" contains=netrwTreeBar
|
||||
syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar
|
||||
syn match netrwTilde "\(\S\+ \)*\S\+\~\>" contains=netrwTreeBar
|
||||
syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar
|
||||
endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Highlighting Links: {{{1
|
||||
if !exists("did_drchip_netrwlist_syntax")
|
||||
let did_drchip_netrwlist_syntax= 1
|
||||
hi link netrwClassify Function
|
||||
hi link netrwCmdSep Delimiter
|
||||
hi link netrwComment Comment
|
||||
hi link netrwDir Directory
|
||||
hi link netrwHelpCmd Function
|
||||
hi link netrwHidePat Statement
|
||||
hi link netrwList Statement
|
||||
hi link netrwVersion Identifier
|
||||
hi link netrwSymLink Question
|
||||
hi link netrwExe PreProc
|
||||
hi link netrwDateSep Delimiter
|
||||
|
||||
hi link netrwTreeBar Special
|
||||
hi link netrwTimeSep netrwDateSep
|
||||
hi link netrwComma netrwComment
|
||||
hi link netrwHide netrwComment
|
||||
hi link netrwMarkFile Identifier
|
||||
|
||||
" special syntax highlighting (see :he g:netrw_special_syntax)
|
||||
hi link netrwBak NonText
|
||||
hi link netrwCompress Folded
|
||||
hi link netrwData DiffChange
|
||||
hi link netrwLib DiffChange
|
||||
hi link netrwMakefile DiffChange
|
||||
hi link netrwObj Folded
|
||||
hi link netrwTilde Folded
|
||||
hi link netrwTmp Folded
|
||||
hi link netrwTags Folded
|
||||
endif
|
||||
|
||||
" Current Syntax: {{{1
|
||||
let b:current_syntax = "netrwlist"
|
||||
" ---------------------------------------------------------------------
|
||||
" vim: ts=8 fdm=marker
|
||||
" Language : Netrw Remote-Directory Listing Syntax
|
||||
" Maintainer : Charles E. Campbell, Jr.
|
||||
" Last change: Aug 12, 2008
|
||||
" Version : 14
|
||||
" ---------------------------------------------------------------------
|
||||
|
||||
" Syntax Clearing: {{{1
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Directory List Syntax Highlighting: {{{1
|
||||
syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion,netrwCopyTgt
|
||||
syn cluster NetrwTreeGroup contains=netrwDir,netrwSymLink,netrwExe
|
||||
|
||||
syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify
|
||||
syn match netrwDir "\.\{1,2}/" contains=netrwClassify
|
||||
syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify
|
||||
syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" contains=netrwDateSep skipwhite nextgroup=netrwTime
|
||||
syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify
|
||||
syn match netrwExe "\%(\S\+ \)*\S\+\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify
|
||||
syn match netrwTreeBar "^\%(| \)*" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup
|
||||
syn match netrwTreeBarSpace " " contained
|
||||
|
||||
syn match netrwClassify "[*=|@/]\ze\%(\s\{2,}\|$\)" contained
|
||||
syn match netrwDateSep "/" contained
|
||||
syn match netrwTime "\d\{1,2}:\d\{2}:\d\{2}" contained contains=netrwTimeSep
|
||||
syn match netrwTimeSep ":"
|
||||
|
||||
syn match netrwComment '".*\%(\t\|$\)' contains=@NetrwGroup
|
||||
syn match netrwHide '^"\s*\(Hid\|Show\)ing:' skipwhite nextgroup=netrwHidePat
|
||||
syn match netrwSlash "/" contained
|
||||
syn match netrwHidePat "[^,]\+" contained skipwhite nextgroup=netrwHideSep
|
||||
syn match netrwHideSep "," contained skipwhite nextgroup=netrwHidePat
|
||||
syn match netrwSortBy "Sorted by" contained transparent skipwhite nextgroup=netrwList
|
||||
syn match netrwSortSeq "Sort sequence:" contained transparent skipwhite nextgroup=netrwList
|
||||
syn match netrwCopyTgt "Copy/Move Tgt:" contained transparent skipwhite nextgroup=netrwList
|
||||
syn match netrwList ".*$" contained contains=netrwComma
|
||||
syn match netrwComma "," contained
|
||||
syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd keepend contained
|
||||
syn match netrwHelpCmd "\S\ze:" contained skipwhite nextgroup=netrwCmdSep
|
||||
syn match netrwCmdSep ":" contained nextgroup=netrwCmdNote
|
||||
syn match netrwCmdNote ".\{-}\ze " contained
|
||||
syn match netrwVersion "(netrw.*)" contained
|
||||
|
||||
" -----------------------------
|
||||
" Special filetype highlighting {{{1
|
||||
" -----------------------------
|
||||
if exists("g:netrw_special_syntax") && netrw_special_syntax
|
||||
syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar
|
||||
syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar
|
||||
syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar
|
||||
syn match netrwHdr "\(\S\+ \)*\S\+\.h\>" contains=netrwTreeBar
|
||||
syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar
|
||||
syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar
|
||||
syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar
|
||||
syn match netrwTags "\<tags\>" contains=netrwTreeBar
|
||||
syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar
|
||||
syn match netrwTilde "\(\S\+ \)*\S\+\~\>" contains=netrwTreeBar
|
||||
syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar
|
||||
endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Highlighting Links: {{{1
|
||||
if !exists("did_drchip_netrwlist_syntax")
|
||||
let did_drchip_netrwlist_syntax= 1
|
||||
hi default link netrwClassify Function
|
||||
hi default link netrwCmdSep Delimiter
|
||||
hi default link netrwComment Comment
|
||||
hi default link netrwDir Directory
|
||||
hi default link netrwHelpCmd Function
|
||||
hi default link netrwHidePat Statement
|
||||
hi default link netrwHideSep netrwComment
|
||||
hi default link netrwList Statement
|
||||
hi default link netrwVersion Identifier
|
||||
hi default link netrwSymLink Question
|
||||
hi default link netrwExe PreProc
|
||||
hi default link netrwDateSep Delimiter
|
||||
|
||||
hi default link netrwTreeBar Special
|
||||
hi default link netrwTimeSep netrwDateSep
|
||||
hi default link netrwComma netrwComment
|
||||
hi default link netrwHide netrwComment
|
||||
hi default link netrwMarkFile Identifier
|
||||
|
||||
" special syntax highlighting (see :he g:netrw_special_syntax)
|
||||
hi default link netrwBak NonText
|
||||
hi default link netrwCompress Folded
|
||||
hi default link netrwData DiffChange
|
||||
hi default link netrwLib DiffChange
|
||||
hi default link netrwMakefile DiffChange
|
||||
hi default link netrwObj Folded
|
||||
hi default link netrwTilde Folded
|
||||
hi default link netrwTmp Folded
|
||||
hi default link netrwTags Folded
|
||||
endif
|
||||
|
||||
" Current Syntax: {{{1
|
||||
let b:current_syntax = "netrwlist"
|
||||
" ---------------------------------------------------------------------
|
||||
" vim: ts=8 fdm=marker
|
||||
|
Loading…
x
Reference in New Issue
Block a user