Ingo Karkat
383183c91f
ENH: Allow Funcref for a:parameters.wildignore, too
2023-05-15 16:59:45 +02:00
Ingo Karkat
1bb08b5061
ENH: Allow Funcref for a:parameters.browsefilter, too
2023-05-15 16:57:27 +02:00
Ingo Karkat
22e8d52bdb
Also extract the bang, count, and mods when completing
2023-05-15 16:28:22 +02:00
Ingo Karkat
635e21759c
ingo#plugin#cmdcomplete#dirforaction: ENH: Allow passing of 'commandAttributes': '-count'
2023-05-15 15:55:23 +02:00
Ingo Karkat
39b0592b8d
dirforaction: ENH: Add a:parameters.completeFunctionHook
2021-03-16 13:50:11 +01:00
Ingo Karkat
1b6002acd0
dirforaction: BUG: Passed filenames with escaped glob characters not handled correctly; need to use the unescaped filename for l:isAbsoluteFilename check
2021-03-10 19:35:28 +01:00
Ingo Karkat
4196829a5b
Refactoring: Minor: Define l:unescapedFilename also when l:filename is set and reuse the variable for s:ResolveDirspecs()
2021-03-10 19:34:45 +01:00
Ingo Karkat
4f4fddf81b
ingo#plugin#cmdcomplete#dirforaction#setup(): Compatibility: Avoid "E693: Can only compare Funcref with Funcref"
...
Does not happen with Vim 7.4.1689, but seen in 7.4.629.
2020-06-12 10:49:59 +02:00
Ingo Karkat
58a403d030
ENH: Use special completion that only returns directories if a:parameters.action is "chdir"
...
This allows to define commands like :FooCd and have that only offer directories for completion (assuming that a:isAllowOtherDirs and/or a:isIncludeSubdirs are set).
2020-03-03 22:08:12 +01:00
Ingo Karkat
f9b0b5b879
Refactoring: Add a:isReturnRawFilespecs to s:CompleteFiles()
...
To be able to obtain the raw (i.e. without s:RemoveDirspec() and no fnameescape()) list of completion filespecs.
2020-03-03 22:07:14 +01:00
Ingo Karkat
3ec5663361
Refactoring: Extract s:ResolveDirspecsToList()
2020-03-03 22:06:01 +01:00
Ingo Karkat
944c7683ba
FIX: Don't concatenate dirspec and filename if the latter is absolute
...
Instead, make the dirspec empty so that the entire (absolute) addressing is through the user-provided filename.
2020-03-03 21:28:25 +01:00
Ingo Karkat
b7a097bb2c
WIP: Pass a:isAllowOtherDirs into s:Command() and check whether the passed filename conforms to it
...
Print an error when trying to reach outside the base directory but that is not allowed by the client (! a:isAllowOtherDirs).
2020-03-03 21:22:53 +01:00
Ingo Karkat
9934de8a2f
FIX: Keep ../ prefix when completing upwards directories
...
Previously, only absolute argleads went into the branch that removes the dirspec from the results, and the (upwards) directories were not resolved (into l:resolvedDirspecs) nor kept.
2020-03-03 21:16:55 +01:00
Ingo Karkat
724f82a4f1
FIX: Need to unescape filename passed to s:ResolveDirspecs()
...
As that one uses glob() (not an Ex command), and that one takes the unescaped filename. (The dirspec already is unescaped.)
2020-03-03 20:50:48 +01:00
Ingo Karkat
8464fcb3e4
FIX: Don't complete subdirectories of a:dirspecs when argLead already contains a path
...
But do allow completion of other directories if that is configured.
2020-03-03 20:32:51 +01:00
Ingo Karkat
2127f78d4f
FIX: Also complete absolute argLead directories when a:isIncludeSubdirs is false
...
The a:isIncludeSubdirs should only apply to directories within a:dirspecs; if a:isAllowOtherDirs is true, these directories should be completed regardless of the a:isIncludeSubdirs value.
2020-03-03 17:47:08 +01:00
Ingo Karkat
e35875cf4c
ingo#plugin#cmdcomplete#dirforaction#setup(): Align generated function names and global context variable name
2020-03-03 15:54:47 +01:00
Ingo Karkat
e143a4bf51
Cosmetics: Delete changelog
2020-03-01 19:44:57 +01:00
Ingo Karkat
d01606acf7
Renaming: Correct file header and autoload function name after importing into ingo-library
2020-03-01 19:43:38 +01:00
Ingo Karkat
60683a72b7
Adapt: Need to check <count> == -1 instead of <line2> to support current line as well as a lnum of 0 (since Vim 8.1.1241)
2020-03-01 19:29:16 +01:00
Ingo Karkat
c16ee2da52
2020-03-01 19:29:16 +01:00
Ingo Karkat
838741f999
2020-03-01 19:29:16 +01:00
Ingo Karkat
5784c3d834
ENH: Add a:options.isAllowOtherDirs to configure handling of absolute argleads
...
The completion so far just kept a leading "/", which isn't so helpful.
2020-03-01 19:29:13 +01:00
Ingo Karkat
1fe998c29d
ENH: Get <mods> information into s:Command() and pass this on to a:Action, and make this accessible to a:Action Funcrefs via a context object g:CommandCompleteDirForAction_Context
2020-03-01 19:29:10 +01:00
Ingo Karkat
0f3f26b4a2
Factor out s:ResolveDirspecs()
...
ENH: Handle List of dirspecs, all of which will be used for completion, and the subpath passed to the command will be searched in each and the first found filespec returned.
2020-03-01 19:29:06 +01:00
Ingo Karkat
06140a2231
Factor our s:ResolveDirspec()
2020-03-01 19:29:03 +01:00
Ingo Karkat
9a779ece36
Emulate lower priority of filespecs matching 'suffixes' via custom s:SuffixesSort() function, and use that when multiple glob() results have to be combined and sorted
2020-03-01 19:29:00 +01:00
Ingo Karkat
a2ff39e7b5
CommandCompleteDirForAction.vim
...
Define custom command to complete files from a specified directory.
2020-03-01 19:28:57 +01:00
Ingo Karkat
fd6349538c
ENH: Support List of a:parameters.browsefilter
2020-03-01 19:28:54 +01:00
Ingo Karkat
ad0da93a28
ENH: Support multiple and fnamemodify()'ed placement of the filespec in a:parameters.action similar to 'makeprg'
2020-03-01 19:28:51 +01:00
Ingo Karkat
5790fb4a13
Fix typo
2020-03-01 19:28:48 +01:00
Ingo Karkat
d2835acf22
Use ingo#compat#glob()
2020-03-01 19:28:45 +01:00
Ingo Karkat
1137b7dcad
Abort on error
2020-03-01 19:28:42 +01:00
Ingo Karkat
fbd99a93af
2020-03-01 19:28:41 +01:00
Ingo Karkat
6932f18be0
Move escapings.vim into ingo-library
2020-03-01 19:28:38 +01:00
Ingo Karkat
d0cf5a6805
Use ingo/fs/path.vim
2020-03-01 19:28:35 +01:00
Ingo Karkat
ce10278218
Better handling for errors from :echoerr
2020-03-01 19:28:32 +01:00
Ingo Karkat
3311448b85
Move ingofileargs.vim into ingo-library
2020-03-01 19:28:28 +01:00
Ingo Karkat
a8ee9205b3
Minor refactoring
2020-03-01 19:28:24 +01:00
Ingo Karkat
d2469307ba
2020-03-01 19:28:16 +01:00
Ingo Karkat
721ba9aace
ENH: Allow determining the a:dirspec during runtime by taking a Funcref instead of string
...
Use error handling functions from ingo/msg.vim.
2020-03-01 19:28:12 +01:00
Ingo Karkat
a10ec3f2fc
2020-03-01 19:28:12 +01:00
Ingo Karkat
870f52a193
Handle ++enc= and +cmd file options and commands
...
This requires an extension of the a:parameters.action, a:parameters.FilenameProcessingFunction and a:parameters.FilespecProcessingFunction values to take and return an additional fileOptionsAndCommands argument.
2020-03-01 19:28:08 +01:00
Ingo Karkat
bf56f9b5fb
Apply special logic to support lnum 0 with a:parameters.commandAttributes = "-range=-1" described at :help ingo-command-lnum
2020-03-01 19:28:05 +01:00
Ingo Karkat
3c6ffd113b
ENH: Added a:parameters.FilespecProcessingFunction to allow processing of both dirspec and filename
...
This is now used by the :Vim command to expand arbitrary <SID> numbers to the corresponding full path.
FIX: Actually abort the processing when a:parameters.FilenameProcessingFunction returns an empty filename (as was documented).
2020-03-01 19:28:02 +01:00
Ingo Karkat
dbec6a965a
2020-03-01 19:28:02 +01:00
Ingo Karkat
535bd6f275
ENH: Allow special "%" value or Funcref for a:parameters.defaultFilename
...
FIX: Don't append <bang> to a:Action of type command; this should be contained in a:Action = "MyCommand<bang>".
Handle custom exceptions thrown from Funcrefs.
2020-03-01 19:27:58 +01:00
Ingo Karkat
39d5961497
You can then use the new command with file completion
2020-03-01 19:27:54 +01:00
Ingo Karkat
dc52339ebc
ENH: Get <bang> infomation ingo s:Command() and pass this on to a:Action, and make this accessible to a:Action Funcrefs via a context object g:CommandCompleteDirForAction_Context
2020-03-01 19:27:51 +01:00