Live data from Hacker News

Mastering Bash and Terminal

blockloop.io

71–80 of 186 posts

Re: Mastering Bash and Terminal

#72

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…

> :!make

IMO, :make is (usually) better, because it adds errors to the quickfix list, and put your cursor on the first error location.

Re: Mastering Bash and Terminal

#73
post #26

Earlier quoted context omitted.

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.

That's interesting, why not just do `git commit` at the command line?

It's more of a way to be able to commit without having to exit or suspend vim. I typically type the commit message while checking the diff. If I find an error in the diff, I'll switch to the vim window with the file, correct the issue and run :!git add %, delete the original output of the git status -v command I ran earlier and I re-run that command (which I can pull up by using q: to bring up the vim command history window).

Re: Mastering Bash and Terminal

#74

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…

You can also use :sh which just starts a new subshell in the terminal and puts you back in vim when you exit it.

Didn't know that! That's great.

Re: Mastering Bash and Terminal

#75
post #72

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…

> :!make IMO, :make is (usually) better, because it adds errors to the quickfix list, and put your cursor on the first error location.

In all honesty, I've never actually done :!make (or :make) as I nearly always have it wrapped behind my own build scripts

Re: Mastering Bash and Terminal

#76
post #68

I also assume you're using bash. I know there are some cool newcomers out there like zsh and fish While 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.

I've had a similar thing recently. Somebody asked me about learning "old technologies", like Perl and CFEngine. Perl 5.x was published in 1991, four years after initial version, Python was published in the same year, and Ruby merely 4 years later. CFEngine 3.x, a complete rewrite that carries over very little and only very high level ideas from earlier versions, was released in 2008, three years after Puppet, and only one year before Chef.

Some people just lack the perspective.

Re: Mastering Bash and Terminal

#77
post #56

I actually resolved most of that common issues with just bash: :) Substring 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://githu…

That is amazing, thanks for sharing.

I'm gonna steal some ideas from asyncBash

Re: Mastering Bash and Terminal

#78
post #26

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…

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.

Vim users are breaking out to the shell to use git?

Try emacs with magit. It's really great.

Re: Mastering Bash and Terminal

#79

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…

Interesting. Your use of `git commit -am` resounded with me. I can't stand doing `git add .` ; `git commit -m "message"`; `git push`. I aliased "commit" to "ci" in git-config, and then do `git ci -am "message" && git push`. I'm sure at some point I will add a hook to have the push done automatically (though sometimes I prefer to do it manually, so I will have to make a decision.)

I am an avid emacs user though. I really should check out vim.

Re: Mastering Bash and Terminal

#80
post #52
post #40

Earlier quoted context omitted.

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…

Or, it could just switch the default shell to Z shell. First thing I do on a new Mac, is chsh -> zsh. Ships with an up to date (enough) version of that.

zsh was even the default shell for an OS X release, 10.3 or 4 can't remember at this point.
Post reply on HN