一什么网
百度 程子四条中以上引三条为更重要。
Questions about calling external (shell) commands from within Vi or Vim.
238 questions
0
votes
1
answer
47
views
Consume buffer by another program and return to editor
I'm looking to integrate Neovim with less pager functionality. When piping buffer contents to less, I want the terminal to be completely taken over by less until I quit, at which point control should ...
1
vote
3
answers
347
views
How to pass the current line number to a shell command as an argument?
I need to get information about the last person who edited the file, so I use git blame to achieve this. All I need is to run git blame -L X,Y and have it pasted in the Vim window.
If I attempt one of ...
0
votes
2
answers
57
views
How to define a function using external ! command?
I want to use this command
sed 's/\(^[^#]*\)\(#.*$\)/\2\n\1/;s/ *$//'
in a Vim function.
In my .vimrc I've tried this:
function! myfunc1() range
execute a:firstline . ',' a:lastline . '!sed s/\(^[^#...
1
vote
3
answers
78
views
Cannot get a tex file to compile via a background job: No such file or directory
Background
I use vim to edit tex files and use a Dockerized LaTeX environment to compile a tex file into a pdf.
To compile the file, I have been using following function:
" function to compile ...
3
votes
1
answer
65
views
How can I get full bash completion in external (:!) commands?
If I start typing an external command such as :!gi and then press Tab, vim will autocomplete the command name ("git"). But if I enter :!git comm and press Tab, I get no completions - vim ...
0
votes
1
answer
85
views
Stream LLM tokens as are generated into Vim like via CLI mods or shell-gpt
Command line tools like mods or shell-gpt allow processing text with LLMs.
They can be used in Vim e.g.:
:3,12!mods -rqf 'Format as markdown bullet point list'
or:
:12,21!sgpt --code 'Implement TODOs ...
0
votes
1
answer
98
views
Printing (file) information at the bottom line
I'd like to print some file information on vim's bottom line upon pressing a keyboard shortcut, sort of like Ctrl+G but with different info (modification timestamp).
How can I output there?
My current ...
1
vote
0
answers
121
views
How to paste an item selected by external FZF in the cursor position?
I know I can paste output of external shell command with :read! ls.
But :read! ls|fzf doesn't work for me.
Is there a way for me to go from vim to shell, use fzf to select an item, then go back to vim ...
2
votes
2
answers
1k
views
See Last Commands Output from the Terminal Buffer
Lets say I run the external very_long_taking_command like this:
:!very_long_taking_command
and I get the output in this Vim Terminal where it says "Press ENTER or type command to continue".
...
0
votes
1
answer
42
views
Convert sequence of external commands to a Vim custom command
To reformat Markdown tables, I use the following sequence of external commands (e.g. after visually selecting my table lines):
:<,>! sed 's/[[:space:]]\{1,\}\|/\#\|/g'
:<,>! column -t -s '\...
0
votes
1
answer
199
views
Pipe visual region to external command, not whole line
I have a keybinding nmap <leader>c :w ! wc<CR>, I wanted to expand it to work with visual regions (not just the whole file). I did so by creating vmap <leader>c :w ! wc<CR>, ...
0
votes
1
answer
277
views
NeoVim - Interact with the thing that pop ups when you type in a command
Questions
How can I type something in there?
What even is the name of this thing?
Problem
If you type in for example
:!echo 'Hello World'
This kinda terminal thing pops up
I want to interact with ...
0
votes
0
answers
48
views
Why does Vim search for the word under the cursor when pressing "i" after running an external command?
I stumbled on a behaviour which I don't understand. I'm using Bash and Vim 8.2.2434 in Debian 11.
To reproduce it, I created two new files in an empty directory:
foo.py
class Foo:
def __init__(...
0
votes
3
answers
157
views
Can you pass specific text within a line to an external command? [duplicate]
Background
Vim uses ranges to specify which lines should be passed to a command. For example, :5,10 will use lines 5-10, :'a,'b will use the lines between mark a and mark b, and :'<,'> will use ...
0
votes
1
answer
81
views
read from ls command, create an array to move files
I recently discovered a great way to get a list of all files in a directory, I would like to create an array off of that list to then move the files to a new destination.
Currently :read !ls * modify ...