New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for plugin authors needs to be improved (poll) #3573
Comments
|
Really hope vim-script can be faster! 💯 |
|
Currently syntax highlighting is strictly regex-based. This is not fit for some languages*, is occasionally slow and attempts to highlight identifiers based on their type (e.g. like in C highlighting function-like macros separately from functions and functions separately from variables which are pointers to functions) rarely work well and always require quirky hacks, matchaddpos or not. It would be good to be able to define highlighting in a loadable C library while still allowing matches/&hlsearch, diff/sign/… highlighting, etc work without needing to care about them in that library. * Based on poor (in terms of semantic) performance of highlighting of VimL itself (like e.g. highlighting certain identifiers as commands while they are inside expressions: check |
|
IMHO the only feature really missing is some sort of overlays (à la emacs: https://www.gnu.org/software/emacs/manual/html_node/elisp/Overlays.html). This would provide for region-local maps, variables etc. This way information could be stored with some part of the text (and it would move with the text). |
|
The last time I tried, I found it rather difficult to work with subprocesses reliably across OSs -- e.g. linux + windows. Cross-plattform compatibility could be improved maybe. |
|
It would be great to have a standardized APIs for project-related information (e.g. file lists, root directory, VCS type, a way to set project-specific buffer-local options / variables etc.). Much of this can be implemented in vim plugins but it would be preferable if vim provided a standard way to do this. |
|
Add an option to enable fuzzy match and smart case when filter complete items(with |
|
It would be great if there were more commands or functions removing
|
|
Add support for compiling Vim plugin code into byte code. This will help in improving the |
|
Add support for async autocmd. |
|
Ability to go to full screen Edit - Merging Thread - Update 1 by @tonymec
(Omit the last | line if you don't want to start up in fullscreen mode.) Merging Thread - Update 2 by @prabirshrestha
|
|
Add support for This is basically what ctrlp.vim/fzf/fzy/vim-fz does but better. As a plugin author it is very difficult to support all these plugins to get fuzzy search. sometime I don't even use those and it becomes a maintenance headache for me to support it. I would like to see vim provide one of those UI so as a plugin author I only need to support one of them. Similar to how we have loclist and quickfix list. Ship it by default so I don't need to tell users to install more plugins to get fuzzy picker working. Problems with current fuzzy search.
Simple api. const items = [
{ 'label': 'git merge', description: 'Git merge', 'detail': 'Merge branches or commits in git', 'data': 'custom_data1' },
{ 'label': 'git commit', description: 'Git commit', 'detail': 'Create a git commit', 'data': 'customdata2' },
];
vscode.window.showQuickPick(items);Use cases: Fuzzy search for files/buffers/windows/tabs/symbols such as functions/classes or anything that the user want. |
|
A second non-interactive pop-up menu for function parameter hints and overload lists would allow a nice interface for every plugin that is doing any kind of completion. There has already been a lot of work done by me and @puremourning. The detailed RFC is here However, I couldn't figure everything out, especially the interaction with the |
|
Add support for |
|
Add support for easily making http calls via vimscript without spawning curl in the background.
|
|
First class encoding/decoding support and utils function
|
What dll hacks? Getting out of full screen programmatically may be less evident if you used that Maximize button (there is always the Unmaximize aka Restore button), but if you didn't, it is just a matter of setting au GUIEnter * command SetFullScreen -nargs=0 -bar
\ let s:FullScreen=1
\| set lines=99 columns=999
au GUIEnter * command ClearFullScreen -nargs=0 -bar
\ let s:FullScreen=0
\| let &lines = s:SaveLines
\| let &columns = s:SaveColumns
au GUIEnter * command ToggleFullScreen -nargs=0 -bar
\ if exists('s:FullScreen') && s:FullScreen
\| ClearFullScreen
\| else
\| SetFullScreen
\| endif
au GUIEnter *
\ let s:SaveLines = &lines
\| let s:SaveColumns = &columns
\| SetFullScreen(Omit the last |
|
A way to post messages or status updates to the user asynchronously such as status messages of a downstream process. Typical use case might be showing the parse or startup status of a background syntax checker, linter, completion engine. It’s possible currently but options aren’t great:
|
|
@tonymec by full screen I don’t mean maximize. Full screen as in no task bar and title window. I want my vim to be in one monitor and take all the pixels there similar to watching a movie. For now might be we shouldn’t pollute this thread. Might be worth waiting for few days and when these gets moved to own separate github issue we can discuss further. |
|
Add autocmd for window scroll event or emit event on scroll, so it could be possible to add information for visible lines after scroll. The |
|
@tomtom said:
It looks quite similar to my project feature and its |
|
I'd like a better way and simpler way to fetch the current callstack. I did open a RfC on the subject: #1125. TL;DR: it can be used for logging, for DbC, for unit testing. At this time it can be emulated but there are two problems: 1- it's extremely slow, 2- we need to take the locale into account, which is slow, and which is quite complex on non *nix platforms. |
|
I'd like fast functions that permit to work on lists. At this time, I'd like to see More generally, I'd like most of the list and dictionary related functions I've implemented in lh-vim-lib to be standard. |
|
Check the functions implemented in existing library plugins. Most of them would be welcomed as standard functions. I've a non exhaustive list at the end of the README of my core library plugin: https://github.com/LucHermitte/lh-vim-lib#some-other-vim-scripting-libraries |
|
I'd like to be able to run vim script command in background threads. For instance, running |
|
Bram Moolenaar wrote:
Vim has many features that plugin authors can use to achieve their
goal. But what is still missing? What could be simplified? What is
currently impossible?
Please use one comment for each suggestion. Use the thumbs-up and
thumbs-down to express whether you agree with a specific
answer/request (you can find that in the header of the comment on the
top right, looks like a smiley face).
(I tried starting this on stackoverflow, but apparently opinions are
not welcome there)
I'd like a way to rename a buffer that didn't have side effects. Sure
would help me get an updated version of netrw out!
Regards,
Chip Campbell
|
|
CLPUM(Command-line mode PopUp Menu) Get a patch from here. vim_dev thread: |
|
Better VimScript APIs for some of the existing functionalities, e.g.
One can use the existing |
This reminds me of another point: IMHO the current signs API is broken. There is no easy way to find out if an ID is already in use. As a consequence, it happens that signs from other plugins are accidentally overwritten, deleted etc. |
|
@idbrii You can define a command in vimL that displays another buffer instead of the current one so that the layout doesn't change when a buffer is deleted by the user (I personally use something based on vimtip1078). This doesn't provide any guarantees for when a plugin or vim itself creates a new buffer, deletes an old one etc. |
I don’t quite understand. Some authors would not like to use any of VimL and Python. Still, they have no choice. As for why would someone prefer VimL over Python, could you be more specific? Python isn’t the best language of the world, but VimL is a terrible, terrible programming language. For instance, Javascript programmers agreed at some point that That, plus VimL being a niche language, by contrast with the widely-known, general-purpose Python. |
|
Why use VimL? Because learning VimL is just learning Vim itself. Almost anything you learn in VimL can be used in daily interactive editing, and anything you use in daily interactive editing can be used in VimL. Though you are probably correct it is not ideal for heavyweight programming tasks, it is wonderful for when you already have a series of commands or tasks, which you already know how to do interactively, and just want to make a plugin to do it automatically instead of typing it out every time. It's also guaranteed to work on (almost) any Vim install, whereas Python and other languages must have support compiled in, and the appropriate library installed. |
From a Vim point of view, Vim script is not a niche language: it is the native language of Vim commands. Every serious Vim user knows Vim script, which is the language of the vimrc. From a Vim point of view, Perl, Python, Tcl, Ruby, lua and Scheme are niche languages, supported only by means of optional features; and C can be used too but only by recompiling the editor, so it is usable for built-in features (standard or optional) but not for plugins. All other languages are simply out of context, not part of the "universe of discourse". Oh, and BTW, anyone who thinks that Vim script (which I might loosely label an Algol-like structured language) is "terrible" and that Lisp (a prefix-Polish notation with lots of parentheses) is "great" is losing his/her time discussing Vim, what (s)he should use is Emacs. 😛 Best regards, |
They can already write their plugins in Python, Perl, Ruby, Scheme, Lua, Perl, and even Tcl. That's plenty of choice.
I have no use whatsoever for Python or any of the languages above so I don't want to have to learn any of them in order to configure/extend my text editor.
Different languages; different paradigms. Get over it. That meme is just as baseless in vimscript as it has always been in JavaScript. Also, we, JavaScript "developers", never agree on anything for more than a couple weeks so it's hard to take us seriously and use our shenanigans as an example of something done right.
What's inconsistent, exactly? And what does SO has to do with any of this?
Not if the plugin author cared to read
Well, Vim doesn't even have a single built-in function or command for linting its scripting language so… what does that even mean?
All languages are niche languages. As a web frontend developer I couldn't care less about learning Python, Ruby, Lua, or elisp, has I have zero use for them in my line of work. Those languages are niche languages from my point of view. Vimscript is just the commands you use every day, plus a bunch of useful functions. You don't learn vimscript: you learn Vim and vimscript comes along the way. |
|
This would help I think: Simplify and sanitise the execution environment for vim scripts. This could include Script-local settings Or sand boxing of options within scripts plugins and mappings. Many if not all scripts must use certain tricks to ensure they execute with know options, such as setting and restoring cpo, magic and remembering to include thinks like \v\c in regexes. Perhaps this could include defining a set of option values with which which all plugins execute (such as the Vim defaults). This could be opt-in eg opting in with a single command. I see a lot of vim scripts that break eg when settings like ignorecase and such are changed. |
Eval/execute being a security issue is not the case in most places where it is used in VimL plugins though. But there are good habits out there which make
For example, escaping: there is different escaping for options, comma separated options, specific comma separated options (like Try to create a table where rows are dedicated to some place you may want to put filename in (list is above) and columns are dedicated to characters which need to be escaped and list how you put literal character in each slot. List of characters: space, newline (it is possible to have newlines within file names on linux), There are also inconsistencies like There is also inconsistency of what I can also remember substitute flags: adding Also what does newline mean when reading VimL code from a file and when using
If you only read |
The gettagstack() and settagstack() functions are supported now by patch 8.1.0519. |
|
The virtual text feature of Neovim. It makes various cases easy to implement:
This is not the same as the conceal feature. Because
" setvirttext({text}, {mark}, {hl_group})
" Please see the below comment for {mark}.
call setvirttext('this is example text of virtual text', 'myplugin_markA', 'Error') |
While writing above comment, I remember that I wanted the APIs of mark feature (:h mark). Here is the example: " It can set the information of the specified mark.
" It returns getpos() function's information (and more?):
" {
" 'bufnr': <buffer number>,
" 'lnum': <line number>,
" 'col': <column number>,
" 'off': <offset number when virtualedit is used>,
" }
echo getmark('a')
" And it can set mark too
" setmark({mark}, {lnum}, {col} [, {options}])
call setmark('a', line('.'), col('.'), {
"\ optional, default: current buffer number
\ 'bufnr': bufnr(''),
"\ optional, default: 0
\ 'off': 0,
\})
" Also it can get / set own mark
call setmark('myplugin_markA', line('.'), col('.'))
" After editing text ...
" Where is the position of the mark?
echo getmark('myplugin_markA')I also edited my above comment to add the example of virtual text API. |
|
@tyru Note the Nvim API allow you to supply a list of chunks with different highlights Also only after-EOL text (as in the ALE example) + highlighting of existing text is implemented so far in Nvim, anything that involves shifting of existing text (as in the android studio example) will be more tricky. |
|
@bfredl Well, what is the difference from assigning different marks? call setvirttext('text', 'myplugin_mark', 'Comment')
call setvirttext('more text', 'myplugin_mark_more', 'ErrorMsg')Why does neovim support supplying chunks for same ID? |
@tyru that it is two separate things with completely different purposes? The chunks in the Nvim API I mentioned, are differently colored chunks of the same text annotation, not different messages at different places. Consider a linter or expression evaluator (in the style of Light Table) that gives colored output, the API allows that coloring to be preserved verbatim.
Why should we not allow such a thing? If the plugin just cares about updating all its annotations of a buffer in bulk, why shouldn't it be able to just delete the entire old state in one call? But if the plugin wants a separate ID per item, we are allowing that also. |
|
|
|
I think it's good to have heredoc-like syntax for Vim script. Sometimes I make a script to generate multiple text files from a template. In some points, Vim script is a useful measure to handle such text processing, but one thing embedding a long template is not so easy now. Usually, I prepare another file as a template. However, it would be better if we could just embed the template to a script file. Currently, it is possible to write: let longtext = "The first line.\n
\The second line\n
\The third line.\n"But, adding leading "\" and trailing "\n" is a little tedious (and also this is not highlighted correctly). It seems similar syntax is already in Vim script for |
|
One feature I use quite a bit is copying a region of VimL and sourcing it with the This doesn't work when lines are continued with let g:x =
\ 'example'... the above is valid VimL but can't be yanked and sourced like I would expect. This issue crops up enough to be frustrating. |
command! -bar -range Execute silent <line1>,<line2>yank z | let @z = substitute(@z, '\n\s*\\', '', 'g') | @z |
|
I would like to request for arbitrarily user-defined marks with names not predefined by vim (including Marks are very good facilities in vim which can be used to track positions. They are aware of the changes to the buffer. For example, the mark position will be adjusted automatically while there is deletion and insertion of lines before the mark. In plugins, especially those use background async jobs provided by vim 8, we frequently have the needs to update the buffer at a certain position and this position should be adapted to buffer changes. This can be achieved by marking the position first and retrieve its position later using the mark. However, the named marks provided by vim is exposed to the user and have shared access by all plugins. Therefore, one plugin has no way to protect the special marks which it relies on. The functionality of the plugin could easily break if the user or other plugins changed the mark position. I then request to have user defined mark names for which the plugin users can create, just like the user defined match groups as provided by function I would like to thank @chrisbra and @inkarkat for referring this wonderful site to me and their suggestions on this issue. The original discussion can be found in vi.stackexchange.com Just realized that @tyru already created a similar request. If you feel this post doesn't provide more information than his, please feel free to delete this one. |
|
@liushapku it already exists |
|
@tyru Thanks for having already done the work. My bad to not have read all the threads here. |
|
@tyru, as for the api, I would recommend to use the same signature as that of the Then you can simply call |
|
(I've completely forgotten) I don't find the current (viml) debugger ergonomic. It does the job, but it does not permit to see the code side by side with the current debugging state. Having an UI similar to TermDebug would be nice. Note that I understand it would be really complex to debug vim scripts in a running session of vim. |
|
Still about debugging our vim scripts, it would be nice to have fail-fast assertions. My issues with current assertions are:
I've implemented fail-fast assertions [1] that permits us to chose between:
It works, but it's quite convoluted, and it would be nice if this could be a standard feature. [1] https://github.com/LucHermitte/lh-vim-lib/blob/master/doc/DbC.md |
|
The debugger UI should not actually be run in the same Vim instance. That makes it hard to implement suggestions like @LucHermitte’s and additionally forces you to choose between seeing Vim screen state or seeing your debug session, additionally making it impossible to see old parts of debugging session after seeing screen state. Not to mention that forcing |
|
I am closing this now. Thanks everybody for your input! |








Vim has many features that plugin authors can use to achieve their goal. But what is still missing? What could be simplified? What is currently impossible?
Please use one comment for each suggestion. Use the thumbs-up and thumbs-down to express whether you agree with a specific answer/request (you can find that in the header of the comment on the top right, looks like a smiley face).
NOTE: Let's delete comments that are older than 24 hours that are not items to vote on. Otherwise the list gets too long and confusing. This issue is not for discussing alternatives, the author can update the suggestion when needed (but don't change the meaning, otherwise previous votes are miscounted).
(I tried starting this on stackoverflow, but apparently opinions are not welcome there)
The text was updated successfully, but these errors were encountered: