Questions tagged [user-input]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer

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 ...
JosefLitos's user avatar
0 votes
1 answer

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("...
Martin Braun's user avatar
0 votes
5 answers

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. ...
Szpilman's user avatar
2 votes
1 answer

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 ...
Luke's user avatar
  • 123
2 votes
0 answers

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 ...
shabam's user avatar
  • 21
4 votes
1 answer

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 ...
Dom's user avatar
  • 3,264
0 votes
1 answer

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" ...
Enlico's user avatar
  • 2,172
0 votes
1 answer

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()...
aj3423's user avatar
  • 199
1 vote
1 answer

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 ...
skamsie's user avatar
  • 235
0 votes
1 answer

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: ...
Andrew6450's user avatar
0 votes
2 answers

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: ...
run_the_race's user avatar
1 vote
0 answers

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') ...
run_the_race's user avatar
3 votes
2 answers

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 ...
Ryan Fredez's user avatar
1 vote
1 answer

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 ...
Bmax's user avatar
  • 113
1 vote
1 answer

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 ...
Mike Hearn's user avatar
1 vote
1 answer

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 ...
fghsgh's user avatar
  • 11
0 votes
1 answer

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 ...
qeatzy's user avatar
  • 940
2 votes
1 answer

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 ...
Ltoll's user avatar
  • 123
0 votes
2 answers

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....
raul.vila's user avatar
  • 113
7 votes
1 answer

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?
Christopher Francisco's user avatar
11 votes
2 answers

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 ...
mike's user avatar
  • 939
2 votes
2 answers

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! ...
StevieD's user avatar
  • 1,417
16 votes
2 answers

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 ...
Konrad Höffner's user avatar
2 votes
2 answers

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 ...
Brian Tiffin's user avatar
5 votes
2 answers

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 ...
nobe4's user avatar
  • 15.9k
22 votes
2 answers

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 ...
Melab's user avatar
  • 321