6

From vim/src/eval.c: static void eval_job_process_exit_cb(Process *proc, int status, void *d) { [..] if (data->term && !data->exited) { data->exited = true; char msg[sizeof("\r\n[Process exited ]") + NUMBUFLEN]; snprintf(msg, sizeof msg, "\r\n[Process exited %d]", proc->status); terminal_close(data->...


6

The still somewhat new internal terminal implementation of Vim 8 uses the StatusLineTerm highlighting group for the active window and the StatusLineTermNC highlighting group for the statusline of an inactive window. So you might want to tweak the corresponding highlighting groups like this: :hi StatusLineTerm ctermbg=red ctermfg=black guibg=#ff0000 guifg=...


5

In your ~/.vimrc add the line set splitbelow This will cause all splits to happen below (including term)


4

You can change the name of any buffer by using the :file {name} command. However, doing so changes that alternate-file to the previous name, which you may not want in this case. The :keepalt command avoids that issue. Putting it all together, this should do what you want keepalt file meaningful


4

You can replace the current window with a terminal using :terminal ++curwin :ter ++curwin " shorter form You can create a mapping or command for convenience nnoremap \t :terminal ++curwin<cr> command! Terminal terminal ++curwin


4

You could overwrite the mapping by a buffer-local mapping. Just map <ESC> to <ESC>: tnoremap <buffer> <ESC> <ESC>


4

You need to use :tnoremap to map keys in the :terminal window. So if you want that to work in both normal mode of a regular buffer and of terminal windows, you need to add another set of mappings for the terminal: tnoremap <C-J> <C-W><C-J> tnoremap <C-K> <C-W><C-K> tnoremap <C-L> <C-W><C-L> tnoremap <...


3

Neovim uses its own internal terminal emulator for :term. You can not change that (as far as I know). The thing you can change is the command interpreter/shell that runs in that terminal. See Wikipedia for the difference: Terminal vs Shell. You can start any command (that you have installed) in the terminal if you just specify it as the argument: :...


3

This should work too: augroup termIgnore autocmd! autocmd TerminalOpen * set nobuflisted augroup END


3

This is my solution for closing terminal windows automatically when the terminal process completes with 0 exit status. Using Martin Tournoij's answer as a starting point I did some investigating on how to get the terminal process exit code in a TermClose event handler. You can examine buffer content to parse the [Process exited ?] line that is appended to ...


3

Use :belowright: :belowright terminal Or, more succinctly: :bel term This command is a modifier and affects the command run right after it. (Another useful modifier here is :vertical, to split vertically instead.)


2

This seems to be related to a known bug involving not listing the terminal buffer at times. This prevents the problem set hidden. It is currently (March 2016) planned to fix this in the upcoming 0.2 release.


2

This is obviously an opiniated question. Here's my opinion. Advantages of neovim (or Vim) terminal: Normal mode gives the power of Vim inside a terminal window Can use vimscript to customize mappings and commands Advantages of tmux: Allows persistent sessions IMHO this is the most important aspect of tmux, because: It allows to detach a session, then ...


2

I have made a small plugin vpager. That allows to dump the terminal output back into Vim. The last commit in addition allows to use the output and dump it into the quickfix list. So you can simply do :make |vpager -Q and it should be loaded back in Vim. (It might need adjustments for the errorformat setting, not sure). excerpt from the README: git diff | ...


2

I guess caddbuffer is currently the best way to achieve what I want.


2

I ran into a similar (the same?) issue on two different installs: NVIM v0.2.0 NVIM v0.3.1 As quanta already mentions this change in behavior might be due to the changes introduced in NVIM v0.2.1. I have a shortcut for running things from within nvim, that splits the window, launches the terminal emulator in the new split view and executes there. After ...


2

This should do the job: function! BnSkipTerm() let start_buffer = bufnr('%') bn while &buftype ==# 'terminal' && bufnr('%') != start_buffer bn endwhile endfunction nnoremap <leader>bn :call BnSkipTerm()<CR> It just keeps invoking :bn until it's not in a terminal window, by checking the 'buftype' setting.


2

Thanks to Christian Brabandt, :ter ++curwin was the thing that I want.


2

If you want to paste something into the terminal window, you can use the command CtrlWReg (if you are in terminal job mode). For your macro, that would be something along: qqY<C-W>w<C-W>"0<C-W>wq (provided that the cursor is at the start of the line in the other window. The error message Cannot make changes, 'modifiable' is off happens ...


2

I would solve this in bash: 1) Move all setting that you need in login shells and non-login shells to the file .bashrc 2) Add the following to the end of your .bash_profile: # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi You could drop the if..., as the file always exists. Background: The file .bashrc is source ...


2

The problem is that you can't really use :normal in terminal mode, since that mode is special, it doesn't really behave like Normal/Insert mode in a normal vim buffer. Instead, you can use the term_sendkeys() function to send the buffer to the terminal. This should work: :execute "normal yaw\<c-w>j" | call term_sendkeys('', @0) Or: :execute "...


2

A little experiment: Go to your fresh opened terminal, and do an echo: echo 1 Leave it in terminal job mode, go back to your original window, execute: exec "norm! \<c-w>pggyy\<c-w>pp" You should see a new line in your current buffer, it's copied from first line of terminal buffer. As ggyy are normal mode commands, it tells us that when you ...


2

I'm assuming that by "terminal buffers" you mean the :terminal command. In theory you can just use the ++cols=1000 option or :set termsize (8.0)/set termwinsize (8.1) commands to set a wider terminal width, at the expense of having to scroll to read the whole line. In practice, this new feature seems rather buggy. There are other options, however. Copying ...


2

Thanks to @Matt I now know that if I close the terminal buffer myself instead of having the 'term_finish':'close' argument of term_start() do it, then it doesn't do the weird behavior of sometimes opening a different file. So I've 'term_finish':'close' that with an exit_cb that closes the buffer. Here's what I use in full: function! JW_on_term_exit(a, b) ...


1

To open a terminal for running command with height 20 you can do :new +resize20 term://command If the terminal is ready created, you either use :resize 20 or 20<c-w>_ for height. :vertical resize 20 or 20<c-w>| for width.


1

There are several options: (1) The simple way is to drag the bar separating the two split windows using the mouse. As far as I know this works by default, but I've only been using neovim, not standard vim so you may need to enable the mouse first. (2) In normal mode, type 10<C-W>+ to increase the size of the current split by 10 lines. Or make a ...


1

When you have several split you can equalize their size with ctrlw+= or with the equivalent command :wincmd =. So you could use that manually. I you want to use the command each time Vim's window is resized you can use an autocommand like this: autocmd VimResized * wincmd = Which means when the VimResized event is received, no matter what buffer you are ...


1

From version 0.2.1, :terminal now starts in normal mode instead of terminal mode: https://github.com/neovim/neovim/wiki/Following-HEAD#20170821 Btw, don't know why this does not enter Terminal mode automatically: autocmd BufEnter term://* startinsert autocmd BufLeave term://* stopinsert I have to use: autocmd TermOpen * startinsert


1

I don't think you need to worry about mixed line endings. Unless forced by the 'fileformats' setting, Vim opens files containing these as unix, and lines ending CRLF will just have a CR visible in the buffer. The mixed endings will therefore be preserved when you write out the file with LF endings. (And if 'fileformats' doesn't contain unix, then LF endings ...


1

With tmux (terminal multiplexer) you can do select/copy/paste of terminal screen contents using Vim commands. When you're in a tmux session run your command(s) outputting to terminal (stdout). Then hit "prefix" + [ to get in "copy mode". From there you can navigate with Vim commands like Ctrl-U, optionally select some text using Visual mode and yank with ...


Only top voted, non community-wiki answers of a minimum length are eligible