0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

Support :browse for commands that use an error file argument. (Lech Lorens)

This commit is contained in:
Bram Moolenaar
2010-07-11 16:58:51 +02:00
parent 7e6d3bd3da
commit 9028b10dfe
8 changed files with 61 additions and 42 deletions

View File

@@ -1171,14 +1171,21 @@ If you want to always use ":confirm", set the 'confirm' option.
*:browse* *:bro* *E338* *E614* *E615* *E616* *E578* *:browse* *:bro* *E338* *E614* *E615* *E616* *E578*
:bro[wse] {command} Open a file selection dialog for an argument to :bro[wse] {command} Open a file selection dialog for an argument to
{command}. At present this works for |:e|, |:w|, {command}. At present this works for |:e|, |:w|,
|:r|, |:saveas|, |:sp|, |:mkexrc|, |:mkvimrc|, |:wall|, |:wq|, |:wqall|, |:x|, |:xall|, |:exit|,
|:mksession|, |:split|, |:vsplit|, and |:tabe|. |:view|, |:sview|, |:r|, |:saveas|, |:sp|, |:mkexrc|,
|:mkvimrc|, |:mksession|, |:mkview|, |:split|,
|:vsplit|, |:tabe|, |:tabnew|, |:cfile|, |:cgetfile|,
|:caddfile|, |:lfile|, |:lgetfile|, |:laddfile|,
|:diffsplit|, |:diffpatch|, |:open|, |:pedit|,
|:redir|, |:source|, |:update|, |:visual|, |:vsplit|,
and |:qall| if 'confirm' is set.
{only in Win32, Athena, Motif, GTK and Mac GUI} {only in Win32, Athena, Motif, GTK and Mac GUI}
When ":browse" is not possible you get an error When ":browse" is not possible you get an error
message. If the |+browse| feature is missing or the message. If the |+browse| feature is missing or the
{command} doesn't support browsing, the {command} is {command} doesn't support browsing, the {command} is
executed without a dialog. executed without a dialog.
":browse set" works like |:options|. ":browse set" works like |:options|.
See also |:oldfiles| for ":browse oldfiles".
The syntax is best shown via some examples: > The syntax is best shown via some examples: >
:browse e $vim/foo :browse e $vim/foo

View File

@@ -18,7 +18,7 @@
|Q_sc| Scrolling |Q_ce| Ex: Command-line editing |Q_sc| Scrolling |Q_ce| Ex: Command-line editing
|Q_in| insert: Inserting text |Q_ra| Ex: Ranges |Q_in| insert: Inserting text |Q_ra| Ex: Ranges
|Q_ai| insert: Keys |Q_ex| Ex: Special characters |Q_ai| insert: Keys |Q_ex| Ex: Special characters
|Q_ss| insert: Special keys |Q_st| Starting VIM |Q_ss| insert: Special keys |Q_st| Starting Vim
|Q_di| insert: Digraphs |Q_ed| Editing a file |Q_di| insert: Digraphs |Q_ed| Editing a file
|Q_si| insert: Special inserts |Q_fl| Using the argument list |Q_si| insert: Special inserts |Q_fl| Using the argument list
|Q_de| change: Deleting text |Q_wq| Writing and quitting |Q_de| change: Deleting text |Q_wq| Writing and quitting
@@ -68,7 +68,7 @@ N is used to indicate an optional count that can be given before the command.
non-blank character non-blank character
|gg| N gg goto line N (default: first line), on the first |gg| N gg goto line N (default: first line), on the first
non-blank character non-blank character
|N%| N % goto line N percentage down in the file; N must be |N%| N % goto line N percentage down in the file; N must be
given, otherwise it is the |%| command given, otherwise it is the |%| command
|gk| N gk up N screen lines (differs from "k" when line wraps) |gk| N gk up N screen lines (differs from "k" when line wraps)
|gj| N gj down N screen lines (differs from "j" when line wraps) |gj| N gj down N screen lines (differs from "j" when line wraps)
@@ -1086,7 +1086,7 @@ Context-sensitive completion on the command-line:
|:_%| % current file name (only where a file name is expected) |:_%| % current file name (only where a file name is expected)
|:_#| #[num] alternate file name [num] (only where a file name is |:_#| #[num] alternate file name [num] (only where a file name is
expected) expected)
Note: The next five are typed literally; these are not special keys! Note: The next seven are typed literally; these are not special keys!
|:<afile>| <abuf> buffer number, for use in an autocommand (only where a |:<afile>| <abuf> buffer number, for use in an autocommand (only where a
file name is expected) file name is expected)
|:<afile>| <afile> file name, for user in an autocommand (only where a |:<afile>| <afile> file name, for user in an autocommand (only where a
@@ -1110,7 +1110,7 @@ Context-sensitive completion on the command-line:
|::e| :e extension |::e| :e extension
|::s| :s/{pat}/{repl}/ substitute {pat} with {repl} |::s| :s/{pat}/{repl}/ substitute {pat} with {repl}
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*Q_st* Starting VIM *Q_st* Starting Vim
|-vim| vim [options] start editing with an empty buffer |-vim| vim [options] start editing with an empty buffer
|-file| vim [options] {file} .. start editing one or more files |-file| vim [options] {file} .. start editing one or more files
@@ -1144,7 +1144,7 @@ Context-sensitive completion on the command-line:
|-n| -n do not create a swap file |-n| -n do not create a swap file
|-o| -o [num] open [num] windows (default: one for each file) |-o| -o [num] open [num] windows (default: one for each file)
|-f| -f GUI: foreground process, don't fork |-f| -f GUI: foreground process, don't fork
Amiga: do not restart VIM to open a window (for Amiga: do not restart Vim to open a window (for
e.g., mail) e.g., mail)
|-s| -s {scriptin} first read commands from the file {scriptin} |-s| -s {scriptin} first read commands from the file {scriptin}
|-w| -w {scriptout} write typed chars to file {scriptout} (append) |-w| -w {scriptout} write typed chars to file {scriptout} (append)
@@ -1161,7 +1161,7 @@ Context-sensitive completion on the command-line:
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*Q_ed* Editing a file *Q_ed* Editing a file
Without !: Fail if changes has been made to the current buffer. Without !: Fail if changes have been made to the current buffer.
With !: Discard any changes to the current buffer. With !: Discard any changes to the current buffer.
|:edit_f| :e[dit][!] {file} edit {file} |:edit_f| :e[dit][!] {file} edit {file}
|:edit| :e[dit][!] reload the current file |:edit| :e[dit][!] reload the current file
@@ -1190,13 +1190,13 @@ Context-sensitive completion on the command-line:
|:wN| :wN[ext][!] [file] write file and edit previous file |:wN| :wN[ext][!] [file] write file and edit previous file
in current window in new window ~ in current window in new window ~
|:argument| :argu[ment] N :sar[gument] N Edit file N |:argument| :argu[ment] N :sar[gument] N edit file N
|:next| :n[ext] :sn[ext] Edit next file |:next| :n[ext] :sn[ext] edit next file
|:next_f| :n[ext] {arglist} :sn[ext] {arglist} define new arg list |:next_f| :n[ext] {arglist} :sn[ext] {arglist} define new arg list
and edit first file and edit first file
|:Next| :N[ext] :sN[ext] Edit previous file |:Next| :N[ext] :sN[ext] edit previous file
|:first| :fir[st] :sfir[st] Edit first file |:first| :fir[st] :sfir[st] edit first file
|:last| :la[st] :sla[st] Edit last file |:last| :la[st] :sla[st] edit last file
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*Q_wq* Writing and quitting *Q_wq* Writing and quitting
@@ -1231,18 +1231,18 @@ Context-sensitive completion on the command-line:
|:xall| :xa[ll][!] or :wqall[!] |:xall| :xa[ll][!] or :wqall[!]
write all changed buffers and exit write all changed buffers and exit
|:stop| :st[op][!] suspend VIM or start new shell; if 'aw' option |:stop| :st[op][!] suspend Vim or start new shell; if 'aw' option
is set and [!] not given write the buffer is set and [!] not given write the buffer
|CTRL-Z| CTRL-Z same as ":stop" |CTRL-Z| CTRL-Z same as ":stop"
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*Q_ac* Automatic Commands *Q_ac* Automatic Commands
|viminfo-file| Read registers, marks, history at startup, save when exiting. |viminfo-file| read registers, marks, history at startup, save when exiting.
|:rviminfo| :rv[iminfo] [file] Read info from viminfo file [file] |:rviminfo| :rv[iminfo] [file] read info from viminfo file [file]
|:rviminfo| :rv[iminfo]! [file] idem, overwrite existing info |:rviminfo| :rv[iminfo]! [file] idem, overwrite existing info
|:wviminfo| :wv[iminfo] [file] Add info to viminfo file [file] |:wviminfo| :wv[iminfo] [file] add info to viminfo file [file]
|:wviminfo| :wv[iminfo]! [file] Write info to viminfo file [file] |:wviminfo| :wv[iminfo]! [file] write info to viminfo file [file]
|modeline| Automatic option setting when editing a file |modeline| Automatic option setting when editing a file
@@ -1252,19 +1252,19 @@ Context-sensitive completion on the command-line:
|autocommand| Automatic execution of commands on certain events. |autocommand| Automatic execution of commands on certain events.
|:autocmd| :au List all autocommands |:autocmd| :au list all autocommands
|:autocmd| :au {event} List all autocommands for {event} |:autocmd| :au {event} list all autocommands for {event}
|:autocmd| :au {event} {pat} List all autocommands for {event} with |:autocmd| :au {event} {pat} list all autocommands for {event}
{pat} with {pat}
|:autocmd| :au {event} {pat} {cmd} Enter new autocommands for {event} |:autocmd| :au {event} {pat} {cmd} enter new autocommands for {event}
with {pat} with {pat}
|:autocmd| :au! Remove all autocommands |:autocmd| :au! remove all autocommands
|:autocmd| :au! {event} Remove all autocommands for {event} |:autocmd| :au! {event} remove all autocommands for {event}
|:autocmd| :au! * {pat} Remove all autocommands for {pat} |:autocmd| :au! * {pat} remove all autocommands for {pat}
|:autocmd| :au! {event} {pat} Remove all autocommands for {event} |:autocmd| :au! {event} {pat} remove all autocommands for {event}
with {pat} with {pat}
|:autocmd| :au! {event} {pat} {cmd} Remove all autocommands for {event} |:autocmd| :au! {event} {pat} {cmd} remove all autocommands for {event}
with {pat} and enter new one with {pat} and enter new one
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*Q_wi* Multi-window commands *Q_wi* Multi-window commands

View File

@@ -3155,6 +3155,7 @@ when it is concealed (setting "cchar" only makes sense when the conceal
argument is given.) If "cchar" is not set then the default conceal argument is given.) If "cchar" is not set then the default conceal
character defined in the 'listchars' option is used. Example: > character defined in the 'listchars' option is used. Example: >
:syntax match Entity "&amp;" conceal cchar=& :syntax match Entity "&amp;" conceal cchar=&
See |hl-Conceal| for highlighting.
contained *:syn-contained* contained *:syn-contained*

View File

@@ -1092,10 +1092,7 @@ Vim 7.3:
- soon: remove UF_VERSION_CRYPT_PREV and UF_VERSION_PREV. - soon: remove UF_VERSION_CRYPT_PREV and UF_VERSION_PREV.
- Conceal feature: no update when moving to another window. (Dominique Pelle, - Conceal feature: no update when moving to another window. (Dominique Pelle,
2010 Jul 5) Vince will look into it. 2010 Jul 5) Vince will look into it.
Patches to include: Patches to possibly include:
- Gvimext patch to support wide file names. (Szabolcs Horvat 2008 Sep 10)
- Patch to support netbeans for Mac. (Kazuki Sakamoto, 2009 Jun 25)
- Patch to support clipboard for Mac terminal. (Jjgod Jiang, 2009 Aug 1)
- Patch to support :browse for more commands. (Lech Lorens, 2009 Jul 18) - Patch to support :browse for more commands. (Lech Lorens, 2009 Jul 18)
- Patch to improve javascript indenting. (Hari Kumar G, 2010 May 22) - Patch to improve javascript indenting. (Hari Kumar G, 2010 May 22)
- Patch to use return value of 'formatexpr'. (James Vega, 2010 Jun 16) - Patch to use return value of 'formatexpr'. (James Vega, 2010 Jun 16)
@@ -1197,6 +1194,8 @@ More patches:
Sep 13) Sep 13)
- Patch for adding "space" item in 'listchars'. (Jérémie Roquet, 2009 Oct 29, - Patch for adding "space" item in 'listchars'. (Jérémie Roquet, 2009 Oct 29,
Docs patch Oct 30) Docs patch Oct 30)
- Patch to support clipboard for Mac terminal. (Jjgod Jiang, 2009 Aug 1)
Needs to be updated for block-wise selection.
Awaiting updated patches: Awaiting updated patches:

View File

@@ -1,8 +1,8 @@
" VHDL indent ('93 syntax) " VHDL indent ('93 syntax)
" Language: VHDL " Language: VHDL
" Maintainer: Gerald Lai <laigera+vim?gmail.com> " Maintainer: Gerald Lai <laigera+vim?gmail.com>
" Version: 1.55 " Version: 1.56
" Last Change: 2010 Jun 27 " Last Change: 2010 Jun 29
" URL: http://www.vim.org/scripts/script.php?script_id=1450 " URL: http://www.vim.org/scripts/script.php?script_id=1450
" only load this indent file when no other was loaded " only load this indent file when no other was loaded
@@ -386,10 +386,10 @@ function GetVHDLindent()
endif endif
" indent: -sw " indent: -sw
" keywords: "end" + identifier " keywords: "end" + identifier, ";"
" where: start of current line " where: start of current line
"if curs =~? '^\s*end\s\+\w\+\>' "if curs =~? '^\s*end\s\+\w\+\>'
if curs =~? '^\s*end\s' if curs =~? '^\s*end\%(\s\|;'.s:ES.'\)'
return ind - &sw return ind - &sw
endif endif

View File

@@ -117,8 +117,8 @@ if s:i > 0
endif endif
" Italian " Italian
if v:lang == "IT" if v:lang =~ '\<IT\>' || v:lang =~? "italian"
syn keyword helpNote nota Nota NOTA notare: Notare: NOTARE: syn keyword helpNote nota Nota NOTA nota: Nota: NOTA: notare Notare
syn match helpSpecial "Nma"me=e-2 syn match helpSpecial "Nma"me=e-2
syn match helpSpecial "Nme"me=e-2 syn match helpSpecial "Nme"me=e-2
syn match helpSpecial "Nmi"me=e-2 syn match helpSpecial "Nmi"me=e-2

View File

@@ -904,7 +904,7 @@ EX(CMD_sunmenu, "sunmenu", ex_menu,
EX(CMD_suspend, "suspend", ex_stop, EX(CMD_suspend, "suspend", ex_stop,
TRLBAR|BANG|CMDWIN), TRLBAR|BANG|CMDWIN),
EX(CMD_sview, "sview", ex_splitview, EX(CMD_sview, "sview", ex_splitview,
NEEDARG|RANGE|NOTADR|BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_swapname, "swapname", ex_swapname, EX(CMD_swapname, "swapname", ex_swapname,
TRLBAR|CMDWIN), TRLBAR|CMDWIN),
EX(CMD_syntax, "syntax", ex_syntax, EX(CMD_syntax, "syntax", ex_syntax,

View File

@@ -2951,6 +2951,18 @@ ex_cfile(eap)
|| eap->cmdidx == CMD_laddfile) || eap->cmdidx == CMD_laddfile)
wp = curwin; wp = curwin;
#ifdef FEAT_BROWSE
if (cmdmod.browse)
{
char_u *browse_file = do_browse(0, (char_u *)_("Error file"), eap->arg,
NULL, NULL, BROWSE_FILTER_ALL_FILES, NULL);
if (browse_file == NULL)
return;
set_string_option_direct((char_u *)"ef", -1, browse_file, OPT_FREE, 0);
vim_free(browse_file);
}
else
#endif
if (*eap->arg != NUL) if (*eap->arg != NUL)
set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0); set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0);