diff options
author | Canop <cano.petrole@gmail.com> | 2020-07-16 12:23:54 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-07-16 12:23:54 +0200 |
commit | 6706798f6745b1cad17fc5078e9b734ce2fdd809 (patch) | |
tree | 2c71bdd3e6489277d6fb3463d7744f99d732a2d6 | |
parent | 96e8c2ac19e709abdadf54085a4b958a1c886800 (diff) |
some documentation of the preview panel feature
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | README.md | 43 | ||||
-rw-r--r-- | img/20191112-cd.png | bin | 33456 -> 0 bytes | |||
-rw-r--r-- | img/20191112-edit.png | bin | 34479 -> 0 bytes | |||
-rw-r--r-- | img/20191112-mv.png | bin | 33828 -> 0 bytes | |||
-rw-r--r-- | img/20191112-mycnf.png | bin | 33101 -> 0 bytes | |||
-rw-r--r-- | img/20191112-overview.png | bin | 30791 -> 0 bytes | |||
-rw-r--r-- | img/20191112-sizes.png | bin | 43670 -> 0 bytes | |||
-rw-r--r-- | img/20191214-replace-ls.png | bin | 57064 -> 0 bytes | |||
-rw-r--r-- | img/20200203-git.png | bin | 37222 -> 0 bytes | |||
-rw-r--r-- | src/syntactic/syntactic_view.rs | 5 | ||||
-rw-r--r-- | src/tree/tree_options.rs | 2 | ||||
-rw-r--r-- | website/docs/img/201200716-binary.png | bin | 0 -> 151829 bytes | |||
-rw-r--r-- | website/docs/img/201200716-preview.png | bin | 0 -> 68456 bytes | |||
-rw-r--r-- | website/docs/index.md | 14 | ||||
-rw-r--r-- | website/docs/panels.md | 19 |
16 files changed, 63 insertions, 24 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 5193936..a9b745c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### next version +#### Major feature: the preview panel +Hit ctrl-right when a file is selected and you get the preview. + <a name="v0.18.6"></a> ### v0.18.6 - 2020-07-10 - `[ext-colors]` section in config @@ -33,9 +33,11 @@ Table of Contents * [Check git statuses](#check-git-statuses) * [Further Reading](#further-reading) -### Get an overview of a directory, even a big one +# Get an overview of a directory, even a big one -![overview](website/docs/img/20191112-overview.png) +`br -s` + +![overview](website/docs/img/20200629-overview.png) Notice the *unlisted*? @@ -43,23 +45,36 @@ That's what makes it usable where the old `tree` command would produce pages of `.gitignore` files are properly dealt with to put unwanted files out of your way (you can ignore them though, see [documentation](../navigation/#toggles)). -### Find a directory then `cd` to it +# Preview files + +Hit <kbd>ctrl</kbd><kbd>→</kbd> when a file is selected and the preview panel appears. + +![preview](website/docs/img/201200716-preview.png) + +The preview panel stays synchronized with the selection in tree panels. + +# Find a directory then `cd` to it + +type a few letters ![cd](website/docs/img/20191112-cd.png) +Hit <kbd>alt</kbd><kbd>enter</kbd> and you're done. + This way, you can navigate to a directory with the minimum amount of keystrokes, even if you don't exactly remember where it is. -broot is fast and never blocks, even when you make it search a big slow disk (any keystroke interrupts the current search to start the next one). +broot is fast and doesn't block (any keystroke interrupts the current search to start the next one). Most useful keys for this: * the letters of what you're looking for * <kbd>enter</kbd> to select a directory (staying in broot) * <kbd>esc</kbd> to get back to the previous state or clear your search +* <kbd class=b>↓</kbd> and <kbd class=b>↑</kbd> may be used to move the selection * <kbd>alt</kbd><kbd>enter</kbd> to get back to the shell having `cd` to the selected directory * `:q` if you just want to quit (you can use <kbd>ctrl</kbd><kbd>q</kbd> if you prefer) -### Never lose track of file hierarchy while you search +# Never lose track of file hierarchy while you search ![size](website/docs/img/20191112-mycnf.png) @@ -79,7 +94,7 @@ Once the file you want is selected you can * hit <kbd>alt</kbd><kbd>enter</kbd> to open it in your system's default program and close broot * type a verb. For example `:e` opens the file in your preferred editor (which may be a terminal one) -### Manipulate your files +# Manipulate your files ![mv](website/docs/img/20191112-mv.png) @@ -89,9 +104,9 @@ You can instead do it without losing the view of the file hierarchy. Move, copy, rm, mkdir, are built in and you can add your own shortcuts. -### Do it with panels +# Do it with panels -Do <kbd>ctrl</kbd><kbd>→</kbd> and you open another panel (you may open other ones, or navigate between them, with <kbd>ctrl</kbd><kbd>←</kbd> and <kbd>ctrl</kbd><kbd>→</kbd>). +When a directory is selected, do <kbd>ctrl</kbd><kbd>→</kbd> and you open another panel (you may open other ones, or navigate between them, with <kbd>ctrl</kbd><kbd>←</kbd> and <kbd>ctrl</kbd><kbd>→</kbd>). ![custom colors tree](website/docs/img/20200525-colored-panels.png) @@ -103,7 +118,7 @@ Using two panels, you can for example copy or move elements between them: If you like you may do it Norton Commander style by binding `:copy_to_panel` to <kbd>F5</kbd> and `:move_to_panel` to <kbd>F6</kbd>. -### Apply a standard or personal shortcut to a file +# Apply a standard or personal shortcut to a file ![size](website/docs/img/20191112-edit.png) @@ -113,7 +128,7 @@ You can add verbs or configure the existing ones; see [documentation](../conf_fi And you can add shorcuts, for example a <kbd>ctrl</kbd> sequence or a function key -### Replace `ls` (and its clones): +# Replace `ls` (and its clones): If you want to display *sizes*, *dates* and *permissions*, do `br -sdp` which gets you this: @@ -121,11 +136,11 @@ If you want to display *sizes*, *dates* and *permissions*, do `br -sdp` which ge You may also toggle options with a few keystrokes while inside broot. For example hitting a space, a `d` then enter shows you the dates. Or a space, then `h` then enter and you see hidden files. -### Sort, see what takes space: +# Sort, see what takes space: -You may sort by launching broot with `--sort-by-size` or `--sort-by-date`. Or you may, inside broot, just type a space, then `sd`, and <kbd>enter</kbd> and you toggled the `:sort_by_date` mode. +You may sort by launching broot with `--sort-by-size` or `--sort-by-date`. Or you may, inside broot, type a space, then `sd`, and <kbd>enter</kbd> and you toggled the `:sort_by_date` mode. -When sorting, the whole content of directories is taken into account. So if you want to find on monday morning the most recently modified files, just launch `br --sort-by-date ~`. +When sorting, the whole content of directories is taken into account. So if you want to find on monday morning the most recently modified files, launch `br --sort-by-date ~`. If you start broot with the `--whale-spotting` option (or its shorcut `-w`), you get a mode tailored to "whale spotting" navigation, making it easy to determine what files or folders take space. @@ -135,7 +150,7 @@ And you keep all broot tools, like filtering or the ability to delete or open fi Sizes, dates, files counts, are computed in the background, you don't have to wait for them when you navigate. -### check git statuses: +# check git statuses: ![size](website/docs/img/20200203-git.png) diff --git a/img/20191112-cd.png b/img/20191112-cd.png Binary files differdeleted file mode 100644 index 485a288..0000000 --- a/img/20191112-cd.png +++ /dev/null diff --git a/img/20191112-edit.png b/img/20191112-edit.png Binary files differdeleted file mode 100644 index 7c51150..0000000 --- a/img/20191112-edit.png +++ /dev/null diff --git a/img/20191112-mv.png b/img/20191112-mv.png Binary files differdeleted file mode 100644 index e0061c3..0000000 --- a/img/20191112-mv.png +++ /dev/null diff --git a/img/20191112-mycnf.png b/img/20191112-mycnf.png Binary files differdeleted file mode 100644 index 55e005d..0000000 --- a/img/20191112-mycnf.png +++ /dev/null diff --git a/img/20191112-overview.png b/img/20191112-overview.png Binary files differdeleted file mode 100644 index b02017b..0000000 --- a/img/20191112-overview.png +++ /dev/null diff --git a/img/20191112-sizes.png b/img/20191112-sizes.png Binary files differdeleted file mode 100644 index 4a3d4d1..0000000 --- a/img/20191112-sizes.png +++ /dev/null diff --git a/img/20191214-replace-ls.png b/img/20191214-replace-ls.png Binary files differdeleted file mode 100644 index 842bb23..0000000 --- a/img/20191214-replace-ls.png +++ /dev/null diff --git a/img/20200203-git.png b/img/20200203-git.png Binary files differdeleted file mode 100644 index c8ebff3..0000000 --- a/img/20200203-git.png +++ /dev/null diff --git a/src/syntactic/syntactic_view.rs b/src/syntactic/syntactic_view.rs index 313957b..65018f4 100644 --- a/src/syntactic/syntactic_view.rs +++ b/src/syntactic/syntactic_view.rs @@ -1,4 +1,3 @@ - use { super::Syntaxer, crate::{ @@ -50,7 +49,6 @@ pub struct SyntacticLine { pub contents: Vec<SyntacticRegion>, } - pub struct SyntacticView { path: PathBuf, lines: Vec<SyntacticLine>, @@ -62,8 +60,7 @@ pub struct SyntacticView { impl SyntacticView { /// try to load and parse the content or part of it. /// Check the correct encoding of the whole file - /// even when `full` is false - /// Return false if preparation failed. + /// even when `full` is false. fn prepare(&mut self, full: bool) -> io::Result<()> { lazy_static! { static ref SYNTAXER: Syntaxer = Syntaxer::new(); diff --git a/src/tree/tree_options.rs b/src/tree/tree_options.rs index f5eb19d..3316f1e 100644 --- a/src/tree/tree_options.rs +++ b/src/tree/tree_options.rs @@ -140,7 +140,7 @@ impl Default for TreeOptions { show_dates: false, show_sizes: false, show_git_file_info: false, - trim_root: true, + trim_root: false, show_permissions: false, respect_git_ignore: true, filter_by_git_status: false, diff --git a/website/docs/img/201200716-binary.png b/website/docs/img/201200716-binary.png Binary files differnew file mode 100644 index 0000000..a0e4670 --- /dev/null +++ b/website/docs/img/201200716-binary.png diff --git a/website/docs/img/201200716-preview.png b/website/docs/img/201200716-preview.png Binary files differnew file mode 100644 index 0000000..0ec8860 --- /dev/null +++ b/website/docs/img/201200716-preview.png diff --git a/website/docs/index.md b/website/docs/index.md index bcd4410..3f863eb 100644 --- a/website/docs/index.md +++ b/website/docs/index.md @@ -18,13 +18,21 @@ That's what makes it usable where the old `tree` command would produce pages of `.gitignore` files are properly dealt with to put unwanted files out of your way (you can ignore them though, see [documentation](../navigation/#toggles)). +# Preview files + +Hit <kbd>ctrl</kbd><kbd>→</kbd> when a file is selected and the preview panel appears. + +![preview](img/201200716-preview.png) + +The preview panel stays synchronized with the selection in tree panels. + # Find a directory then `cd` to it type a few letters ![cd](img/20191112-cd.png) -Hit <kbd>alt</kbd><kbd>enter</kbd> and you're done. +Hit <kbd>alt</kbd><kbd>enter</kbd> and you're back to the terminal in the desired location. This way, you can navigate to a directory with the minimum amount of keystrokes, even if you don't exactly remember where it is. @@ -69,9 +77,9 @@ You can instead do it without losing the view of the file hierarchy. Move, copy, rm, mkdir, are built in and you can add your own shortcuts. -# Do it with panels +# Manage files with panels -Do <kbd>ctrl</kbd><kbd>→</kbd> and you open another panel (you may open other ones, or navigate between them, with <kbd>ctrl</kbd><kbd>←</kbd> and <kbd>ctrl</kbd><kbd>→</kbd>). +When a directory is selected, do <kbd>ctrl</kbd><kbd>→</kbd> and you open another panel (you may open other ones, or navigate between them, with <kbd>ctrl</kbd><kbd>←</kbd> and <kbd>ctrl</kbd><kbd>→</kbd>). ![custom colors tree](img/20200525-colored-panels.png) diff --git a/website/docs/panels.md b/website/docs/panels.md index 689e86c..01fb3d1 100644 --- a/website/docs/panels.md +++ b/website/docs/panels.md @@ -4,15 +4,30 @@ To focus a panel when several are displayed, you may click on the desired one, or use the `:panel_left` and `:panel_right` verbs which are, in standard, bound to <kbd>ctrl</kbd><kbd>←</kbd> and <kbd>ctrl</kbd><kbd>→</kbd>. -When there's no panel in that direction, a new one is created and its root is the selected line. This makes those shorcuts the easiest way to create a panel. +When there's no panel in that direction, a new one is created: + +* if the current selection is a regular file and you've hit <kbd>ctrl</kbd><kbd>→</kbd>, you get the preview panel +* in other cases you get a new tree whose root is the selected line. + +This makes those shorcuts the easiest way to create a panel. Another way is to add a bang (`!`) to a verb. It tells broot to show the result in a new panel. For example, while `:focus ~` navigates to your home directory in the current panel, you can use `:!focus ~` or `:focus! ~` to open a new panel on your home. - The `:close_panel` closes the current panel and is bound to <kbd>ctrl</kbd><kbd>W</kbd> (remember: you can [change all bindings](../conf_file/#verbs-shortcuts-and-keys)). +# The preview panel + +![preview](img/201200716-preview.png) + +It's not immediately focused on creation, because most often you'll want to preview a few files and it's conveninient to stay in the tree to navigate. +To focus it, for example to scroll it, do <kbd>ctrl</kbd><kbd>→</kbd> again. + +Files that can't be interpreted as text are shown as binary: + +![binary](img/201200716-binary.png) + # Copy, move between panels... or more When exactly two panels are displayed, `{other-panel-file}` `{other-panel-directory}`, and `{other-panel-parent}` are available for verbs. |