Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions on ex- or colon-commands. For questions about command-line options used to launch the editor, use the [invocation] tag.
3
votes
Accepted
What is the `:'<,'>` in the command line?
The substitute command can accept a range prefix. Without it, like:
:s/foo/bar/g
Will just substitute on the current (cursor) line.
:%s/foo/bar/g
Will substitute on the whole file.
:5,10s/foo/bar/g
…
3
votes
Accepted
Delete non-consecutive lines in command mode
I came up with this:
:for i in reverse([1, 3, 4, 7]) | exe i . 'delete' | endfor
This could easily be put into a function that could be called:
function DeleteLines(lines)
let lines = reverse(uni …
2
votes
In command-line mode, how to avoid delete key erasing last character?
Try this:
:cnoremap <expr> <del> strlen(getcmdline()) == getcmdpos() - 1 ? '' : "\<del>"
This binds the delete key on the :-command line to running an expression and executing the keystrokes the expr …
2
votes
How do I make my own function to insert text in vim?
The :insert command cannot take an argument like you're trying to do, it expects user input for the lines, followed by a single line consisting of a . to finish inserting.
You probably want the append …
2
votes
Programatically enter Command line window
You could bind something else to open the command-line window using a noremap:
:nnoremap Q: q:
See :help :noremap.
1
vote
Accepted
Vim8 && in :terminal's [command]
The trick is to provide the ++shell argument to :terminal:
:term ++shell echo A && echo B
This is because :terminal tries to execute the entire command as one command, without letting a shell interpr …