Questions tagged [user-input]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
31 views

Android Vim (DroidVim?) keyboard with swipe functionality

I am wondering what it would take to build an Android keyboard that mimicked Vim, with swipe (swype?) functionality (such as the one Google's Gboard uses to allow users to write on Android). This ...
5 votes
2 answers
892 views

How do I get the next n characters input by the user?

I answered a question that needed a user input using the built-in input() function, which works great. I was wondering if it was possible to ask vim for (let say) the next 3 characters input, without ...
1 vote
1 answer
161 views

Vim's keyboard/mouse input handling

How does Vim/Neovim get input from the user? I am trying to make my input parser but cannot find a way to detect meta keys (Ctrl/Shift/Alt) with mouse input nor can I detect mouse movement - only ...
0 votes
1 answer
280 views

How to pass an argument to a user command that contains a space

I have a user command that grep-replaces files recursively using vimgrep and cfdo: -- Grep vim.api.nvim_create_user_command( 'Grep', function(opts) if #opts.fargs < 1 then print("...
0 votes
5 answers
458 views

Replace pattern with user input for every occurrence on the line

I'm a new Vim user, so please bear with me. A while ago I wanted to be able to replace a pattern with user input, and I stumbled upon this question on StackOverflow, and its answer worked beautifully. ...
16 votes
2 answers
670 views

Multiple choice substitute?

Normally, a substitute with the c option gives me two options: (y)es or (n)o. Is it possible to have several numbered yes options to choose from? Example File person: Alice dog: Tobby person: Bob ...
2 votes
1 answer
128 views

Execute a shell command over a visual range with a user input prompt?

In my Markdown notes, I would like to: Select a few lines with V Encrypt those lines, externally, with :!gpg Prompt for a password rather than store it, possibly with input() I tried executing over ...
22 votes
2 answers
20k views

How do I exit from input after using a `:i` command?

I got stuck in ex input mode by typing :i. Now I cannot use any commands. All there is just a string of text. Pressing escape does not get me out of it, typing :visual does not get me out of it, and ...
2 votes
0 answers
326 views

How does neovim handle keyboard input?

In classical Vim, keyboard input is handled fairly archaically, and it's why you can't remap say <Ctrl-M> and <Enter> to different keys or commands. This is probably my biggest gripe about ...
11 votes
2 answers
2k views

How does vimgolf record all keystrokes?

From time to time I like to engage in a round of vimgolf. It can be enlightening. How are they able to record all the keystrokes? That must be a vim feature. Anybody any idea how to do that. It could ...
2 votes
2 answers
1k views

confirm(msg, choices) without newline on msg?

Is there any way to have the confirm function place the choices on the same line as the msg prompt? confirm("Yes no question", "&Yes\n&No", 2) Instead of Yes no question (Y)es, [N]o: it ...
6 votes
1 answer
949 views

Is there a way to display in the statusline when capslock is detected?

One of the biggest problems I currently have in Vim is I start working enter a few commands and suddenly all key binds and commands start acting up. After a few seconds of panic and trying to do the ...
0 votes
1 answer
58 views

How does the dialog for W11 work?

If I edit a file outside of a Vim session, then go back to the Vim session, I get this nice message: W11: Warning: File "~/.vimrc" has changed since editing started See ":help W11" ...
0 votes
1 answer
337 views

How to trigger callback function when input

I'm trying to write a simple plugin that let user input something, and while inputing, the plugin echos the input text in real time. So far the script shows result after Enter pressed: function! Test()...
1 vote
1 answer
375 views

Execute command with special characters from user input

I would like to correctly intepret the <cr> in a command that is created based on user input. For example, this function runs correctly and it will split the line a the location where the cursor ...
0 votes
1 answer
2k views

Can't use python inputs in Vim

I'm new to Vim. I ran the code print("Hello world") name = input("Name: ") print("Hello",name) and then ran it using :w !python and got the result Hello world Name: ...
0 votes
2 answers
322 views

Use the buffers auto completion in an input() dialogue

I am trying to add autocompletion, with suggestions from the currently edited buffer when reading input from the user for a search string: function! Testinput() return input("Enter search string: ...
1 vote
0 answers
19 views

Mapping <C-[> causes input() to not be abortable

The following function, when at the prompt, if one presses <Esc>, then it will print EXIT. function! Testinput() let g:searchString = input("Enter search string: ", 'default', 'syntax') ...
3 votes
2 answers
284 views

What is the proper way to allow the user of a plugin to modify settings?

So I have a plugin that I am writing which should allow the user to set whether they want to enable a feature. I want the feature to be disabled by default, and allow the user to change it by adding ...
1 vote
1 answer
150 views

How to get a function to print something to colon command and let user edit it?

I need to write a function that when executed it opens colon command and paste some stuff on to it and let user edit it before executing the command. for example function! EditRelativePath() :e ...
1 vote
1 answer
99 views

How to cut off user input and continue with script after a certain number of characters are entered?

I'm struggling to write a function that asks the user to input a string, but cuts it off after they've inputted a specific amount of characters (three, for example) and moves on with the rest of the ...
1 vote
1 answer
191 views

Vim bell limited to once per half a second

Since Vim 8, I've noticed that the bell can sound at most once per half a second. This annoys me. I have this solved by recompiling, but am still looking for a way to do it without. I've searched the ...
2 votes
2 answers
4k views

How do you pass user input to a system command?

I'm trying to write an autocmd to make a commit to a git repository. Here is some non-functional code that should illustrate what I'm trying to do: let g: CommMsg = '' augroup misc autocmd! ...
0 votes
1 answer
411 views

Capture the next keypress under 200ms

1) I need to capture the next key press from the keyboard, if there are any in 200 millisecond. Which function should I use to achieve this? 2) Basically I need to re-send the captured key, with some ...
2 votes
1 answer
357 views

User Input in a Recording

So I am pretty new to vim, but I have started using it as my Latex editor to help get more efficient. Anyways I have a recording that I would like to prompt a user for input on that will change how ...
0 votes
2 answers
63 views

Extract JavaScript variable (feature example): how to improve it?

I am a Vim newbie with one week experience and I'm already enjoying it. I've successfully written an (ugly) command+function+mapping with which I can extract some code to a new variable in JavaScript....
7 votes
1 answer
679 views

How to measure words per minute?

Been looking for a method to measure words per minute, with no luck. Is there any way to do this?