+ 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,7 +1,7 @@
|
||||
" netrwSettings.vim: makes netrw settings simpler
|
||||
" Date: Mar 11, 2008
|
||||
" Date: Sep 03, 2008
|
||||
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
||||
" Version: 11
|
||||
" 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
|
||||
@ -19,7 +19,7 @@
|
||||
if exists("g:loaded_netrwSettings") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwSettings = "v11"
|
||||
let g:loaded_netrwSettings = "v13"
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" NetrwSettings: {{{1
|
||||
@ -82,8 +82,6 @@ fun! netrwSettings#NetrwSettings()
|
||||
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(".")
|
||||
@ -101,9 +99,8 @@ fun! netrwSettings#NetrwSettings()
|
||||
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
|
||||
put = 'let g:netrw_cursorline = '.g:netrw_cursorline
|
||||
let decompressline= line("$")
|
||||
put ='let g:netrw_decompress...'
|
||||
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
|
||||
@ -137,6 +134,7 @@ fun! netrwSettings#NetrwSettings()
|
||||
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
|
||||
@ -146,6 +144,7 @@ fun! netrwSettings#NetrwSettings()
|
||||
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 =''
|
||||
@ -158,14 +157,6 @@ fun! netrwSettings#NetrwSettings()
|
||||
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,"'")."'")
|
||||
|
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
|
@ -1,13 +1,13 @@
|
||||
*pi_netrw.txt* For Vim version 7.1. Last change: 2008 Mar 28
|
||||
*pi_netrw.txt* For Vim version 7.2. Last change: 2008 Sep 02
|
||||
|
||||
-----------------------------------------------------
|
||||
NETRW REFERENCE MANUAL by Charles E. Campbell, Jr.
|
||||
-----------------------------------------------------
|
||||
|
||||
|
||||
*dav* *http* *network* *Nwrite* *netrw-file*
|
||||
*fetch* *netrw* *Nread* *rcp* *scp*
|
||||
*ftp* *netrw.vim* *Nsource* *rsync* *sftp*
|
||||
*dav* *ftp* *netrw-file* *Nread* *rcp* *scp*
|
||||
*davs* *http* *netrw.vim* *Nsource* *rsync* *sftp*
|
||||
*fetch* *netrw* *network* *Nwrite*
|
||||
|
||||
==============================================================================
|
||||
1. Contents *netrw-contents* {{{1
|
||||
@ -30,7 +30,7 @@
|
||||
7. Ex Commands..........................................|netrw-ex|
|
||||
8. Variables and Options................................|netrw-var|
|
||||
9. Browsing.............................................|netrw-browse|
|
||||
Introduction To Browsing...........................|netrw-browse-intro|
|
||||
Introduction To Browsing...........................|netrw-intro-browse|
|
||||
Quick Reference: Maps..............................|netrw-browse-maps|
|
||||
Quick Reference: Commands..........................|netrw-browse-cmds|
|
||||
Bookmarking A Directory............................|netrw-mb|
|
||||
@ -55,12 +55,21 @@
|
||||
Listing Bookmarks And History......................|netrw-qb|
|
||||
Making A New Directory.............................|netrw-d|
|
||||
Making The Browsing Directory The Current Directory|netrw-c|
|
||||
Marked Files: Compression And Decompression........|netrw-mz|
|
||||
Marked Files: Printing.............................|netrw-mp|
|
||||
Marked Files: Tagging..............................|netrw-mT|
|
||||
Marked Files: Unmarking............................|netrw-mu|
|
||||
Marking Files......................................|netrw-mf|
|
||||
Marking Files By Regular Expression................|netrw-mr|
|
||||
Marked Files: Arbitrary Command....................|netrw-mx|
|
||||
Marked Files: Compression And Decompression........|netrw-mz|
|
||||
Marked Files: Copying..............................|netrw-mc|
|
||||
Marked Files: Diff.................................|netrw-md|
|
||||
Marked Files: Editing..............................|netrw-me|
|
||||
Marked Files: Grep.................................|netrw-mg|
|
||||
Marked Files: Hiding and Unhiding by Suffix........|netrw-mh|
|
||||
Marked Files: Moving...............................|netrw-mm|
|
||||
Marked Files: Printing.............................|netrw-mp|
|
||||
Marked Files: Sourcing.............................|netrw-ms|
|
||||
Marked Files: Tagging..............................|netrw-mT|
|
||||
Marked Files: Setting the Target Directory.........|netrw-mt|
|
||||
Marked Files: Unmarking............................|netrw-mu|
|
||||
Netrw Browser Variables............................|netrw-browser-var|
|
||||
Netrw Browsing And Option Incompatibilities........|netrw-incompatible|
|
||||
Netrw Settings.....................................|netrw-settings|
|
||||
@ -305,13 +314,6 @@ settings are described below, in |netrw-browser-options|, and in
|
||||
Also affects the "previous window" (see |netrw-P|) in
|
||||
the same way.
|
||||
|
||||
*g:netrw_shq* = "'" for Unix/Linux systems (ie. a single quote)
|
||||
= "'" for Windows + cygwin systems (ie. a single quote)
|
||||
= '"' for Windows systems, not using cygwin
|
||||
(ie. a double quote)
|
||||
Controls the quoting character used during scp and ftp
|
||||
commands.
|
||||
|
||||
*g:netrw_scpport* = "-P" : option to use to set port for scp
|
||||
*g:netrw_sshport* = "-p" : option to use to set port for ssh
|
||||
|
||||
@ -424,6 +426,10 @@ additional prompting.
|
||||
| dav://host/path | | cadaver |
|
||||
| :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
|
||||
+---------------------------------+----------------------------+------------+
|
||||
| DAV + SSL: | | |
|
||||
| davs://host/path | | cadaver |
|
||||
| :Nread davs://host/path | :Nwrite davs://host/path | cadaver |
|
||||
+---------------------------------+----------------------------+------------+
|
||||
| FETCH: | | |
|
||||
| fetch://[user@]host/path | | |
|
||||
| fetch://[user@]host:http/path | Not Available | fetch |
|
||||
@ -778,7 +784,8 @@ itself:
|
||||
9. Browsing *netrw-browsing* *netrw-browse* *netrw-help* {{{1
|
||||
*netrw-browser* *netrw-dir* *netrw-list*
|
||||
|
||||
INTRODUCTION TO BROWSING *netrw-browse-intro* {{{2
|
||||
INTRODUCTION TO BROWSING *netrw-intro-browse* {{{2
|
||||
(Quick References: |netrw-quickmaps| |netrw-quickcoms|)
|
||||
|
||||
Netrw supports the browsing of directories on your local system and on remote
|
||||
hosts; browsing includes listing files and directories, entering directories,
|
||||
@ -832,6 +839,30 @@ There are several things you can do to affect the browser's display of files:
|
||||
See |netrw-browse-cmds| for all the things you can do with netrw!
|
||||
|
||||
|
||||
QUICK HELP *netrw-quickhelp* {{{2
|
||||
(Use ctrl-] to select a topic)~
|
||||
Intro to Browsing...............................|netrw-intro-browse|
|
||||
Quick Reference: Maps.........................|netrw-quickmap|
|
||||
Quick Reference: Commands.....................|netrw-browse-cmds|
|
||||
Hiding
|
||||
Edit hiding list..............................|netrw-ctrl-h|
|
||||
Hiding Files or Directories...................|netrw-a|
|
||||
Hiding/Unhiding by suffix.....................|netrw-mh|
|
||||
Hiding dot-files.............................|netrw-gh|
|
||||
Listing Style
|
||||
Select listing style (thin/long/wide/tree)....|netrw-i|
|
||||
Associated setting variable...................|g:netrw_liststyle|
|
||||
Shell command used to perform listing.........|g:netrw_list_cmd|
|
||||
Quick file info...............................|netrw-qf|
|
||||
Sorted by
|
||||
Select sorting style (name/time/size).........|netrw-s|
|
||||
Editing the sorting sequence..................|netrw-S|
|
||||
Sorting options...............................|g:netrw_sort_options|
|
||||
Associated setting variable...................|g:netrw_sort_sequence|
|
||||
Reverse sorting order.........................|netrw-r|
|
||||
|
||||
|
||||
*netrw-quickmap* *netrw-quickmaps*
|
||||
QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
|
||||
>
|
||||
--- ----------------- ----
|
||||
@ -848,6 +879,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
|
||||
d Make a directory |netrw-d|
|
||||
D Attempt to remove the file(s)/directory(ies) |netrw-D|
|
||||
gb Go to previous bookmarked directory |netrw-gb|
|
||||
gh Quick hide/unhide of dot-files |netrw-gh|
|
||||
gi Display information on file |netrw-qf|
|
||||
<c-h> Edit file hiding list |netrw-ctrl-h|
|
||||
i Cycle between thin, long, wide, and tree listings |netrw-i|
|
||||
@ -883,6 +915,8 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
|
||||
browser window. A vertical split is used.
|
||||
x View file with an associated program |netrw-x|
|
||||
|
||||
% Open a new file in netrw's current directory |netrw-%|
|
||||
|
||||
<leftmouse> (gvim only) selects word under mouse as if a <cr>
|
||||
had been pressed (ie. edit file, change directory)
|
||||
<middlemouse> (gvim only) same as P selecting word under mouse;
|
||||
@ -898,6 +932,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
|
||||
to the netrw browser window.
|
||||
<s-leftmouse> (gvim only) like mf, will mark files
|
||||
|
||||
*netrw-quickcom* *netrw-quickcoms*
|
||||
QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2
|
||||
:NetrwClean[!] ...........................................|netrw-clean|
|
||||
:NetrwSettings ...........................................|netrw-settings|
|
||||
@ -915,9 +950,9 @@ One may easily "bookmark" a directory by using >
|
||||
|
||||
{cnt}mb
|
||||
<
|
||||
Any count may be used. One may use viminfo's "!" option to retain bookmarks
|
||||
between vim sessions. See |netrw-gb| for how to return to a bookmark and
|
||||
|netrw-qb| for how to list them.
|
||||
Any count may be used. One may use viminfo's "!" option (|'viminfo'|) to
|
||||
retain bookmarks between vim sessions. See |netrw-gb| for how to return
|
||||
to a bookmark and |netrw-qb| for how to list them.
|
||||
|
||||
|
||||
BROWSING *netrw-cr* {{{2
|
||||
@ -1296,12 +1331,16 @@ for local files.
|
||||
EDIT FILE OR DIRECTORY HIDING LIST *netrw-ctrl-h* *netrw-edithide* {{{2
|
||||
|
||||
The "<ctrl-h>" map brings up a requestor allowing the user to change the
|
||||
file/directory hiding list. The hiding list consists of one or more patterns
|
||||
delimited by commas. Files and/or directories satisfying these patterns will
|
||||
either be hidden (ie. not shown) or be the only ones displayed (see
|
||||
|netrw-a|).
|
||||
file/directory hiding list contained in |g:netrw_list_hide|. The hiding list
|
||||
consists of one or more patterns delimited by commas. Files and/or
|
||||
directories satisfying these patterns will either be hidden (ie. not shown) or
|
||||
be the only ones displayed (see |netrw-a|).
|
||||
|
||||
Associated setting variable: |g:netrw_hide|
|
||||
The "gh" mapping (see |netrw-gh|) quickly alternates between the usual
|
||||
hiding list and the hiding of files or directories that begin with ".".
|
||||
|
||||
Associated setting variables: |g:netrw_hide| |g:netrw_list_hide|
|
||||
Associated topics: |netrw-a| |netrw-gh| |netrw-mh|
|
||||
|
||||
|
||||
EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* {{{2
|
||||
@ -1319,8 +1358,8 @@ will end up. One may change the sorting sequence by modifying the
|
||||
g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
|
||||
using the "S" map.
|
||||
|
||||
Related topics: |g:netrw-s| |g:netrw-S|
|
||||
Associated setting variable: |g:netrw_sort_sequence|
|
||||
Related topics: |netrw-s| |netrw-S|
|
||||
Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options|
|
||||
|
||||
|
||||
GOING UP *netrw--* {{{2
|
||||
@ -1379,14 +1418,15 @@ If files have been marked using |netrw-mf|, then this command will:
|
||||
and showing only non-hidden files.
|
||||
endif
|
||||
|
||||
*netrw-gh*
|
||||
*netrw-gh* *netrw-hide*
|
||||
As a quick shortcut, one may press >
|
||||
gh
|
||||
to toggle between hiding files which begin with a period (dot) or not.
|
||||
to toggle between hiding files which begin with a period (dot) and not hiding
|
||||
them.
|
||||
|
||||
Associated setting variable: |g:netrw_list_hide|
|
||||
Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh|
|
||||
|
||||
*netrw-ctrl_h*
|
||||
IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2
|
||||
|
||||
Especially with the remote directory browser, constantly entering the password
|
||||
@ -1397,21 +1437,56 @@ tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3) gives a tip
|
||||
for setting up no-password ssh and scp and discusses associated security
|
||||
issues. It used to be available at http://hacks.oreilly.com/pub/h/66 ,
|
||||
but apparently that address is now being redirected to some "hackzine".
|
||||
I'll attempt a summary:
|
||||
I'll attempt a summary based on that article and on a communication from
|
||||
Ben Schmidt:
|
||||
|
||||
1. Generate a public/private key pair on the ssh server:
|
||||
ssh-keygen -t rsa
|
||||
(saving the file in ~/.ssh/id_rsa is ok)
|
||||
2. Just hit the <CR> when asked for passphrase (twice).
|
||||
3. This creates two files:
|
||||
~/.ssh/id_rsa
|
||||
~/.ssh/id_rsa.pub
|
||||
4. On the client:
|
||||
cd
|
||||
mkdir .ssh
|
||||
chmod 0700 .ssh
|
||||
scp {serverhostname}:.ssh/id_rsa.pub .
|
||||
cat id_rsa.pub >> .ssh/authorized_keys2
|
||||
1. Generate a public/private key pair on the local machine
|
||||
(ssh client): >
|
||||
ssh-keygen -t rsa
|
||||
(saving the file in ~/.ssh/id_rsa as prompted)
|
||||
<
|
||||
2. Just hit the <CR> when asked for passphrase (twice) for no
|
||||
passphrase. If you do use a passphrase, you will also need to use
|
||||
ssh-agent so you only have to type the passphrase once per session.
|
||||
If you don't use a passphrase, simply logging onto your local
|
||||
computer or getting access to the keyfile in any way will suffice
|
||||
to access any ssh servers which have that key authorized for login.
|
||||
|
||||
3. This creates two files: >
|
||||
~/.ssh/id_rsa
|
||||
~/.ssh/id_rsa.pub
|
||||
<
|
||||
4. On the target machine (ssh server): >
|
||||
cd
|
||||
mkdir -p .ssh
|
||||
chmod 0700 .ssh
|
||||
<
|
||||
5. On your local machine (ssh client): (one line) >
|
||||
ssh {serverhostname}
|
||||
cat '>>' '~/.ssh/authorized_keys2' < ~/.ssh/id_rsa.pub
|
||||
<
|
||||
or, for OpenSSH, (one line) >
|
||||
ssh {serverhostname}
|
||||
cat '>>' '~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
|
||||
<
|
||||
You can test it out with >
|
||||
ssh {serverhostname}
|
||||
and you should be log onto the server machine without further need to type
|
||||
anything.
|
||||
|
||||
If you decided to use a passphrase, do: >
|
||||
ssh-agent $SHELL
|
||||
ssh-add
|
||||
ssh {serverhostname}
|
||||
You will be prompted for your key passphrase when you use ssh-add, but not
|
||||
subsequently when you use ssh. For use with vim, you can use >
|
||||
ssh-agent vim
|
||||
and, when next within vim, use >
|
||||
:!ssh-add
|
||||
Alternatively, you can apply ssh-agent to the terminal you're planning on
|
||||
running vim in: >
|
||||
ssh-agent xterm &
|
||||
and do ssh-add whenever you need.
|
||||
|
||||
For Windows, folks on the vim mailing list have mentioned that Pageant helps
|
||||
with avoiding the constant need to enter the password.
|
||||
@ -1448,6 +1523,8 @@ directory's name. A bare <CR> at that point will abort the making of the
|
||||
directory. Attempts to make a local directory that already exists (as either
|
||||
a file or a directory) will be detected, reported on, and ignored.
|
||||
|
||||
Currently, making a directory via ftp is not supported.
|
||||
|
||||
Associated setting variable: |g:netrw_local_mkdir| |g:netrw_mkdir_cmd|
|
||||
|
||||
|
||||
@ -1467,15 +1544,60 @@ directory.
|
||||
|
||||
Associated setting variable: |g:netrw_keepdir|
|
||||
|
||||
MARKING FILES *netrw-mf* {{{2
|
||||
(also see |netrw-mr|)
|
||||
|
||||
One may mark files with the cursor atop a filename and then pressing "mf".
|
||||
With gvim, one may also mark files with <s-leftmouse>. The following netrw
|
||||
maps make use of marked files:
|
||||
|
||||
|netrw-a| Hide marked files/directories
|
||||
|netrw-D| Delete marked files/directories
|
||||
|netrw-mc| Copy marked files to target
|
||||
|netrw-md| Apply vimdiff to marked files
|
||||
|netrw-me| Edit marked files
|
||||
|netrw-mg| Apply vimgrep to marked files
|
||||
|netrw-mm| Move marked files
|
||||
|netrw-mp| Print marked files
|
||||
|netrw-mt| Set target for |netrw-mm| and |netrw-mc|
|
||||
|netrw-mT| Generate tags using marked files
|
||||
|netrw-mx| Apply shell command to marked files
|
||||
|netrw-mz| Compress/Decompress marked files
|
||||
|netrw-O| Obtain marked files
|
||||
|netrw-R| Rename marked files
|
||||
|
||||
One may unmark files one at a time the same way one marks them; ie. place
|
||||
the cursor atop a marked file and press "mf". This process also works
|
||||
with <s-leftmouse> using gvim. One may unmark all files by pressing
|
||||
"mu" (see |netrw-mu|).
|
||||
|
||||
*markfilelist* *global_markfilelist* *local_markfilelist*
|
||||
All marked files are entered onto the global marked file list; there is only
|
||||
one such list. In addition, every netrw buffer also has its own local marked
|
||||
file list; since netrw buffers are associated with specific directories, this
|
||||
means that each directory has its own local marked file list. The various
|
||||
commands which operate on marked files use one or the other of the marked file
|
||||
lists.
|
||||
|
||||
|
||||
MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2
|
||||
(also see |netrw-mf|)
|
||||
|
||||
One may also mark files by pressing "mr"; netrw will then issue a prompt,
|
||||
"Enter regexp: ". You may then enter a regular expression such as \.c$ .
|
||||
All files in the current directory will then be marked. Note that the
|
||||
regular expressions are vim-style |regexp| ones, not shell ones. So
|
||||
entering *.c probably isn't what you want!
|
||||
|
||||
|
||||
MARKED FILES: ARBITRARY COMMAND *netrw-mx* {{{2
|
||||
(See |netrw-mf| and |netrw-mr| for how to mark files)
|
||||
(uses the local marked-file list)
|
||||
|
||||
Upon activation of the "mx" map, netrw will query the user for some command to
|
||||
be applied to all marked files. All %s in the command will be substituted
|
||||
with the name of a marked file. If no %s are in the command, then the command
|
||||
will be followed by a space and a marked filename.
|
||||
Upon activation of the "mx" map, netrw will query the user for some (external)
|
||||
command to be applied to all marked files. All "%"s in the command will be
|
||||
substituted with the name of each marked file in turn. If no "%"s are in the
|
||||
command, then the command will be followed by a space and a marked filename.
|
||||
|
||||
|
||||
MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2
|
||||
@ -1515,6 +1637,16 @@ MARKED FILES: EDITING *netrw-me* {{{2
|
||||
This command will place the marked files on the |arglist| and commence
|
||||
editing them. One may return the to explorer window with |:Rexplore|.
|
||||
|
||||
MARKED FILES: GREP *netrw-mg* {{{2
|
||||
(See |netrw-mf| and |netrw-mr| for how to mark files)
|
||||
(uses the global marked file list)
|
||||
|
||||
This command will apply |:vimgrep| to the marked files. The command will ask
|
||||
for the requested pattern; one may enter: >
|
||||
/pattern/[g][j]
|
||||
! /pattern/[g][j]
|
||||
pattern
|
||||
<
|
||||
MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2
|
||||
(See |netrw-mf| and |netrw-mr| for how to mark files)
|
||||
(uses the local marked file list)
|
||||
@ -1531,6 +1663,13 @@ MARKED FILES: MOVING *netrw-mm* {{{2
|
||||
(See |netrw-mf| and |netrw-mr| for how to mark files)
|
||||
(uses the global marked file list)
|
||||
|
||||
WARNING: moving files is more dangerous than copying them.
|
||||
A file being moved is first copied and then deleted; if the
|
||||
copy operation fails and the delete succeeds, you will lose
|
||||
the file. Either try things out with unimportant files
|
||||
first or do the copy and then delete yourself using mc and D.
|
||||
Use at your own risk!
|
||||
|
||||
Select a target directory with mT (|netrw-mt|). Then change directory,
|
||||
select file(s) (see |netrw-mf|), and press "mm".
|
||||
|
||||
@ -1602,51 +1741,6 @@ MARKED FILES: UNMARKING *netrw-mu* {{{2
|
||||
The "mu" mapping will unmark all currently marked files.
|
||||
|
||||
|
||||
MARKING FILES *netrw-mf* {{{2
|
||||
(also see |netrw-mr|)
|
||||
|
||||
One may mark files with the cursor atop a filename and then pressing "mf".
|
||||
With gvim, one may also mark files with <s-leftmouse>. The following netrw
|
||||
maps make use of marked files:
|
||||
|
||||
|netrw-a| Hide marked files/directories
|
||||
|netrw-D| Delete marked files/directories
|
||||
|netrw-mc| Copy marked files to target
|
||||
|netrw-md| Apply vimdiff to marked files
|
||||
|netrw-me| Edit marked files
|
||||
|netrw-mm| Move marked files
|
||||
|netrw-mp| Print marked files
|
||||
|netrw-mt| Set target for |netrw-mm| and |netrw-mc|
|
||||
|netrw-mT| Generate tags using marked files
|
||||
|netrw-mx| Apply shell command to marked files
|
||||
|netrw-mz| Compress/Decompress marked files
|
||||
|netrw-O| Obtain marked files
|
||||
|netrw-R| Rename marked files
|
||||
|
||||
One may unmark files one at a time the same way one marks them; ie. place
|
||||
the cursor atop a marked file and press "mf". This process also works
|
||||
with <s-leftmouse> using gvim. One may unmark all files by pressing
|
||||
"mu" (see |netrw-mu|).
|
||||
|
||||
*markfilelist* *global_markfilelist* *local_markfilelist*
|
||||
All marked files are entered onto the global marked file list; there is only
|
||||
one such list. In addition, every netrw buffer also has its own local marked
|
||||
file list; since netrw buffers are associated with specific directories, this
|
||||
means that each directory has its own local marked file list. The various
|
||||
commands which operate on marked files use one or the other of the marked file
|
||||
lists.
|
||||
|
||||
|
||||
MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2
|
||||
(also see |netrw-mf|)
|
||||
|
||||
One may also mark files by pressing "mr"; netrw will then issue a prompt,
|
||||
"Enter regexp: ". You may then enter a regular expression such as \.c$ .
|
||||
All files in the current directory will then be marked. Note that the
|
||||
regular expressions are vim-style |regexp| ones, not shell ones. So
|
||||
entering *.c probably isn't what you want!
|
||||
|
||||
|
||||
NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2
|
||||
|
||||
(if you're interestd in the netrw file transfer settings, see |netrw-options|)
|
||||
@ -1682,14 +1776,23 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
a script/function to handle the given
|
||||
extension. (see |netrw_filehandler|).
|
||||
|
||||
*g:netrw_cd_escape* ="[]#*$%'\" ?`!&();<>\\"
|
||||
This option is used to escape directory names
|
||||
before changing directory to them.
|
||||
|
||||
*g:netrw_compress* ="gzip"
|
||||
Will compress marked files with this
|
||||
command
|
||||
|
||||
*g:netrw_ctags* ="ctags"
|
||||
The default external program used to create tags
|
||||
|
||||
*g:netrw_cursorline* = 1 (default)
|
||||
will use the |'cursorline'| local setting when
|
||||
|g:netrw_liststyle| ==0 (thin listing) or
|
||||
|g:netrw_liststyle| ==1 (long listing) or
|
||||
|g:netrw_liststyle| ==3 (tree listing)
|
||||
=0: off
|
||||
=2: like ==1, but the wide listing gets both
|
||||
cursorline and |'cursorcolumn'|locally set
|
||||
(ie. doesn't affect the wide listing)
|
||||
|
||||
*g:netrw_decompress* = { ".gz" : "gunzip" ,
|
||||
".bz2" : "bunzip2" ,
|
||||
".zip" : "unzip" ,
|
||||
@ -1697,15 +1800,18 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
A dictionary mapping suffices to
|
||||
decompression programs.
|
||||
|
||||
*g:netrw_fastbrowse* =0: slow speed browsing, never re-use
|
||||
directory listings; always obtain
|
||||
directory listings.
|
||||
=1: medium speed browsing, re-use directory
|
||||
listings only when remote browsing.
|
||||
*g:netrw_fastbrowse* =0: slow speed directory browsing;
|
||||
never re-uses directory listings,
|
||||
always obtains directory listings.
|
||||
=1: medium speed directory browsing;
|
||||
re-use directory listings only
|
||||
when remote directory browsing.
|
||||
(default value)
|
||||
=2: fast browsing, only obtains directory
|
||||
listings when the directory hasn't been
|
||||
seen before (or |netrw-ctrl-l| is used).
|
||||
=2: fast directory browsing;
|
||||
only obtains directory listings when the
|
||||
directory hasn't been seen before
|
||||
(or |netrw-ctrl-l| is used).
|
||||
|
||||
Fast browsing retains old directory listing
|
||||
buffers so that they don't need to be
|
||||
re-acquired. This feature is especially
|
||||
@ -1714,8 +1820,9 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
such directories, the old directory buffer
|
||||
becomes out-of-date. One may always refresh
|
||||
such a directory listing with |netrw-ctrl-l|.
|
||||
This option gives the choice of the trade-off
|
||||
between accuracy and speed to the user.
|
||||
This option gives the user the choice of
|
||||
trading off accuracy (ie. up-to-date listing)
|
||||
versus speed.
|
||||
|
||||
*g:netrw_fname_escape* =' ?&;%'
|
||||
Used on filenames before remote reading/writing
|
||||
@ -1828,6 +1935,14 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
*g:netrw_sort_direction* sorting direction: "normal" or "reverse"
|
||||
default: "normal"
|
||||
|
||||
*g:netrw_sort_options* sorting is done using |:sort|; this
|
||||
variable's value is appended to the
|
||||
sort command. Thus one may ignore case,
|
||||
for example, with the following in your
|
||||
.vimrc: >
|
||||
let g:netrw_sort_options="i"
|
||||
< default: ""
|
||||
|
||||
*g:netrw_sort_sequence* when sorting by name, first sort by the
|
||||
comma-separated pattern sequence
|
||||
default: '[\/]$,*,\.bak$,\.o$,\.h$,
|
||||
@ -1895,6 +2010,22 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
|:Hexplore| or |:Vexplore|.
|
||||
default: ""
|
||||
|
||||
*g:netrw_xstrlen* Controls how netrw computes a string
|
||||
including multi-byte characters' string
|
||||
length. (thanks to N Weibull, T Mechelynck)
|
||||
=0: uses Vim's built-in strlen()
|
||||
=1: number of codepoints (Latin + a combining
|
||||
circumflex is two codepoints) (DEFAULT)
|
||||
=2: number of spacing codepoints (Latin a +
|
||||
combining circumflex is one spacing
|
||||
codepoint; a hard tab is one; wide and
|
||||
narrow CJK are one each; etc.)
|
||||
=3: virtual length (counting tabs as anything
|
||||
between 1 and |'tabstop'|, wide CJJK as 2
|
||||
rather than 1, Arabic alif as zero when
|
||||
immediately preceded by lam, one
|
||||
otherwise, etc)
|
||||
|
||||
*g:NetrwTopLvlMenu* This variable specifies the top level
|
||||
menu name; by default, it's "Netrw.". If
|
||||
you wish to change this, do so in your
|
||||
@ -1955,6 +2086,13 @@ Related topics:
|
||||
directory, see |g:netrw_keepdir|.
|
||||
|
||||
|
||||
OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%*
|
||||
|
||||
To open a file in netrw's current directory, press "%". This map will
|
||||
query the user for a new filename; an empty file by that name will be
|
||||
placed in the netrw's current directory (ie. b:netrw_curdir).
|
||||
|
||||
|
||||
PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2
|
||||
|
||||
One may use a preview window by using the "p" key when the cursor is atop the
|
||||
@ -1966,10 +2104,10 @@ splitting if one has set |g:netrw_preview| first.
|
||||
|
||||
PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2
|
||||
|
||||
To edit a file or directory in the previously used window (see :he |CTRL-W_P|),
|
||||
press a "P". If there's only one window, then the one window will be
|
||||
horizontally split (above/below splitting is controlled by |g:netrw_alto|,
|
||||
and its initial size is controlled by |g:netrw_winsize|).
|
||||
To edit a file or directory in the previously used (last accessed) window (see
|
||||
:he |CTRL-W_p|), press a "P". If there's only one window, then the one window
|
||||
will be horizontally split (above/below splitting is controlled by
|
||||
|g:netrw_alto|, and its initial size is controlled by |g:netrw_winsize|).
|
||||
|
||||
If there's more than one window, the previous window will be re-used on
|
||||
the selected file/directory. If the previous window's associated buffer
|
||||
@ -2000,6 +2138,12 @@ If there are marked files: (see |netrw-mf|)
|
||||
Marked files will be renamed (moved). You will be queried as above in
|
||||
order to specify where you want the file/directory to be moved.
|
||||
|
||||
WARNING:~
|
||||
|
||||
Note that moving files is a dangerous operation; copies are safer. That's
|
||||
because a "move" for remote files is actually a copy + delete -- and if
|
||||
the copy fails and the delete does not, you may lose the file.
|
||||
|
||||
The g:netrw_rename_cmd variable is used to implement renaming. By default its
|
||||
value is:
|
||||
|
||||
@ -2014,7 +2158,7 @@ REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2
|
||||
One may toggle between normal and reverse sorting order by pressing the
|
||||
"r" key.
|
||||
|
||||
Related topics: |g:netrw-s|
|
||||
Related topics: |netrw-s|
|
||||
Associated setting variable: |g:netrw_sort_direction|
|
||||
|
||||
|
||||
@ -2024,7 +2168,7 @@ One may select the sorting style by name, time, or (file) size. The "s" map
|
||||
allows one to circulate amongst the three choices; the directory listing will
|
||||
automatically be refreshed to reflect the selected style.
|
||||
|
||||
Related topics: |g:netrw-r| |g:netrw-S|
|
||||
Related topics: |netrw-r| |netrw-S|
|
||||
Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence|
|
||||
|
||||
|
||||
@ -2232,11 +2376,11 @@ Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence|
|
||||
let g:netrw_altv = 1
|
||||
* Edit the current directory: :e .
|
||||
* Select some file, press v
|
||||
* Resize the windows as you wish (see |ctrl-w_<| and
|
||||
|ctrl-w_>|). If you're using gvim, you can drag
|
||||
* Resize the windows as you wish (see |CTRL-W_<| and
|
||||
|CTRL-W_>|). If you're using gvim, you can drag
|
||||
the separating bar with your mouse.
|
||||
* When you want a new file, use ctrl-w h to go back to the
|
||||
netrw browser, select a file, then press P (see |ctrl-w_h|
|
||||
netrw browser, select a file, then press P (see |CTRL-W_h|
|
||||
and |netrw-P|). If you're using gvim, you can press
|
||||
<leftmouse> in the browser window and then press the
|
||||
<middlemouse> to select the file.
|
||||
@ -2295,6 +2439,96 @@ which is loaded automatically at startup (assuming :set nocp).
|
||||
==============================================================================
|
||||
12. History *netrw-history* {{{1
|
||||
|
||||
v133: Aug 10, 2008 * NetReadFixup() for win95 was missing some "a:"s
|
||||
Aug 12, 2008 * (Jan Minář) an error condition in NetrwMethod()
|
||||
wasn't being used, resulting in b:netrw_fname
|
||||
undefined errors
|
||||
Aug 12, 2008 * (François Ingeirest) asked that "hi link" be
|
||||
changed to hi default link in the netrw syntax
|
||||
files.
|
||||
Aug 12, 2008 * using s:NetrwUnmarkList() more often. Filenames
|
||||
were being left on the global list when removed
|
||||
from the buffer-local lists.
|
||||
Aug 14, 2008 * (Joshua Clayton) an errant extra ")" was left in
|
||||
the rcp-handling portion of NetRead().
|
||||
Sep 03, 2008 * added |'cursorline'| highlighting to thin, long,
|
||||
and tree displays.
|
||||
v132: Aug 06, 2008 * Fixed marked file-based obtain
|
||||
Aug 08, 2008 * sourcing a file via ftp from a netrw-generated
|
||||
buffer (or any buffer with |'nobl'|) left an
|
||||
empty no-name buffer in its wake. Fixed.
|
||||
v130: Jul 31, 2008 * trying out elinks/links for http://host/
|
||||
requests. One problem: in-page links
|
||||
(such as with ...#LABEL) are not supported
|
||||
* verified that Bram's modified netrwPlugin works
|
||||
Aug 01, 2008 * fixed a bug: when sourcing a file via ftp, the
|
||||
"filter window" was left behind.
|
||||
v129: Jul 31, 2008 * bug found in non-mouse enabled vim and some
|
||||
local maps
|
||||
v128: Jul 30, 2008 * much work done in using shellescape() and
|
||||
fnameescape()
|
||||
v126: Jun 30, 2008 * after having gone to a remote directory,
|
||||
<f1> was no longer taking one to the correct
|
||||
entry in the help (|netrw-quickhelp|). Fixed.
|
||||
Jul 01, 2008 * extracting the last filename from a wide listing
|
||||
missed the last letter when |'virtualedit'| not
|
||||
enabled.
|
||||
Jul 01, 2008 * vim foo/bar was creating [Scratch] buffers,
|
||||
where bar was also a directory
|
||||
Jul 01, 2008 * numerous additional changes were made to netrw
|
||||
to use fnameescape() and shellescape() instead
|
||||
of escape(). Not all changes have been tested
|
||||
as yet...
|
||||
Jul 01, 2008 * (James Vega reported) some problems with
|
||||
:NetrwSettings (due to no longer used setting
|
||||
variables).
|
||||
Jul 07, 2008 * Additional numerous changes to support security;
|
||||
shellescape(arg,1), etc.
|
||||
v125: Apr 07, 2008 * (Cristian Rigamonti) CR provides a patch; he
|
||||
noted that gx was failing since its call to
|
||||
netrw#NetBrowseX() wasn't updated to
|
||||
netrw#NetrwBrowseX().
|
||||
* (Stanis Trendelenburg) ST provides a patch to
|
||||
supports davs: (dav + ssl)
|
||||
* (Rick Choi) noted that directory names comprised
|
||||
of three digits were not being displayed by
|
||||
the internal browser. Fixed.
|
||||
* (Erik Falor) provided a patch to handle problems
|
||||
with changing directory and |'acd'| option.
|
||||
* (James Vega, Teemu Likonen) noted that netrw
|
||||
wasn't handling multi-byte filenames/directories
|
||||
correctly. Fixed.
|
||||
* (Rick) found problem with g:netrw_maxfilenamelen
|
||||
being overridden.
|
||||
* (James Vega) pointed out that netrw was
|
||||
misidentifying all files in a symbolically linked
|
||||
directory as being symbolically linked
|
||||
themselves. This particular problem was fixed;
|
||||
however, there are now situations where
|
||||
symbolically linked files will not be detected.
|
||||
Really need an internal vim function to do this
|
||||
identification.
|
||||
Apr 17, 2008 * When g:netrw_keepdir==0, current directory
|
||||
doesn't necessarily equal b:netrw_curdir
|
||||
initially. Problem is due to the patch directly
|
||||
above.
|
||||
* Fixed qf to handle case where b:netrw_curdir
|
||||
isn't the same as the current directory under
|
||||
linux/macosx.
|
||||
* New: |netrw-mg| (apply vimgrep to marked files)
|
||||
May 05, 2008 * (Rick) pointed out that a "setlocal ts=32" was
|
||||
interfering with g:netrw_maxfilenamelen
|
||||
May 05, 2008 * (James Vega) a file inside a linked directory
|
||||
was showing up as a symbolic link itself.
|
||||
May 22, 2008 * symbolic links, fifos, and sockets are now
|
||||
indicated by a trailing @, |, or =, respectively.
|
||||
Jun 06, 2008 * Removed numerous bugs from the marked file
|
||||
move and copy. Tested these changes under
|
||||
Unix only thus far.
|
||||
* :Rexplore returns to the screen position in the
|
||||
netrw listing from whence the file was edited
|
||||
v124: Apr 02, 2008 * (Adrian Rollett) change the line supporting the
|
||||
"x" action for mac to use g:netrw_shq
|
||||
v123: Feb 27, 2008 * Marked files now keeps a "global" marked file
|
||||
list. The global marked file list is used to
|
||||
support tag processing and vimdiff'ing
|
||||
@ -2415,7 +2649,7 @@ which is loaded automatically at startup (assuming :set nocp).
|
||||
Sep 20, 2007 * (Nico Weber) the "x" command has been extended
|
||||
to Mac's OS/X (macunix); it now uses open to
|
||||
handle |netrw-x| browsing with special files.
|
||||
Sep 22, 2007 * Added |g:netrw_noretmap| to netrw at Tony M's
|
||||
Sep 22, 2007 * Added g:netrw_noretmap to netrw at Tony M's
|
||||
request.
|
||||
* Included path to NetrwRemoteRmFile()
|
||||
v112: Aug 18, 2007 * added mx (|netrw-mx|) for executing arbitrary
|
||||
@ -2443,7 +2677,7 @@ which is loaded automatically at startup (assuming :set nocp).
|
||||
v110: May 10, 2007 * added [ and ] maps to NetrwTreeListing
|
||||
May 25, 2007 * |g:netrw_preview| included
|
||||
May 29, 2007 * modifed netrw#NetBrowseX to consistently use
|
||||
|g:netrw_shq| instead of hardcoded quotes,
|
||||
g:netrw_shq instead of hardcoded quotes,
|
||||
and modified the snippet that sets up redir
|
||||
so Windows machines use "nul" instead of
|
||||
"/dev/null".
|
||||
|
@ -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,7 +1,7 @@
|
||||
" Language : Netrw Remote-Directory Listing Syntax
|
||||
" Maintainer : Charles E. Campbell, Jr.
|
||||
" Last change: Feb 06, 2008
|
||||
" Version : 12
|
||||
" Last change: Aug 12, 2008
|
||||
" Version : 14
|
||||
" ---------------------------------------------------------------------
|
||||
|
||||
" Syntax Clearing: {{{1
|
||||
@ -34,7 +34,7 @@ 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 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
|
||||
@ -67,34 +67,35 @@ 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 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 link netrwTreeBar Special
|
||||
hi link netrwTimeSep netrwDateSep
|
||||
hi link netrwComma netrwComment
|
||||
hi link netrwHide netrwComment
|
||||
hi link netrwMarkFile Identifier
|
||||
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 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
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user