vis icon indicating copy to clipboard operation
vis copied to clipboard

Vim-like command prompt/history?

Open acidrums4 opened this issue 3 years ago • 2 comments

Dumb/noob question, but am not sure if there's any workaround and hope this to be as clear as my broken english allows.

As someone who came from vim (like 98% vim and 2% neovim, actually), there are some little things that still haven't ingrained in my muscle memory about vis, being one the prompt history.

I really like that vis treats it like another buffer, but it stores every duplicate and all stuff you put in it. For my use case it makes things tricky, as a regular ConTeXt typesetter I'm usually issuing :w, :sps or mtxrun --script context <file>.tex, the latter usually gets lost between all the :ws and the :sps and specially when doing things like gU or ~ in normal mode (as they will be registered as shell commands in the prompt history), so sometimes when you issue a :! (wanting to compile your document) vis will actually issue a :|tr '[:upper:]' '[:lower:]' over an empty selection/range/dot, just freezing the prompt.

It does not help that if you edit a previous command and execute it, vis will overwrite that line in the prompt buffer instead of making a new line of it, so the command you issued in the first place dissappears.

That being said, I know in the prompt you can search for previously executed commands with / as in a regular buffer, but it gets a little long having to type :, then [Arrow up], then [Esc] (as it will enter in insert mode), then /<the command you're searching for>, and cycling through the possible duplicates with n/N.

Is there any way to make the prompt history behave like vim's but while preserving the 'regular buffer' editing abilities? Or like a fuzzy thing where you can type part of a command, press the arrow keys and it'll offer you only the matches it finds?

acidrums4 avatar May 25 '22 16:05 acidrums4

You can use vis-complete to complete words inside the prompt. I wrote a plugin for line completion. With it you can type "mtxrun" and then C-x><C-l> will show possible completions.

You can also create custom maps to easily insert some text or create custom commands with vis:command_register.

jpaulogg avatar May 26 '22 21:05 jpaulogg