by dmortin · 1y ago · 0 comments
Surely, there will still be emacs and vim users 50 years from now, but the user numbers and the community power will diminish as the graybeards gradually leave this plane.
Emacs is fundamentally an interactive shell, like Bash. It has a text editor, also like Bash. It is of course generally more powerful and featureful than Bash.
Hence, people sometimes live in Emacs, because it's a shell like Bash or Gnome or KDE.
I use Emacs and VSCode. VSCode for some code repos, and Emacs for general computer usage.
Meanwhile, Vim is a text editor. It is neither a shell nor an IDE, although it can be adapted somewhat into an IDE.
I also use vi (alongside Emacs and VSCode). vi is for editing some text if I am not in Emacs for some reason or if I temporarily borked my Emacs config.
(I also use ed, for when I'm in a dumb terminal or I don't want to lose screen context.)
Vim or Emacs "dying" is not really an issue, although Vim or Emacs losing enough mindshare to keep them up to date as competitive IDE options, maybe that might happen.
1) Keybindings having no conflicts with other terminal applications. For that, vim's default window-management key of <C-w> is unfortunate, as it is very important for delete words in bash and readline. I remap that to <C-@> (CTRL-Space) instead, which is basically used by no terminal program that I am aware of. The other key binding that trips me up are the default vim keybindings to kill the terminal (<C-w><C-c>). If I am midway attempting a window action, but realise something is taking too long and want to stop the job, the keybinding kills my whole shell. If I really want to kill my terminal, I can always issue ZQ or :q! in normal mode.
2) Change my cursor shapes based on which mode I'm in (normal, insert, or terminal/command), which helps me easily tell the mode.
3) Improve the default keybinding for going from terminal back to terminal normal mode. I find the default keybindings <C-\><C-n> and <C-w>N too difficult to type because I need to use this binding very much.
4) Be able to move between windows with the same, consistent set of keybindings no matter which mode I'm in (e.g. not having to go back to normal mode first, from insert or terminal mode). In the same vein, when I land on a buffer I always expect to be in normal mode, so I can start moving around immediately and yank stuff without remembering whether I'm in a terminal or a non-terminal buffer. When I need to manipulate the terminal program I can always `i` or `a`.
I have quite a few other customisations to my vim terminal, but I think these are the most essential ones.
vimrc for 1)
set termwinkey=<C-@>
noremap <C-@> <C-w>
noremap <C-@><CR> <C-w><CR>
noremap! <C-@> <Esc><C-w>
noremap <C-@>c <Nop>
noremap <C-@><C-c> <Nop>
noremap <C-@><C-q> <Nop>
noremap! <C-@>c <Nop>
noremap! <C-@><C-c> <Nop>
noremap! <C-@><C-q> <Nop>
tnoremap <C-@>c <Nop>
tnoremap <C-@><C-c> <Nop>
tnoremap <C-@><C-q> <Nop>
noremap <C-@>q <Nop>
noremap! <C-@>q <Nop>
tnoremap <C-@>q <Nop>
vimrc for 2) and 3) augroup term_normal
au!
autocmd WinNew * let w:winnew = 1
autocmd CmdlineEnter * let w:outcmd = 0
autocmd CmdlineLeave * let w:outcmd = 1
autocmd WinEnter * if exists ('w:winnew') | unlet w:winnew | if (mode() == 't') | call Termcursor () | endif | elseif get(w:, 'outcmd', 1) && (mode() == 't') | call feedkeys("\<C-@>N", "") | endif
autocmd WinLeave * if (mode() == 't') && (! exists('w:tu')) | call feedkeys("\<C-@>N", 'x') | call Normalcursor () | elseif (mode(1) == 'nt') && (exists('w:tu')) | call feedkeys("i", 'ix') | endif
tmap <expr> <C-@><C-@> ((mode() == 't') && get(w:, 'outcmd', 1)) ? '<C-@>N' : '<C-@><C-@>'
augroup end
let &t_SI = "\e[6 q\e]12;#FF00DF\<C-g>"
let &t_EI = "\e[2 q\e]12;#FF00DF\<C-g>"
let &t_ti = "\e[4 q\e]12;#FF00DF\<C-g>"
let &t_te = "\e[2 q\e]12;#FF00DF\<C-g>"
let &t_Us = "\e[4:2m"
let &t_ds = "\e[4:4m"
let &t_Ds = "\e[58:5:4m\e[4:5m"
function! Normalcursor ()
let &t_ve ="\e[2 q\e]12;#FF00DF\<C-g>"
let &t_vi ="\e[2 q\e]12;#FF00DF\<C-g>"
endfunction
function! Echonormalcursor ()
call echoraw("\e[2 q\e]12;#FF00DF\<C-g>")
endfunction
function! Termcursor ()
let &t_ve ="\e[4 q\e]12;#FF00DF\<C-g>"
let &t_vi ="\e[4 q\e]12;#FF00DF\<C-g>"
endfunction
function! Echotermcursor ()
call echoraw("\e[4 q\e]12;#FF00DF\<C-g>")
endfunction
augroup termcursor
au!
autocmd ModeChanged *:n* let &t_ve ="\e[2 q\e]12;#FF00DF\<C-g>"
autocmd ModeChanged *:n* let &t_vi ="\e[2 q\e]12;#FF00DF\<C-g>"
autocmd ModeChanged i:* if &t_ve == "" | let &t_ve ="\e[2 q\e]12;#FF00DF\<C-g>" | endif
autocmd ModeChanged i:* if &t_vi == "" | let &t_vi ="\e[2 q\e]12;#FF00DF\<C-g>" | endif
autocmd ModeChanged *:i* let &t_ve =""
autocmd ModeChanged *:i* let &t_vi =""
autocmd ModeChanged *:t call echoraw("\e[4 q\e]12;#FF00DF\<C-g>")
autocmd ModeChanged *:t let &t_ve ="\e[4 q\e]12;#FF00DF\<C-g>"
autocmd ModeChanged *:t let &t_vi ="\e[4 q\e]12;#FF00DF\<C-g>"
autocmd ModeChanged t:* call echoraw("\e[2 q\e]12;#FF00DF\<C-g>")
autocmd ModeChanged t:* if (mode(1) != 'ct') | let &t_ve ="\e[2 q\e]12;#FF00DF\<C-g>" | endif
autocmd ModeChanged t:* if (mode(1) != 'ct') | let &t_vi ="\e[2 q\e]12;#FF00DF\<C-g>" | endif
let g:cmdlinedepth = 0
autocmd CmdlineEnter * let g:cmdlinedepth = g:cmdlinedepth + 1 | let &t_ve = "\e[4 q\e]12;#FF00DF\<C-g>" | let &t_vi = "\e[4 q\e]12;#FF00DF\<C-g>"
autocmd CmdlineLeave * let g:cmdlinedepth = g:cmdlinedepth - 1 | if g:cmdlinedepth == 0 | if (mode(1) == 'ct') | call Termcursor () | else | call Normalcursor () | endif | endif
autocmd CmdwinEnter * let &t_ve ="\e[2 q\e]12;#FF00DF\<C-g>" | let &t_vi ="\e[2 q\e]12;#FF00DF\<C-g>"
autocmd CmdwinLeave * let &t_ve = "\e[4 q\e]12;#FF00DF\<C-g>" | let &t_vi = "\e[4 q\e]12;#FF00DF\<C-g>"
" autocmd WinEnter * call echoraw("\e[2 q\e]12;#FF00DF\<C-g>")Also, I don't really miss anything from more advanced ides when in vim. There are great packages for almost anything.
I went from vim to neovim, but the LSPs for python/go(lang) for large files (not that large, maybe 10k loc) seem to really bog it down (back then, no idea if it's better now), whereas with VS Code it was still performant enough. So I ended up using VS Code with Vim bindings.
And yes, with ad hoc work, I still end up using system vim when just doing simple edits (e.g. adding a line to README.md or somesuch)
emacs is surely on a decline, but it’s not obvious that Vim is on the same trend.
This matches “theory” and anecdotal evidence: the people who chose emacs probably didn’t like modal editing, and when “better” IDEs came along they just switched. But there’s nothing like Vim (except editors specifically inspired by Vim), and those haven’t gotten any traction if only because every one of us Vim users have hjkl muscle memory burned into our brains.
https://trends.google.com/trends/explore?date=all&q=%2Fm%2F0...
both decline, but emacs is steeper
I will concede that VS Code is the default for many, but I just can't get productive in it anymore. I mainly use intellij, which has its own issues. But I can't say I've ever mastered any editor, the closest was sublime text, and that mastery mainly came from being able to use cmd+p and global search effectively.
At this point, however, I do not really use Neovim anymore. I switched to Zed, the Vim emulation is pretty good and customizable and most functionality I want is already there along with incoming support for Jupyter Notebooks. VSCode also has these features.
It is fun to use Vim/Neovim but unless I need to use it, I doubt I will return to it.
In the end, it doesn't really matter what other people are using. If Vim (or Emacs) works for you, then you can basically keep using it until the end of time since code are just text files, and these things don't really change all that much (outside of encodings, which is the biggest problem with older editors – but I don't see UTF-8 replaced any time soon, if ever).
I don't really know what the kids these days are up to, but I don't think it really matters. I guess there's still few Bill Joys around using ed, but the existence of vi, Vim, VSCode, or anything else doesn't really take away anything for them.
MANPAGER=nvim --clean -c "colo sorbet" +Man!
Startup speed is blistering.My current config is pretty stable, and not that large. But if it were causing issues, I'd seriously consider only doing LSP setup, which is not that onerous with the latest APIs (it was already fairly easy with `vim.lsp.start`, but `vim.lsp.config` and `vim.lsp.enable` make it easier still: https://neovim.io/doc/user/lsp.html).
A multithreaded version of emacs would also be an interesting addition; I read some arguments against moving emacs to a multithreaded model, but I don't really remember them.
Apart from that, I don’t really know what an application would be to Emacs as nvim is to Vim. It’s more like nvim is to Vim what Emacs is to nano, except Emacs came first.
emacs is 4% vs VSCode 73%, so it's not popular, though vim still is
Visual Studio Code 73.6%
Visual Studio 29.3%
IntelliJ IDEA 26.8%
Notepad++ 23.9%
Vim 21.6%
Android Studio 16.1%
PyCharm 15.1%
Jupyter Notebook/JupyterLab 12.8%
Neovim 12.5%
...
Emacs 4.2%
...
Spacemacs 0.4%
So Vim + Neovim = 34.1%, essentially second to Visual Studio, the overwhelming leader.