I've been delaying a major migration to NeoVim on [modern-terminal-I-can-never-decide-which] for years.
Wezterm, Ghostty, iTerm2. None is exactly perfect, so I just keep watching them develop.
I recently migrated from vim to neovim and you can just migrate everything. I forgot where I found this but put this in ~/.config/nvim/init.vim
" Load vim configs
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
Then in my zshrc (well... I organize differently) I have the function
function _exists() {
command -v "$1" &> /dev/null
}
alias_vim() {
if (_exists nvim)
then
alias vi='nvim'
alias vim='nvim'
elif (_exists vim)
then
alias vi='vim'
fi
}
FWIW, zsh has a commands hash to make stuff like this potentially easier and cleaner. The following isn't quite how I'd do it, but is functionally equivalent.
(( $+commands[vim] )) && alias vi=vim
(( $+commands[nvim] )) && alias vi{,m}=nvim
I wasn't aware of +commands, thanks. Though I'm not sure this is easier and you can translate mine to bash trivially
Yours isn't technically equivalent though it is functionally. If we have both vim and nvim then we'll alias vi twice.
Also, your program provides less clarity. It saves lines but at a large cost to readability. I tend to share my dotfiles with newbies a lot so readability is very meaningful.
I wrap mine up in functions too because at the end of my alias file I can add something like this
It's a bit overkill and I never expect a simple alias like that to fail but there are three distinct advantages I get for being just a tad more verbose:
1) I have more complicated versions to deal with things like fd and batcat which have different names different operating systems (`fd` vs `fd-find` / `bat` vs `batcat`) and some additional configurations.
2) I can disable the alias by commenting out one line
3) knowing exactly where the alias is being loaded and thus what aliases are loaded.
Bonus) fails loudly but continues (it's an alias, I don't want you fail fail)
A few extra keystrokes are worth this advantage imo. Especially since I'm using vim so it's actually not any additional typing lol
It's style, so the choice is up to you and they'll accomplish the same things, but I'm just explaining why I use this design pattern. I've only given a stripped down snippet of code so I hope this context helps explain the larger pictures and how it can be used for larger needs.
(Surely this issue must've been discussed/debated elsewhere ad nauseum because it seems an odd design decision to leave out such a common macos binding...)
But having only used ghostty as-is and getting bamboozled by the copy paste situation, this is game changing. I was just going to wait till preferences had a GUI/TUI.. So thanks!
This comment sounded familiar[0]. :) For what it's worth, still possible with:
[0]: https://news.ycombinator.com/item?id=42889411