Rather than temporarily suspend vim to use the terminal you can get vim to suspend and resume itself with the exclamation mark command. This has the benefit of not wreaking havoc on your vim session and allowing you to read data into vim by prefixing with r. For example :!ls will execute ls and show you the result (press enter to return) :r!ls will read the result of ls in for you More usefully :r!sed -n5,10p that/ot…
Mastering Bash and Terminal
51–60 of 186 posts
Re: Mastering Bash and Terminal
#52Earlier quoted context omitted.
Why are you saying that Apple will not update bash? Wouldn't that be in the best interest of its users?
It would indeed be in the best interest of its users, but Apple has apparently decided that it would not be in its own best interest: http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/ […] Anyway, the message is pretty obvious: Apple won’t ship anything that’s licensed under GPL v3 on OS X. Now, why is that? There are two big changes in GPL v3. The first is that it explicitly prohibits patent lawsuits against pe…
Re: Mastering Bash and Terminal
#53> 8. alt-w - delete the word behind of the cursor He means “ctrl-w”. But since that only works in bash, not in Emacs or other tools with Emacs key bindings, it makes more sense to use (in his terminology) “alt-backspace”. This does the same thing, and works both in the shell and in Emacs-like environments.
Re: Mastering Bash and Terminal
#54Re: Mastering Bash and Terminal
#55Re: Mastering Bash and Terminal
#56Substring history search, so you can use just a substring to look for a argument,command. Binded to ctr+r/s by default. ;)
https://github.com/liloman/asyncBash#use
Changing directories: Last n directories, transparent popd/pushd.
https://github.com/liloman/dirStack
Movements: vim-surround for your cli, so you can do ysiw" o whatever... ;)
https://github.com/liloman/bash-surround
Control-n right: So just type the start and control+n to search for the arguments/commands starting with whatever. And the classical up/down to look up for a complete history line:
https://github.com/liloman/dotfiles/blob/master/bash/.inputr...
https://github.com/liloman/dotfiles/blob/master/bash/.inputr...
There're a ton of hidden functionality and customization behind the classical bash instalation. :)
Re: Mastering Bash and Terminal
#57LESS=+/"DEFAULT KEY BINDINGS" man readline
assuming it exists on mac.
About suspend, what's the benefit of suspending vim using C-z? Shouldn't you use a terminal multiplexer instead, or even terminal tabs if you don't want to learn how to use tmux or screen (which I find weird if you already spent time to learn how to use vim but alright)?
I only ever suspend a program when I want it to stop, for instance because it slows other programs and I realize I would rather resume it when I'm not in front of my computer. Even in that case, I often just renice the program instead. Stopping a program just because you want to run some bash commands looks like an anti-pattern to me, but maybe there are better motives I'm not aware of.
Re: Mastering Bash and Terminal
#58I'm curious about the popularity of Bash vis a vis, say, Csh. Is Bash more popular due to superior features, or is simply because it is the default on quite a few *nix distros (and macOS)?
These days bash seems to have a lot closer feature parity to zsh, and I'd be curious to read an up-to-date comparison of both shells to determine if either is clearly better than the other.
Re: Mastering Bash and Terminal
#59For me, as far as shells go it's usually enough to know the basics and be able to look stuff up when debugging other people's shell scripts.
Re: Mastering Bash and Terminal
#60About bindings, it would have been better to redirect to: LESS=+/"DEFAULT KEY BINDINGS" man readline assuming it exists on mac. About suspend, what's the benefit of suspending vim using C-z? Shouldn't you use a terminal multiplexer instead, or even terminal tabs if you don't want to learn how to use tmux or screen (which I find weird if you already spent time to learn how to use vim but alright)? I only ever suspend…