Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [terminal-buffer]

A terminal emulator within vim, eg created by :terminal or term_start()

Filter by
Sorted by
Tagged with
0 votes
0 answers
22 views

Is there an equivalent of system() for capturing commands outputs or programs running in terminal buffers?

I am aware that system() capture the output of shell commands. I am wondering if there is a similar command for capturing the output of commands sent to other type of interpreters running in terminal ...
Barzi2001's user avatar
  • 606
0 votes
1 answer
19 views

How to unlist a terminal buffer opened in a popup window?

I want to unlist a terminal buffer that I open in a popup window. Here are my attempts: var buf_no = term_start(&shell, {'term_name': 'foo', 'hidden': 1, 'term_finish': 'close'}) setbufvar(bufname(...
Barzi2001's user avatar
  • 606
1 vote
1 answer
26 views

Ctrl+w Shift+n after :term does not start a normal window

In Vim, you can start the terminal by :term, and Ctrl+WShift+N allows you to treat the terminal window as a normal Vim window. I tried the same in NeoVim, but it does not work. Is it an expected ...
T_T's user avatar
  • 189
1 vote
0 answers
32 views

Is there an equivalent to tmux clear-history in vimterminal?

In tmux there is a command which clears any additional history that may have shown up in the buffer. Does vim have a similar function for clearing out a vim terminal?
leeand00's user avatar
  • 3,601
0 votes
2 answers
25 views

How to split terminal and start in the other buffer?

I currently have the following abbreviation: cnoreabbrev tright vert rightb terminal zsh With this, :tright in normal mode will open a terminal buffer on the right side of the screen, which is great. ...
Patrick O'Brien's user avatar
1 vote
2 answers
70 views

Press CTRL+W in a vimterminal programatically from vimscript?

Say my cursor is in a Vim terminal. Normally I press Ctrl w Ctrl w to flip to from the Vim terminal to my buffer. How do I do that with vimscript? I tried the whole CTRL+SHIFT+V thing when writing the ...
leeand00's user avatar
  • 3,601
2 votes
1 answer
71 views

What is set_opfunc?

I'm configuring toggleterm.nvim, and in particular I'm putting this keybinding in my config file, as suggested by the plugin author here: -- Send motion to terminal vim.keymap.set("n", "...
robertspierre's user avatar
0 votes
0 answers
33 views

Where is my terminal?

I installed iron.nvim. I open two Python files with nvim m1.py m2.py. When I send over some lines to the REPL and then close the first buffer with :bd, I'm left with the terminal window. I go to the ...
robertspierre's user avatar
2 votes
1 answer
113 views

What are the differences between built-in terminals in Neovim and Vim?

AFAIK the main difference is that Vim has this :terminal feature as optional. Could you mention another other important differences?
sebelk's user avatar
  • 325
1 vote
1 answer
47 views

Errors in `term_sendkeys()`

:h terminal-to-job shows the following example of term_sendkeys() call term_sendkeys(buf, "ls *.java\<CR>") Following this, I added the line to .vimrc: nnoremap <Leader>test :...
T_T's user avatar
  • 189
0 votes
0 answers
159 views

How to automatically close a terminal popup window if a python script run in it didn't return any error?

I am wondering if there is a way to automatically close a popup window running a terminal if the execution of the last program didn't report any error and to keep it open if the execution of the last ...
Barzi2001's user avatar
  • 606
2 votes
5 answers
137 views

Mapping with termwinkey that accepts a v:count

In Vim, typically, prefixing a command repeats the action multiple times. This is not the case for gt, which goes to the next tabpage. Whereas gt goes to the next tabpage, 2gt always goes to the ...
user22476690's user avatar
0 votes
0 answers
20 views

Terminal buffer is being treated as editor buffer

I am using vim-terminal plugin. When I create a split terminal using the command :TerminalSplit bash, I can input commands into the terminal, but when I press enter, it moves to the next line without ...
Mahmudul's user avatar
0 votes
1 answer
111 views

How to close a terminal popup through some keystroke(s)?

I want to use a terminal in a popup but I am struggling to close it through some keystroke(s). Classic keybindings like <c-w>q or <c-w>c don't work in popups and <c-c> won't close ...
Barzi2001's user avatar
  • 606
2 votes
2 answers
303 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". ...
Bog's user avatar
  • 479
3 votes
1 answer
74 views

How to stop terminal from closing on <C-c>

According to vim help, https://vimhelp.org/terminal.txt.html#t_CTRL-W_CTRL-C <C-w><C-c> will forcibly end the terminal job. I've been unable to disable this; I've attempted many variations ...
user22476690's user avatar
0 votes
3 answers
375 views

Switch focus to :terminal buffer

I am trying to recreate the functionality of the very old conque plugin via terminal in modern vim. So far I have found a few plugins that send code to a terminal buffer. However, these do not update ...
shabbychef's user avatar
2 votes
2 answers
160 views

Execute reverse search in terminal mode at startup

I have tried to use the following :nnoremap <leader>t :terminal<cr> <c-w>:call term_sendkeys('', "\<lt>c-r>")<cr> To open a terminal with reverse search ...
Brayan Martínez Santana's user avatar
0 votes
2 answers
347 views

How to close Terminal and NERDTree windows if they are the last windows?

If I close all buffers, I'm left with the terminal window, which automatically opens whenever I open Vim. I would like it close automatically when I exit Vim. I see that on the NERDTree repo, they ...
Jimmy Zeng's user avatar
0 votes
1 answer
89 views

Get the last line of Vim terminal output

I use Vim for editing DocBook files. I created several functions that manipulate the text in the buffer. For example to build a PDF from the source using an external command. I run these functions ...
Tomáš Bažant's user avatar
1 vote
1 answer
138 views

How can I create a keybinding that pastes in the terminal in bracketed paste mode, but only if the shell supports it?

Xterm has a feature where if you put in .Xresources XTerm.vt100.translations: #override \ Shift Ctrl<Key>V: insert-selection(CLIPBOARD) then ctrl+shift+V will paste from clipboard. I notice ...
user202729's user avatar
0 votes
1 answer
260 views

Go to file with gf from :terminal

I often keep a :terminal open on the right of a vertical split, and on the left keep a window open for files: ------------------------------ | | | | file buffers | :terminal ...
apostl3pol's user avatar
1 vote
0 answers
49 views

term_sendkeys({buf},{keys}) move cursor to the next line if {keys} is empty

I am running gvim 9.0 on Windows 10. I am developing Python code. I am using Miniconda and I run gvim from a Miniconda CMD shell. For this reason I prepared a .bat file for starting gvim with the ...
Barzi2001's user avatar
  • 606
0 votes
0 answers
33 views

From terminal to normal mode and run a command

I have the following mapping tnoremap <F8> <c-w>N :Vista!!<CR> but the command after <c-w>N (in my case :Vista!!) is not executed. How should I fix it?
Barzi2001's user avatar
  • 606
0 votes
1 answer
237 views

Nvim function to compile file in terminal

function! RunCppFile(filename, filedir) let compile = "g++ " . a:filename . " -o " . a:filedir . "/a.exe" :terminal <i> endfunction nnoremap <C-L&...
Sai Nallani's user avatar
0 votes
1 answer
113 views

How to automatically change a buffer terminal name?

I have a small .bat file to open Vim along with a terminal running an IPython console: @echo off call C:\Users\myname\Miniconda3\condabin\activate.bat C:\Users\myname\Miniconda3\envs\myenv gvim -c &...
Barzi2001's user avatar
  • 606
0 votes
1 answer
58 views

MacVim: <Delete> key does not work in a terminal window

I happened to find that we may open 'Terminal windows' in Vim and am happy to stop using terminal app. (It's available in v8 and v9) However, when I have a typing mistake, pressing Delete key does not ...
Charles Jie's user avatar
1 vote
0 answers
25 views

Is it possible to suppress the output of term_sendkeys()

Sometimes there are lots of lines to be sent from the editor to the terminal and therefore thethe latter scroll a lot as soon as it execute the received commands. That may not be too nice to see ...
Barzi2001's user avatar
  • 606
0 votes
1 answer
121 views

How do I disable easymotion in terminal mode?

I'm using easymotion with all buffers and it works well but changing to terminal mode raises the issue. Thus I want to disable it in terminal mode for convenient. How can I do it? Thanks for your ...
Pham Hung's user avatar
  • 153
3 votes
2 answers
2k views

Leave terminal normal mode

Once I'm in 'terminal normal mode' (where VIM has control on the terminal display), i can't come back to simple 'terminal mode' (where i can write BASH or launch process). How to leave the "...
floupinette's user avatar
3 votes
1 answer
1k views

Open file in new buffer within original vim instance from a terminal buffer [duplicate]

The terminal emulator is handy! However, using it to open a file you wish to edit (while remaining in vim) is troublesome because simply doing vim myfile.txt will spawn a 'vim within vim inception' ...
Derrick's user avatar
  • 131
2 votes
2 answers
56 views

Save all lines of a terminal buffer into a list after its job finishes

I need to save all lines of a terminal buffer into a list after its job finishes asynchronously. I,m opening the terminal buffer like this: let term_buf_no = term_start(cmd, {'term_name': name, '...
Tomáš Bažant's user avatar
0 votes
1 answer
118 views

Re-use or close vim terminal buffer on next command run

I'm opening a terminal buffer for my XML validation with the following command: let term_buff_no = term_start(validate_cmd, {'term_rows': 10}) However, when running the same command again, a new ...
Tomáš Bažant's user avatar
2 votes
1 answer
192 views

How to keep focus in the "normal" editing buffer while a terminal buffer is opened and running a command?

I am editing a DocBook XML file and want to validate it by running a custom command validate_cmd. In my plugin, I'm running the following: let term_buff_no = term_start(validate_cmd, {'term_rows': 10})...
Tomáš Bažant's user avatar
0 votes
1 answer
2k views

How do you set the cursor style in Vim terminal windows?

Vim has the :terminal command, which opens a window with a terminal session inside. According to the documentation (:help terminal-cursor-style), By default the cursor in the terminal window uses a ...
nullromo's user avatar
  • 255
2 votes
1 answer
2k views

How do you send vim to the background from a terminal window?

I just learned that Vim has the :terminal command, which opens a window with a terminal session inside. Previously, my normal workflow was to launch vim from my terminal and use job control to get in ...
nullromo's user avatar
  • 255
0 votes
2 answers
93 views

How to get nnoremap <buffer> to work in different buffers?

I have a hotkey that runs python of the first buffer when I press F8 and outputs the outputs to the bottom. However, this hotkey does not work when I switch buffers... it only works when I am on the ...
yh dev's user avatar
  • 35
1 vote
0 answers
66 views

How to visually select entire broken line in NeoVim terminal

(I'm using NeoVim, vsplit term://zsh) If I have a long terminal line that gets broken, and go into visual mode in order to copy something, selecting the entire line does not work as I expect: |$ ...
jeffrey.d.m's user avatar
1 vote
1 answer
235 views

How can I execute a non named file on terminal with Neovim?

Some time ago, I've made this question where I asked how to execute a file on the terminal with Neovim... The solution I found was the following :terminal bash % . Knowing that, I made the following ...
raylight's user avatar
  • 535
2 votes
1 answer
1k views

How to configure options in :terminal (NeoVim)

I've read the help section for term, terminal, termopen, buftype, and I've read several stack questions, but I haven't been able to find a solution for settings options in terminal mode. I know about ...
jeffrey.d.m's user avatar
0 votes
1 answer
124 views

Prevent vim from being launched in vim

When I'm using the terminal feature on nvim sometimes I run the last command again out of habit (thinking that I'll re-run the unittests for what I'm coding at the moment or something), but the latest ...
Lazerbeak12345's user avatar
1 vote
1 answer
150 views

How to change the directory highlight in the terminal buffer?

I have a theme which is great apart from some minor things. I could already change the LineNr highlight and some others, but can't seem to change the directory highlight in the terminal buffer, which ...
neolith's user avatar
  • 133
0 votes
1 answer
105 views

Unable to resume backgrounded Neovim-terminal-emulator-process using `kill -CONT`

So, I'm trying to find an actual solution to another question on here that doesn't really have one. However, I'm running into a problem with backgrounding/foregrounding behaviour. I need to background ...
ELLIOTTCABLE's user avatar
1 vote
1 answer
71 views

Run :terminal so it starts in terminal-normal mode?

I want to run an async command and when it completes open a terminal window. Since the opening is delayed, I don't want it to steal input from me, so the new window should be in Terminal-Normal mode. ...
idbrii's user avatar
  • 661
1 vote
1 answer
109 views

`termwinsize` cannot be accessed from Python 3

The option termwinsize cannot be accessed from Python 3. Input python3 << EOD import vim for window in vim.windows: if (window.buffer.options['buftype'] == b'terminal'): window....
ynn's user avatar
  • 289
2 votes
1 answer
1k views

Why don’t these mappings to enter Terminal-normal mode work?

I have remapped "enter terminal normal-mode" to <Esc> with: tnoremap <Esc> <C-\><C-n> and it works. I also use zsh vi-mode, which requires <Esc> to enter normal ...
flbk's user avatar
  • 21
0 votes
1 answer
277 views

How can I append to a terminal buffer in vimscript?

I am trying to implement a vimscript function which appends to a terminal buffer. It works when I write this as a single mapping which uses the normal mode 'a' command to append: nnoremap <Leader&...
TamaMcGlinn's user avatar
0 votes
1 answer
148 views

The remap doesn't resize terminal window

nnoremap <leader>rt :term<cr> <C-\><C-n> :resize 10<cr> i I've tested the remap manually, it works as expected. A terminal window spawns I go into terminal normal mode, ...
YJH16120's user avatar
  • 135
2 votes
1 answer
122 views

How do you exit a terminal buffer unless in a pager

In a terminal buffer, I want to auto-exit when I press "kk". Except for when I'm in some interactive session, like a pager (like the pager which is created when you git diff). To do that, I ...
ColinKennedy's user avatar
-1 votes
1 answer
353 views

Split Navigation in vim terminal [duplicate]

I use vim splits quite a bit. To switch faster, I use this shortcut instead of doing ctrl + w + h/j/k/l/ " Quicker window movement nnoremap <C-j> <C-w>j nnoremap <C-k> <C-w&...
Kavin's user avatar
  • 1