I'm Never Using Neovim's Terminal The Same Again

preview_player
Показать описание
After delaying it over and over - this my entire Neovim setup from scratch. Lua files, plugin structure, what I use daily and how I configure everything.

Ways to support this channel:

LINKS

⏱ Timestamps
00:00 - Intro
00:38 - The Neovim Terminal Emulator
02:51 - Floaterm
03:45 - Multiplexers
06:34 - Process suspension
06:34 - Tmux FloaX

#neovim #vim #nvim #tmux #terminal #config #dev #devops #software #development #devops #ops
Рекомендации по теме
Комментарии
Автор

For the ctrl-z / fg people: I've often run into the habit of opening another vim job despite there being already one running in my shell. What I found to be the most helpful here is to put a little marker in your prompt which indicates whether there are jobs in your shell or not.

AxWarhawk
Автор

I know I am probably going to get called a psychopath, but I actually like to run tmux in neovim, basically with ':term tmux attach -t and then if you reload the session created with :mksession then neovim will automatically re-run the attach command, and it all kind of just works out. Then I can fully take advantage of vim's wonderful buffer/window/tab system for most terminal tasks without sacrificing the persistence.

iEnjoyApplesauceVeryMuch
Автор

One thing I like about working with the built in terminal: when compiling a programm or checking for errors with valgrind, those programs print out the filename, line and column where the error happend. With a simple press of `gf` it takes me to this exact spot in the file where the error happend.
I also have keybinding to quickly open and hide the terminal split while keeping the terminal session open.
But I also get the idea why using tmux could be useful but I couldn't really find usecases for my typical workflow.

eispalast
Автор

For the years I was an emacs user, I was "everything in the editor", but for the years I've been using neovim, I'm very much "everything in the terminal". So I run wezterm, with some great project switching where I get a new workspace for any given git root.

Then, within a workspace, and I have shortcuts to launch yazi, xplr, lazygit, or neovim. My EDITOR is a script that will run nvim normally if not in a git context, but if I am it will start a server storing the socket at the git root. Then any file I open any where in that workspace opens in my nvim instance for the workspace. That allows me to have many many terminals running at the same time as my project editor.

theherk
Автор

I find floating pane just get in the way and you end up having to close them and you lose ur history u were referencing anyway.
My preferred solution is to run tmux w nvim, then have a keymap to open a pane at 1/3 width, then have a kepmap to switch back and maximise the nvim pane. Obviously w alt+vim based movements between panes and mod + shift + vim movement between windows.
You’ll thank me later x

maguilecutty
Автор

I learned more about neovim's terminal from this video. I have to stay with tmux for my terminal tasks. It provides more consistency and it is more manageable.

For me I don't like the idea of trying to do everything in neovim especially terminal tasks

EmileNani
Автор

That's great. Somehow I didn't know you could map things for the terminal specifically. I had ctrl-\ ctrl-n as a macro for the keyboard.

slipcurve
Автор

i stick with one session per project, and i use floating terminal in nvim - in the occasion where i need multiple terminals i stick with another tmux window. But if i can help it i remain within neovim

GOTHICforLIFE
Автор

using bang in ex mode or Ctrl-z is more intuitive than running emulator terminal or tmux

i like how emacs handles the process, it's very simple and intuitive, I started using some approach by creating some functions.

why, the terminal in vim is not intuitive, because, the screen of the laptop is too small, we should see one buffer at a time, so the convenient way to switch between buffers is to write the name of the buffer in ex mode (maybe nvim-cmp completion is useful in ex mode than insert mode) like: `:b foo.txt` or `:bn`

ayoubelmhamdi
Автор

Using xterm or ssh, I have my bash environment. I start vim (not neovim), and I can edit.
I type :ter and have a terminal pane with yet another bash. I can even launch another vim.
No configuration, add-ons or scripting needed. I've been doing this for 20 years. Cheers!

dipi
Автор

i think you missed the real functionality it gives you
think of it (instead of different ways to do the same thing) as another layer
meaning i use regolith that is based on i3 for windows management
when i wanna focus on the terminal i zoom in
than use tmux to work on multiple terminals
but when i focus on coding or or something on nvim i focus again
then if i just need something very specific from the terminal (like i do on splitting windows ) i create another terminal inside nvim
this way i don't loose my focus
and i can do this one small thing
without zooming out (and focusing out) on all of the other terminals

crazydor
Автор

Hi Omer, is there any tool in Neovim for fully remote pair programming? I've found plugins for LAN work, but none for 100% remote collaboration.

rob.bustamante
Автор

thx, I'd like to buy you a coffee

joergw
Автор

I use tmux for projects, but I use neovim for most of my terminal-ing, because it's nice to have that ncreased integration to be able to jump to files, use more vim motions and plugins, etc.

In embedded development I frequently need to have many different sub-projects open for any given project, so within my tmux session I'll have different windows with their own neovim session in the sub-project's folder.

For quick shell stuff within a sub-project I just ctrl-z/fg from neovim, but most of my terminal work is done within neovim. I occasionally open a new window in tmux for certain tasks, but it's rare these days.

I avoided the embedded terminal for many years because I thought it best to use tmux, but I'm glad I gave it a shot when migrating to neovim. One big thing that I like about it is that it gets a more consistent look for the rendering vs tmux and neovim (WSL has lots of weirdness, and term colors are a dark art in the best of cases).

neniugrava
Автор

I need to mention Zellij as alternative for tmux. Really good software with a strong momentum.

Автор

The default keys (listed in the man page) for tmux do have plenty of commands to manage sessions. For example, ( and ) to jump to next/prev session. And $ to rename current session. L to go back to prev session. Also "s" to select a session using a chooser. It is only missing a new-session key, which I mapped to N. And although I did use sessionx for a while, eventually I don't really found a compelling need for it.

kesor
Автор

trying to use nvim in powershell is somewhat painful

sub-harmonik
Автор

there's a telescope plugin for Tmux I use to manage sessions, it works nicer in my vim brain than that C-b commands, great video as always

sahilmishra
Автор

I like the header of our terminal, which theme of power10k using ??

kamalkamals
Автор

Shit youre good man!! You know and love this stuff. My sugestion is to go even deeper sometimes. I mean, the ctrl+Z/fg people. Would be nice if you asked some people that actually use this, yk. So we can enrich the video even more.

Also i, again, really liked how you see this type of workflow, terminal workflow. I wanted to talk to you about it, just to share thoughts. Where can i reach you?

samuelabreu