Or just CTRL+z and then 'fg' to go back.
This is one of the many things I learned from the destroyallsoftware screencasts [0] so many years ago. Before that I used vim in a gui (MacVim). Along with moving to tmux this completely changed how I work.
Re:History and Effective Use of Vim
by TheGrassyKnoll on Friday July 19, 2019 @08:19PM
(#20483457)
That's what I do in Emacs. I always run it from a terminal (currently using Terminator).
This is exactly what I do all the time and works nicely.
Re:History and Effective Use of Vim
by stirfrykitty on Friday July 19, 2019 @04:42PM
(#20482294)
Does that work in all shells?
https://en.wikipedia.org/wiki/Job_control_(Unix)
I haven't used many esoteric environments, but wikipedia says it "exists in most modern Unix shells" and the timeline for first adding it was the late 70s early 80s.
Job control was first implemented in csh, another Bill Joy invention, although I believe that particular feature was added by someone else.
> :sh (go back to shell and do your thing and leave vim running)
In nvi (at least), one can also open a buffer and :script to run a shell inside vi and have all the yank/paste/navigation/all-the-things features of vi. Mind you need to i[nsert] or a[ppend] after the prompt to issue your commands.
Re:History and Effective Use of Vim
by miguelmota on Friday July 19, 2019 @08:06PM
(#20483413)
Been using vim for almost a decade and embarrassed to not have known about how to go back to vim after doing `:sh` , so thanks for sharing that. I use tmux all the time so I tend to switch to a pane running bash and `ctrl-b z` to toggle the pane fullscreen
I wouldn't even use nano for typing notes; I'm so used to vim that I don't see why I wouldn't want its powers, even for something as simple as writing notes. I might very well want to reorder the notes, for instance: that's very easy in vim with dd/p. nano might have some Ctrl-key combo that does the same thing, but why bother learning that when I already know vim?
Re:History and Effective Use of Vim
by passthejoe on Saturday July 20, 2019 @03:58PM
(#20487971)
The worst thing is when you start typing Vim commands in programs that are not Vim.
Back in the day when I was a Unix admin, we often worked in full screen terminals and when editing a config file didn't like having to close the vim instance to go look at something, so learned about this little gem:
:sh (go back to shell and do your thing and leave vim running)
Ctrl-d to return to intact and running vim instance.
As an aside, if you decide to use nano to edit config files, make sure you use nano -w (no wrap), otherwise you may find yourself with a non-bootable OS instance.