About 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…
I use tmux. The benefit of using suspend is not having to move around multiple windows/tabs. I try to keep those to a minimum (usually one or two). With suspend I can stick with the same tmux window for editing and cli within the same context. It's a personal preference over managing multiple windows.
Mastering Bash and Terminal
61–70 of 186 posts
Re: Mastering Bash and Terminal
#62Rather 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…
Re: Mastering Bash and Terminal
#63Rather 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…
God, I really need to learn more of these little tricks. I've been using Vim for a while now, but not taking advantage of so many of it's features.
For that reason I just jump out with a ctrl+z and when I'm done I'm back in with a fg!
Re: Mastering Bash and Terminal
#64Earlier quoted context omitted.
I didn't know about :r in combination with !. That's neat. I typically use :r for reading a file into the current buffer (instead of cp ). Thanks for sharing. I don't find myself using ! commands when I know there are multiple commands that I need to run (like your last example). That's usually when I'll suspend and then use the command line. Could you elaborate on "wreak havoc on your vim session?" I wasn't aware th…
> I didn't know about :r in combination with ! You can even use :w in combination with !. For example :w !xclip to write the vim buffer contents to the clipboard. You could visually highlight part of the buffer and do the same thing for just the text you want.
Re: Mastering Bash and Terminal
#65Rather 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…
Regarding the last git command you listed, I actually find it better to do :r !git status -v And at the to of the result, type my formatted git commit message, visually highlight the message I just typed, and then use the following vim command :r !git commit -F - Which reads the commit message from standard input.
Re: Mastering Bash and Terminal
#66One that I learned from Mr. Robot: put a space before the command to avoid being registered in the history.
Re: Mastering Bash and Terminal
#67Rather 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…
Is there a difference?
Re: Mastering Bash and Terminal
#68While there is much useful in this post, I always find comments like this one odd. bash was released back in 1989, zsh was released one year later, in 1990. One year difference in age almost thirty years ago means that you can't really call zsh a newcomer. Maybe he's talking about adoption, though.
Re: Mastering Bash and Terminal
#69Seriously you can get on fi(r)st page of HN with 5% of man bash?
Re: Mastering Bash and Terminal
#70Rather 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…
Hmm, I always used :.!ls instead of :r!ls... Is there a difference?