5

You can use if exists(':terminal') to check for existence of the terminal command. This works in both vim and neovim.


4

vim 8 now also supports terminal feature. It also supports to edit terminal buffer as text using <c-\><c-n> or <c-w> + N, which is called Terminal-Normal mode in vim 8. vim 8 also supports termdebug, a plugin that can launch gdb with or without builtin terminal support. Just type packadd termdebug and termdebug program_name, then the ...


4

Those are ANSI escape sequences which are commonly used to print colored text in terminal windows. If valid sequences are being inserted into Vim buffers then you'll be happy to know that there's a plugin that will translate to Vim highlighting/colors: AnsiEsc Here's are basic examples of the concepts... Using something close to one of your samples this ...


3

An awkward solution Copy content into a register from an editing window and paste in to the :terminal window with <CTRL-W> " {reg} to run it. Example with one editing buffer and one :terminal buffer running bash: text content in editing window echo hello cmd to copy the content to the 0 register :vipy move to the terminal window <CTRL-W&...


3

Seeing <ESC> used as the LHS of a key mapping causes me some discomfort. You've demonstrated one reason why...it doesn't seem to work right in a vimrc file. It doesn't matter what you have on the RHS, the LHS <ESC> causes some characters (maybe related to the underlying key code for <ESC>) to be emitted as if they were Normal mode commands ...


3

As I find out in this guide: https://howchoo.com/g/nzc1ztu4ztd/custom-key-mappings-vim#triggering-our-custom-key-mapping What I was missing was the Operator-pending Mode, which is the case of the command like d3w. This is how I modified the mappings (I didn't think it would turn out to be this simple): noremap ^[j 1 noremap ^[k 2 noremap ^[l 3 " etc. ...


3

I have the following in my vimrc: command SynID echo synIDattr(synID(line("."), col("."), 1), "name") Move the cursor to the word you are interested in and then execute :SynID. The spell checker can set the background of the word independently. It uses the names "SpellBad", "SpellCap", "SpellLocal" and "SpellRare". Definition can be printed with :...


3

t_ti and t_te are used by Vim (in the terminal) to switch between the different screens. The whole detail of this is described at :h xterm-screens and those are xterm terminal control sequences. The usual effect of this is, that after you quit vim in the terminal, you do not see your old vim screen anymore, but the last commands you issued before starting ...


3

Typically what you want is for backspace to send ^? and not ^H. (I need a citation, but this is typically how modern terminals work.) It looks like MobaXterm has an option to have backspace send ^H, I imagine that option is currently set on your MobaXterm, perhaps start by trying to uncheck that option. Then you should look into why Vim has an impression ...


2

Similar to Kossak's answer but a bit simpler, by mapping literal key presses. Either in normal mode after pressing :, or inserted into your .vimrc, map the input directly by starting the mapping: nnoremap then hitting Ctrl + V then the keystroke to record, e.g. Alt + ←. This will show as something like this: nnoremap ^[[1;3D but each ^[ is a single, ...


2

Proportional fonts are supported in Oni, Neovim GUI. Use the "webgl" renderer for best results. "editor.renderer": "webgl" See also https://github.com/onivim/oni/issues/2359


2

To set your bash terminal title to your short hostname when exiting vim, add this to your .vimrc: execute "set titleold=".hostname() At least on Arch, bash's default is the short hostname, so unless you have something else changing it sometimes, this will emulate restoring it. All credit goes to a google search which found: https://gist.github.com/...


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

Disclaimer: this answer is more vim-centric than it is neovim-centric because I use the one and not the other. However, techniques shown are broadly applicable to both editors, as they share the same features. TL;DR Simply making use of built-in features and some scripting/maps, we can accomplish a lot. Feature Number 1: Terminals in the Editor (Neo)...


2

As said by Christian Brabandt in the question's comment: neovim always has the terminal included, so you can simply use has('nvim') the other test is for Vim specifically.


2

You can move between tabs by type gt to move forward and gT to move backward in the Normal mode. Or you can show the buffers (like the opening files) by type the command :buffers then choose the index number to open any buffer you want by typing another command b4 for example to open the first buffer like in the picture. Take a look at fzf.vim plugin https:...


2

The help for :terminal says: If [command] is not given the 'shell' option is used. On that help page, if you move the cursor inside the word "shell" and press C-] (the control key and the right bracket), it'll take you to the help for the shell setting. Alternatively, you can get there with :help 'shell'. It looks like you should be able to add the ...


2

Based on Chris’s comments on the OP, I would make the shell do the work, using a level of indirection: terminal bash -c "cd wherever && do_something" The issue is that the bare :terminal command doesn’t ever execute a shell—it executes the name of the external program you give it (which, by default, happens to be the shell). So, terminal cd . tries ...


2

Assuming by text line OP means the command line window (e.g., via echom), use :echohl to set the colors and :echom to print strings. Note that echohl uses the available highlight groups; you may want to use execute and highlightto create your own from function arguments if custom highlights are needed. Otherwise, just lean on the provided groups and trust ...


1

Well, you could change the option shell, see :help :terminal and :help 'shell'. But this means, that you also use shell for all :! commands. I don't know if you want that. On the other hand, you could just define a new command: command Bash terminal ++close bash The ++close is needed, so Vim closes the terminal window when you exit bash.


1

So, after the obvious blunder of not using a capital N 🤦‍♂️ ... I was able to get the remap working with the lowercase n (just for terminal) which is what I was hoping to get. This was done by adding the following to my vim startup. tnoremap <C-W>n <C-\><C-n>


1

In researching something else, I stumbled across the answer to this question: set noequalalways


1

&l:filetype is not equal to file extension. For .md files, filetype is markdown, not sure what it will be for .tex (my Vim show plaintext) - so this one you will have to check in Your Vim with :set filetype? So this should look something like this (change filetype for tex): autocmd BufEnter,FileType * \ if index(['calendar', 'tex', 'markdown'], &...


1

This is a documented 'feature' of :tnoremap as tnoremap effectively only work for insert mode style actions and thus any variant using tmap will not work. Adding the below to init.vim will remap the action of Ctrl-w + s in normal mode only for the terminal buffer autocmd BufWinEnter,WinEnter term://* nnoremap <buffer> <C-w>s <C-\><C-n&...


1

That is the default behaviour. The reason is, Vim can only show complete character cells, however if your terminal is slightly bigger that what can be displayed by multiples of character cells, it will show such a frame. There is nothing you can do about it, but you can slightly resize your terminal.


1

Looks like this is just a bug, which was fixed just after the version I'm using, in patch 8.0.1422.


1

I'm going to take a stab in the dark and suggest that your configuration is probably resulting in no highlighting. You can check this with the command :verbose highlight SpellBad: if the xxx at the start of the line is not highlighted, then badly spelled words won't be highlighted, either. If this is the problem, then spelling commands should still work ...


1

According to the vim terminal documentation, there is a special key binding for pasting in a terminal window. From the Vim terminal window support documentation on the Vim git repo. CTRL-W " {reg} paste register {reg} *CTRL-W_quote* Also works with the = register to insert the result of evaluating an expression. Other than using the ...


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.


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