Live data from Hacker News

Command line tools for productive programmers

earthly.dev

91–100 of 143 posts

Re: Command line tools for productive programmers

#91
post #58

> However, if the directory has many files or sub-directories, tree becomes much less helpful: you only see the last screen full of information as files scroll past you. tree | less

Recently i’ve taken to using nnn for anything like this: https://github.com/jarun/nnn - i never used cli file managers but now, it’s up there with my shell, vim & tmux as a core productivity tool. Show me files in this dir: $ n Show/hide details for each: . Filter / search file list: / Navigate subdirs (or parents) with vim or arrow keys. Cd into sub dirs by typing unique chars from dir names: ctrl-n Drop back to she…

I very much like nnn because it's lightweight, but does it have autojump integration[0]? It's the only single reason I am still using ranger.

Edit: That and the speed. And since I am more proficient with Python, hacking on Ranger is easier.

0: https://github.com/fdw/ranger-autojump

Re: Command line tools for productive programmers

#92
post #70

Author here. Thanks for sharing! Have you seen gron[1]? It can't do everything that jq can, but it is much more in the unix philosophy than jq. It simply flattens and unflattens json out into lines so you can use standard unix tools on it. ▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" json[0].commit.author = {}; json[0].commit.author.date = "2016-07-02T10:51:21Z"; jso…

I definitely know about gron. I maintain the Chocolatey package[1] for it for all us Windows slobs.

[1] https://community.chocolatey.org/packages/gron

Re: Command line tools for productive programmers

#93
post #8

For his usecase of funky i use ~/.bash_aliases, that way i can easily share them between machines. Eg to quickly add a new one: alias als="nvim $HOME/.bash_aliases && source $HOME/.bash_aliases" Be careful with quoting though, got myself into a situation where every new terminal asked for the root password. Shellcheck found the reason quickly. (edit) Another benefit is that those aliases abstract over differences of…

You can put sudo in an alias!? [mindblown.gif]

Re: Command line tools for productive programmers

#94
post #91

Earlier quoted context omitted.

Recently i’ve taken to using nnn for anything like this: https://github.com/jarun/nnn - i never used cli file managers but now, it’s up there with my shell, vim & tmux as a core productivity tool. Show me files in this dir: $ n Show/hide details for each: . Filter / search file list: / Navigate subdirs (or parents) with vim or arrow keys. Cd into sub dirs by typing unique chars from dir names: ctrl-n Drop back to she…

I very much like nnn because it's lightweight, but does it have autojump integration[0]? It's the only single reason I am still using ranger. Edit: That and the speed. And since I am more proficient with Python, hacking on Ranger is easier. 0: https://github.com/fdw/ranger-autojump

Yeah it comes in the base distribution https://github.com/jarun/nnn/blob/master/plugins/autojump

But - if you're happy with ranger, i'm not sure it's worth the switch - they're very similar. nnn is quite a bit faster than ranger but other than that, i think ranger has more community support.

Re: Command line tools for productive programmers

#95

Earlier quoted context omitted.

This might be a better alternate to preserve functionality of `cd -` function ..() { cd $(printf '../%.0s' $(seq 1 $1)) }

Mmh, what do you mean with "preserve"...? `cd -` works like a charm for me.

"cd -" changes to the previous working directory. Your function calls cd multiple times, so calling "cd -" won't bring the user to the previous working directory they expect. ozym4nd145's function only calls cd once.

Re: Command line tools for productive programmers

#96
post #77

Earlier quoted context omitted.

Recently i’ve taken to using nnn for anything like this: https://github.com/jarun/nnn - i never used cli file managers but now, it’s up there with my shell, vim & tmux as a core productivity tool. Show me files in this dir: $ n Show/hide details for each: . Filter / search file list: / Navigate subdirs (or parents) with vim or arrow keys. Cd into sub dirs by typing unique chars from dir names: ctrl-n Drop back to she…

If you’re already in vim, why not use whatever equivalent to NERDTree is popular? Unless you’re only interested in the structure and names, and not the file contents? It seems like they even have a neovim plugin, you might consider using it.

The integration is pretty decent in vim, i have it configured to open a window overlay on n (requires neovim) https://github.com/craigjperry2/dotfiles/blob/main/dotfiles/...

That said, i don't find myself using that as much. Usually i'm in the shell when i invoke nnn - i might open a file in vim from nnn though.

In vim, i typically lean on fzf.vim more often - usually i know something about the next file i want to open so it just feels more direct.

Re: Command line tools for productive programmers

#97
post #67
post #58

> However, if the directory has many files or sub-directories, tree becomes much less helpful: you only see the last screen full of information as files scroll past you. tree | less

Thanks for reading the article. broot does more than just piping tree to less, it gives you a TUI version of tree that you can navigate along around it. The fuzzy finder in it works like FZF but it keeps everything in a nice compact tree view. It might be overkill but I like it.

There'll always be multiple ways to skin the proverbial cat.

Shameless plug but I'd written my own $SHELL callewd `murex` as I kept running into pain points with Bash as a DevOps engineer. The shell doesn't have `tree` inbuilt but it does have FZF-like navigation built in.

https://github.com/lmorg/murex

I've been using it as my primary shell for a few years now and I'm not going to pretend that it isn't BETA it does work. However it's not POSIX and some of the design decisions might rub people the wrong way (given how opinionated peoples work-flows are). But if you're curious then check it out.

Re: Command line tools for productive programmers

#98
post #90
post #89

Earlier quoted context omitted.

Very cool! I use zoxide as a alias for cd to do this. But it only really works if you have cded using the full path in the past. But usually I have.

In the same vein I use autojump, and combined with ranger using the ranger-autojump plugin I can CD in any folder I have previously visited.

Oh, I've not seen ranger before. Looks pretty useful.

Re: Command line tools for productive programmers

#99
post #70

Author here. Thanks for sharing! Have you seen gron[1]? It can't do everything that jq can, but it is much more in the unix philosophy than jq. It simply flattens and unflattens json out into lines so you can use standard unix tools on it. ▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" json[0].commit.author = {}; json[0].commit.author.date = "2016-07-02T10:51:21Z"; jso…

`gron` is super useful for sed/awk manipulation of json data rather than writing a complicated `jq` script. Both are great, though.

Re: Command line tools for productive programmers

#100
I've historically spent all my days SSH'd into a remote server in a screen/tmux session writing code in vim and doing various admin/db tasks.

Recently I started using vscode with the remote-ssh plugin and it has surprisingly been a pleasant experience. I have an integrated terminal to the remote box and I have full intellisense for coding (I do 80% coding / 20% admin, probably).

It took a gestalt flip for me to realize that with this plugin installed, vscode is basically a very (very) fancy terminal emulator.

Only problems I've encountered so far are if you paste large strings or quickly scroll through your bash history, sometimes characters will drop from the strings. Also, sometimes you have to reload the window because intellisense stops working because it seems like the language server installed on the remote box stops working.

Post reply on HN