From 405b3d1ecca8a7e688eeb9c2dc1ff5091455c934 Mon Sep 17 00:00:00 2001 From: rabite Date: Sat, 6 Apr 2019 17:26:16 +0200 Subject: fix typos --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 072a69c..20aeae2 100644 --- a/README.md +++ b/README.md @@ -5,17 +5,17 @@ hunter hunter is a fast and lag-free file browser/manager for the terminal. It features a heavily asychronous and multi-threaded design and all disk IO happens off the main thread in a non-blocking fashion, so that hunter will always stay responsive, even under heavy load on a slow spinning rust disk, even with all the previews enabled. -It's heavily inspired by the excellent ranger, but a little more Emacs-flavoured, and written in Rust to make sure it starts up quickly and to take advantage of it's strong guarantees around concurrency. It's so fast I actually built in animations for some parts as a joke, but in fact it turned out to look really nice and makes it look much smoother. YMMV, of course, and this can be disabled. +It's heavily inspired by the excellent ranger, but a little more Emacs-flavoured, and written in Rust to make sure it starts up quickly and to take advantage of its strong guarantees around concurrency. It's so fast I actually built in animations for some parts as a joke, but in fact it turned out to look really nice and makes it look much smoother. YMMV, of course, and this can be disabled. Most things you would expect are implementend, among them tabs, bookmarks (with ranger-import), search/filter, previews of files/directories (including size information in previewed directories), a minibuffer at the bottom with file name completion, multi file selection, etc., etc. There are also a few original ideas, especially around subprocess handling. The process viewer actually shows the output of started subprocesses, their pids and exit codes, notifies on new output and process completion. It's somewhat of a primitive TUI shell. File names are handled using raw OsString, so there is no file it can't handle, no matter what garbage the name contains. It also sets the tmux/terminal title to the current directory on supported terminals. To speed up the loading of direcories metadata in the preview/backview is only loaded for files you can see, except in the main view. Still, metadata is also loaded asynchronously, so you can sometimes see it updating file listings while browsing through your files. I think this is better than waiting though :). -Technically hunter is not a file "manager" itself. It has no built in primitives for file manipulation like delete, rename, move, and so on. Instead it relies on it's easy and extensive integration with the standard cli tools to do it's job. For that purpose there are various file name/path substitution patterns and an auto-completing for executables you want to run. +Technically hunter is not a file "manager" itself. It has no built in primitives for file manipulation like delete, rename, move, and so on. Instead it relies on its easy and extensive integration with the standard cli tools to do its job. For that purpose there are various file name/path substitution patterns and an auto-completing for executables you want to run. This is a young project and probably (definitely) has some bugs and edge cases. It hasn't been tested on a lot of terminals, but at least alacritty, kitty and urxvt work fine. It should work on most Unix-flavoured systems supported by Rust, but was only tested on GNU/Linux. I haven't lost any files so far, at least. -A big thanks to ranger and its developers. Without its inspiration this wouldn't have been possible. hunter not a drop-in replacement and doesn't cover every use-care, especially if you're into advanced customization, since hunter has basically none unless you modify the code, but if you just need fast above all else it's might be a good coice. +A big thanks to ranger and its developers. Without its inspiration this wouldn't have been possible. hunter not a drop-in replacement and doesn't cover every use-care, especially if you're into advanced customization, since hunter has basically none unless you modify the code, but if you just need fast above all else it might be a good coice. ## Features: * Lag-free architecture, always responsive -- cgit v1.2.3 From 6d879a6cee2a3831eb292063d32854b1d080c1af Mon Sep 17 00:00:00 2001 From: rabite Date: Sat, 6 Apr 2019 17:31:43 +0200 Subject: add hunter_cd.sh --- README.md | 2 ++ extra/hunter_cd.sh | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 extra/hunter_cd.sh diff --git a/README.md b/README.md index 20aeae2..bb6ae94 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ hunter reads $XDG_CONFIG_HOME/hunter/config at startup. There are two options, w animation=on show_hidden=off +## Drop into hunter cwd on quit +To change the directory of your shell when quitting hunter with Q you need to source extra/hunter_cd.sh, which is a wrapper that runs hunter and checks for ~/.hunter_cwd after hunter exits and cd's into the contained directory if it exists. Keybindings: diff --git a/extra/hunter_cd.sh b/extra/hunter_cd.sh new file mode 100644 index 0000000..6d73be1 --- /dev/null +++ b/extra/hunter_cd.sh @@ -0,0 +1,6 @@ +function hunter() { + env hunter + test -e ~/.hunter_cwd && + source ~/.hunter_cwd && + rm ~/.hunter_cwd && cd $HUNTER_CWD +} -- cgit v1.2.3 From 9d6d2ac83ffca98d4a8cbd0bb9ad15534a0e806d Mon Sep 17 00:00:00 2001 From: rabite Date: Sat, 6 Apr 2019 18:02:41 +0200 Subject: explain substitution patterns --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index bb6ae94..bc96b8c 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,13 @@ show_hidden=off ## Drop into hunter cwd on quit To change the directory of your shell when quitting hunter with Q you need to source extra/hunter_cd.sh, which is a wrapper that runs hunter and checks for ~/.hunter_cwd after hunter exits and cd's into the contained directory if it exists. +## Filename Substitution +| Pattern | Substituted with | +|-----------|:------------------------| +| $s | selected file(s) | +| $n | tab directory | +| $ns | selected files in tab | + Keybindings: ============ -- cgit v1.2.3 From 62474ff6bcbd78745a66a753cb5d3578ba52bc05 Mon Sep 17 00:00:00 2001 From: rabite Date: Sun, 7 Apr 2019 13:43:41 +0200 Subject: fix crash when running commands in unloaded directory --- src/file_browser.rs | 24 +++++++++++++++--------- src/proclist.rs | 6 ++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/file_browser.rs b/src/file_browser.rs index b9646aa..779c47a 100644 --- a/src/file_browser.rs +++ b/src/file_browser.rs @@ -148,9 +148,7 @@ impl Tabbable for TabView { .widgets .iter() .map(|w| { - w.selected_files() - .map_err(|_| Vec::::new()) - .unwrap() + w.selected_files().unwrap_or(vec![]) }).collect(); self.widgets[self.active].exec_cmd(tab_dirs, selected_files) @@ -838,21 +836,29 @@ impl FileBrowser { tab_files: Vec>) -> HResult<()> { let cwd = self.cwd()?.clone(); - let selected_file = self.selected_file()?; - let selected_files = self.selected_files()?; + let selected_file = self.selected_file().ok(); + let selected_files = self.selected_files().ok(); let cmd = self.minibuffer("exec")?.trim_start().to_string() + " "; - let cwd_files = if selected_files.len() == 0 { - vec![selected_file] - } else { selected_files }; + let cwd_files = selected_files.map(|selected_files| { + if selected_files.len() == 0 { + if selected_file.is_some() { + vec![selected_file.unwrap()] + } else { + selected_files + } + } else { + selected_files + } + }); let cmd = crate::proclist::Cmd { cmd: OsString::from(cmd), short_cmd: None, args: None, cwd: cwd, - cwd_files: Some(cwd_files), + cwd_files: cwd_files, tab_files: Some(tab_files), tab_paths: Some(tab_dirs) }; diff --git a/src/proclist.rs b/src/proclist.rs index d712c33..b8e0524 100644 --- a/src/proclist.rs +++ b/src/proclist.rs @@ -51,6 +51,8 @@ impl Cmd { } fn substitute_cwd_files(&mut self, cmd: Vec) -> Vec { + if self.cwd_files.is_none() { return cmd; } + let cwd_pat = OsString::from("$s"); let cwd_files = self.cwd_files .take() @@ -66,6 +68,8 @@ impl Cmd { } fn substitute_tab_files(&mut self, cmd: Vec) -> Vec { + if self.tab_files.is_none() { return cmd; } + let tab_files = self.tab_files.take().unwrap(); tab_files.into_iter() @@ -84,6 +88,8 @@ impl Cmd { } fn substitute_tab_paths(&mut self, cmd: Vec) -> Vec { + if self.tab_paths.is_none() { return cmd; } + let tab_paths = self.tab_paths.take().unwrap(); tab_paths.into_iter() -- cgit v1.2.3