Questions tagged [terminal-buffer]

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

146 questions
8
votes
1 answer

make :terminal use the current pane

Currently when I use :terminal to quickly open a terminal in vim, it opens in a new pane. Is it possible to change this behaviour so that it replaces the current one? I realise this would be undesirable for most, but I would rather open the new pane…
hiqwertyhi
  • 83
  • 4
6
votes
1 answer

Is there a way to start vim in terminal mode?

I often find myself Opening a terminal Running vim Starting a :terminal Is there a way to say vim --start-terminal and have Vim automatically run :terminal ++curwin as soon as it starts?
425nesp
  • 576
  • 5
  • 16
4
votes
1 answer

How to find the buffer number of a :terminal?

I can see that I've got a terminal buffer open by running :ls R which finds all buffers with a running terminal job, but I don't know how to capture just the buffer number. The closest I can get is echo bufnr("cmd.exe") because the buffer name has…
TankorSmash
  • 837
  • 1
  • 6
  • 14
3
votes
1 answer

How to stop terminal from closing on

According to vim help, https://vimhelp.org/terminal.txt.html#t_CTRL-W_CTRL-C will forcibly end the terminal job. I've been unable to disable this; I've attempted many variations of the following: :tnoremap Unfortunately,…
user22476690
  • 143
  • 7
3
votes
1 answer

Execute command in terminal mode at terminal startup

I'm trying to execute simple commands in the vim terminal mode, but cannot get it to work. For example, I tried nmap :let $VIM_DIR=expand('%:p:h'):terminalcd $VIM_DIR to open a terminal in the directory of the current file, but…
Bananach
  • 494
  • 5
  • 15
2
votes
2 answers

Execute reverse search in terminal mode at startup

I have tried to use the following :nnoremap t :terminal :call term_sendkeys('', "\c-r>") To open a terminal with reverse search waiting for some input, but instead, it writes: ^R $ ▉ I expected something like…
2
votes
1 answer

Reopen a terminal window running an active job

How do I reopen a terminal window with an active job if I hide the terminal window? This is similar to the following question: Close vim 8.1+ terminal buffer without unloading. In this case, however, the terminal is still active. More detailed…
1
vote
1 answer

Query an environment variable in a terminal buffer

I have a vimscript which needs to query a environment variable which gets set on terminal buffers. How can I do this? I tried looking through the help to see what term / job commands could be used to query but didn't see anything. e.g. for buffer in…
ColinKennedy
  • 411
  • 2
  • 9
1
vote
1 answer

How to start a terminal, so that on exit will call a function?

I recorded info of terminal buffers in a dict, and want remove bufnr of closed ones. Can you tell me how to start a terminal such that call a function on exit, eg, func! myterm#remove(bufnr): call remove(s:terms, a:bufnr) endfunc
qeatzy
  • 960
  • 9
  • 18
1
vote
0 answers

send to ipython in :term

When I am developing some python script, I regularly find myself running part of the code to see if it does what I want it to do. Currently I do this by copying the code that I want to run to the clipboard, alt-tabbing to the console and then…
Octaviour
  • 962
  • 6
  • 18
1
vote
0 answers

vim 8.1 send_termkeys problem

I noticed that, if I use call term_sendkeys(buf, "make\n") and then I try to execute something else in the terminal windows (i.e. ls), vim append the last string sent from command mode to the actual string just inserted in the terminal…
xyx
  • 464
  • 3
  • 11
0
votes
1 answer

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 command in my shell's history is something like…
0
votes
1 answer

switchin back another viewport from the terminal buffer

I created :term, then I switch to another viewport, but latter when I switch back to the term buffer "!/bin/bash" it is full screen and I don't understand how can I access the vim command line again since everything I type is handled by the terminal…