* Allow separate styles for cursor in normal and preview panes
This defines new `cursorfmt` and `crusorpreviewfmt` options to style cursor in normal/preview panes. This allows using a different style for the normal and preview cursor. The documentation includes several possible values these options can be set to.
The default behavior is an underline, same as in
https://github.com/gokcehan/lf/pull/1072, since it should not cause severe
problems and be visible on all terminals. It can now be easily changed, as explained in the docs. I also added an example to `etc/lfrc.example`.
See linked issues and PRs for the more context.
Fixes https://github.com/gokcehan/lf/issues/1038
Follows up on:
https://github.com/gokcehan/lf/pull/1072https://github.com/gokcehan/lf/pull/924https://github.com/gokcehan/lf/commit/b47cf6d5a5
* Simplify configuration of several formatting options
This simplifies the configuration of `cursorfmt`, `cursorpreviewfmt`, `tagfmt`,
and `errorfmt` options.
In almost all usecases, the value of these options had to end with `%s\033[0m`
to print the contents of filename/tag/error and reset the terminal style. Now,
if `%s` is not part of the option's value, `%s\033[0m` is appended
automatically. This simplifies configuration.
I retained the same behavior as before when `%s` is part of the string for
backwards compatibility. I think it should be considered deprecated, but it
also causes no harm.
On my system, Shift+Mouse is captured by the terminal and
Alt+Mouse only works for one of the alt keys. Hence I picked
Ctrl.
This also allows binding of Ctrl+MouseButtons (but doesn't set
any such bindings).
As a minor bonus, that should allow using Ctrl+Click to select
`lf`'s terminal without moving the cursor no matter where you
click. On tmux, this doesn't work out of the box and requires
a change to `tmux.conf` along the following lines:
bind-key -T root C-MouseDown1Pane select-pane -t = \; send-keys -M
You can omit the `send-keys -M` if you never want to pass
`Ctrl+Click` to any of your terminal apps. (Then it will work
without this PR).
* When clicking on file preview, only open files on right-click
Currently, when mouse is on, I often click on the preview accidentally
since it's such a large target. Moreover, there is very little space I
can click without having the `lf` state change drastically (since I must
click on the current file for the preview to stay the same).
This commit prevents that.
* (Minor): Change example in docs to work around a bug
Currently, the example fails confusingly for newer versions
of `tput`. See https://github.com/gokcehan/lf/issues/718.
* Add mouse support for selecting and opening files
Left click to select, right click to open, similar to ranger.
Closes#919.
* Add default mouse wheel mappings
* Update tcell to d3cbfcf
Commit d3cbfcf fixes a bug where mouse wheel events were misdelivered as
button events.
* For directories in preview column, dim cursor
When preview is on and consists of a directory listing, make the
cursor in there dimmer to emphasize it's not active. This makes it
visually obvious which cursor is active at all times, without
having to read the path. The active cursor is now always the
rightmost bright one, regardless of whether the `preview` option
is on or off.
See screenshots in the pull request at
https://github.com/gokcehan/lf/pull/924.
Before this, I noticed that I often open a file by accident because
I got confused which of the three cursors on the screen is the active
one.
* No-op changes to ui.go
Reduce number of arguments to printDir and list non-configurable colors
Simplify logic in ui.go. In that diff, `st` would already have the
Reversed flag set; there's no need to set it again.
Also, minor changes to remove all the statickcheck errors VS code's
Go extension complains about.
- Clean up some code duplication.
- When completing files with menu completion while searching, don't
escape the selected match.
- Don't recompute completions while cycling completion menu.
* Get command default count from definition
The command count defined in opts.go will be respected. In order to do that a copy of the callExpr or listExpr command is created so that the defined count is not overridden.
* Copy the command only if we need to overwrite the count
* Directory previews, initial implementation.
* Continue previous; add goroutine for directory previews.
* Enable dirpreviews as an option, run gofmt and fix referencing nil.
* Only use dirpreviews if previewer script exists.
* Remove redundant function call to `dirPreview`.
* Remove unnecessary dev-comments.
* Send to `dirPreviewChan` also on modifying folder contents.
* Fix some multibyte character completion bugs
- matchLongest now operates on runes instead of bytes so we don't
complete part of a multibyte character.
- Fix some places that mixed string and rune slice indices.
* Fix wrong menu completion for subdirectories
When selecting a menu completion for a file in a subdirectory, the
entire filename would be appended to the command line, even if you had
already typed part of it.
* Escape file completions in menu completion
* Minor refactors and typo fixes
* Fix cmd-menu-complete-back bug
The first use of cmd-menu-complete-back after opening the completion
menu was incorrectly selecting the before-last completion instead of the
last completion.
* Allow completing broken symlinks
Also skip files with stat errors instead of returning.
* Add command to accept current menu selection
This is useful when completing filenames. For example
cmap <c-y> :cmd-menu-accept; cmd-menu-complete
can be used to accept the selected directory completion, then complete
files in the directory.
* Complete command names for map and cmap
* initial tags implementation
* add tag to complete.go
* add gTagsPath to os_windows.go
* change behaviour to match other commands
* add tag-toggle to complete.go
* add tag and tag-toggle to docs
* address feedback about tags
This commit moves directory counting with 'dircounts' option from ui
printing to dir reading to be run asynchronously without locking the ui.
On the other side, disadvantage of this approach is that if 'dircounts'
option is changed at runtime, then directory counts may not be available
requiring a manual 'reload'. Indicators for errors are changed to '!'
instead of '?' to distinguish them from missing values.
* Allow to configure time format in the info column
* Update infotimefmt PR from Krzysztof Maicher
Add format length, rename options
Co-authored-by: Krzysztof Maicher <krzysztof.maicher@gmail.com>
* added first version of interactive filter
* small fix when loading new file
* don't reset filter when directory is reloaded automatically
* reapply filter when options for searching change
* current filter or arguments now prefilled in the prompt
* empty filter can now be supplied
* added new setfilter command for use in scripts
* added incfilter option
* added very basic documentation
* added filter indication in statusbar
* added option to display filter to prompt
Integer division causes miscalculation of pane widths. With `set ratios 100:200:300` the first two panes have width 0, the third pane will take up all space (unless you happen to have a huge terminal). I noticed this when fine tuning ratios, e.g. going from `1:2:3` to something like `10:21:30`.
* Use chan struct{} in place of chan bool
* Revert "nav.checkReg now returns a boolean instead of calling nav.preview"
* Guarantee preview/previewClear ordering
* Pass the file path to the cleaner script
* Return early on error in nav.preview
* nav.checkReg now returns a boolean instead of calling nav.preview
* Pass width, height, x, and y parameters to preview script
* Check previewer for exit code
If non-zero the preview will be assumed to have side-effects.
* Add the cleaner option
This is called upon selection changes if the previous preview was
volatile. To this end, volatilePreview was added to the nav struct