Commit Graph

204 Commits

Author SHA1 Message Date
Gokcehan
7dfdcb51c0 unset shellopts when empty 2021-02-21 19:21:06 +03:00
Nikita
6422bd7492
Fix symlink handling (#581)
* Fix replace dialog for symlinks

If the oldPath is a symlink to the newPath or vice versa, than os.Stat()
would resolve this symlink, and both the oldStat and newStat would be
the same. Hence, the replace dialog would not appear and the newPath
file would be overwritten by the oldPath file whilst the oldPath would
be deleted.

It is the same story when the oldPath and newPath are both symlinks to
the same file.

* Fix completion in the case of broken symlinks

If the current directory contains broken symlinks then matchFile() would
return at first broken symlink.

Let's consider the following example:

$ ls -F ~/
broken@ dir/ file

The broken@ is a symlink to ~/foo - non existent file.

If one would enter the following command in lf:

:cd ~/<tab>

it would not suggest possible completion options because matchFile()
would return as soon as it meet the broken symlink.

* Don't resolve symlinks when move files/dirs (#571)

This will allow to move broken symlinks.

* Fix symlinks copying/moving (#571)

Copy symlinks, do not try to resolve it and copy the file pointed by
this symlink. Also this allows to copy symlink to directory.
2021-02-12 20:50:48 +03:00
Gokcehan
13d19d84f9 add 'mouse' option to enable/disable mouse events
cc #268 #570
2021-01-29 19:36:27 +03:00
neeshy
1163efb7aa
Avoid redundantly loading previews for search/find (#569)
* Avoid redundantly loading previews for find

* Avoid redundantly loading previews for search
2021-01-29 18:27:27 +03:00
Gokcehan
e0317611ef avoid loading redundant previews for top/bottom
cc #531
2021-01-19 01:47:09 +03:00
Gokcehan
7481040c2d enable top/bottom in cmap mappings 2021-01-19 01:45:42 +03:00
Gokcehan
f54acae958 avoid loading redundant previews for up/down
cc #531
2021-01-18 21:30:52 +03:00
neeshy
b5f6f6edee
Don't redraw volatile previews on ticker period (#546) 2021-01-04 17:01:29 +03:00
neeshy
1e94f4533e
Guarantee preview/previewClear ordering (#537)
* 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
2020-12-27 04:23:03 +03:00
neeshy
82f03102a5
Add ability to use image previewers (#531)
* 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
2020-12-24 16:13:20 +03:00
Gokcehan
fd688c675b remove deprecated color256 option 2020-12-19 16:59:09 +03:00
Gokcehan
d46ccfc805 resort directories if ignorecase/ignoredia change
Related #320
2020-11-06 20:10:54 +03:00
Gokcehan
279b0cf250 fix logging when setting 'info' option to empty 2020-10-27 03:07:38 +03:00
Jonathan Neidel
e1cabfbf56
Fix typo (#487)
depreciated -> deprecated
2020-10-17 22:56:22 +03:00
2pac
17ed724e67
Completition menu cycling #72 (#482)
* utility modulus function

* ui adapt for tab menu cycle

* refactor(listMatches) for tab menu cycle

* refactor(draw) handle tab menu selection highlight

* refactor(eval) cmd-complete cycle + reset handles

* feat: added backtab counter-cycle in the completition menu

* cleanup

* docs changes

* refactor: make tab cycle own commands

* docs: tab cycle documentation

* bug: the matches list was not complete because index +2 after row end

* refactor(tab cycle): handle the complete menu command print

* refactor(tab cycle): make the cmdTmp varibale mymic cmdAccLeft + check for partial commands

* refactor(tab cycle): fix how to handle the menu completiton from different events

* fix(tab cycle): fix cmd-complete so that it works with new tab cycle commands

* style: changed puprle to reverse

* cleaned up cycle logic + reverted listMatches

* cleaned up eval logic for cycle feat.

* cleanup

Co-authored-by: 2pac <tarasyarema@pm.me>
2020-10-14 19:42:44 +03:00
Gokcehan
3c8b5a5630 avoid overwriting messages after shell commands
Related #441
2020-09-05 17:41:17 +03:00
Gokcehan
b608682580 load modified previews after shell-pipe commands 2020-09-05 14:09:52 +03:00
Gokcehan
b40ebdcb33 fix regular keys in push commands
Related #445
2020-09-04 21:25:19 +03:00
Provessor
24f01f4988
Replace termbox-go with tcell (#439)
Fix colour construction issue

This also has a test to mitigate it in the future

Remove `colormode` option

The original issue it was trying to solve is no longer present with
tcell (it being a holdover from `color256` on termbox) so it is not
needed.

retire gitter channel in favor of irc/matrix

Export options as environment variables (#448)

* Export options as environment variables

Any options from gOpts are available via lf_OPTION environment
variables. For now it works only on booleans, integers and strings (no
array support)

* Do not export some of the options

* Add support for arrays and fix numbers

* Fix comments

* Replace 1 and 0 with true and false

* Export hidden,reverse,dirfirst and sortby options

* Fix comments

* Little fix

* Simplify boolean conversion

log readlink errors instead of fail

Related #447 and #374
2020-09-01 15:42:44 +03:00
Gokcehan
9c891307f3 cleanup 2020-07-20 02:47:33 +03:00
Gokcehan
9539daf8df handle relative paths in 'toggle' command 2020-07-20 02:22:31 +03:00
Gokcehan
7174b7e307 handle broken links with 'select' command
Related #201
2020-07-20 02:15:30 +03:00
Gokcehan
490a4a9d07 clear previous errors in prompting commands
Related #185
2020-07-20 01:09:54 +03:00
Gokcehan
a6544757db cleanup 2020-07-20 00:44:37 +03:00
Alexey Yerin
3b49e1a2b6
Add check for truncatechar (#420)
* Add check for truncatechar

When value is longer than 1 character, it throws an error

* Use runeSliceWidth instead of len
2020-07-19 21:28:06 +03:00
Alexey Yerin
d0cd181eb6
Ability to customize filename truncating (#417)
* Add truncatechar option

* Add ability to set truncatechar via `set` command

* Add completion for truncatechar option

* Actually use truncatechar option when truncating

* Add truncatechar option to docs
2020-07-18 03:08:25 +03:00
Gokcehan
9880104c12 quote filenames in prompts 2020-07-17 02:17:24 +03:00
Gokcehan
707d927788 handle abs paths in rename 2020-07-17 00:46:46 +03:00
Gokcehan
2f056ad359 select new file after rename
Related #197
2020-07-17 00:28:32 +03:00
gotroyb127
75e59cdd08
'toggle' command now toggles selection on its arguments when at least one (#409)
* 'toggle' command now toggles selection on its arguments when given and some cleanup

* update doc
2020-07-14 19:28:01 +03:00
Gokcehan
45552cf809 use correct search directions with incsearch
Related #284
2020-07-04 03:32:05 +03:00
gotroyb127
4d3e1cfd6e
added a count field to listExpr and toggle now ignores count (#394) 2020-07-03 18:29:55 +03:00
Gokcehan
5d1136abfe keep the destination file before rename
Related #343
2020-06-17 05:19:16 +03:00
Gokcehan
0e3910652a cleanup 2020-06-11 04:11:40 +03:00
Gokcehan
99cee56d6e reload directories when 'hiddenfiles' is changed 2020-06-11 03:16:24 +03:00
Gokcehan
25e487cc51 check pattern errors when 'hiddenfiles' is set 2020-06-11 03:14:45 +03:00
Adam Abrams
72facea2a0
add hiddenFiles option (#372)
* add hiddenFiles option

* harden and improve syntax

* refactor name and add to docs
2020-06-11 02:52:15 +03:00
gotroyb127
41e0bb32cd
fix tilde expansion and numbering (#373)
* Fixed issue #346 and changed the format of numbers when both relativenumber and number are set.

* Fixed issue #349 (incorrect replacement of '~' with user's home direcotry).

* Changed where appropriate so that tilde replacements happens correctly.

* Added a function to replace tilde with user's home directory, only when it should.

* Renamed ReplaceTilde to replaceTilde so that it won't get exported and removed some ';' at the end of some lines.
2020-06-07 20:53:25 +03:00
ath3
9c1836c18b
Add possibility to execute commands when directory changes (on_chdir) (#291)
* Add possibility to execute commands when cwd changes (on_chdir)

* Renamed function and special command on_chdir (onChdir, on-cd), support select command
2020-03-20 22:01:47 +03:00
Gokcehan
3c5abbbc5d Revert "Error clear (#192)"
This reverts commit 30d3078559.
2019-12-23 16:33:45 +03:00
Gokcehan
e0747fa2f9 use rune indices for word matching
Related #193
2019-12-23 16:00:10 +03:00
Gokcehan
b0064df32c convert string indices to rune slice indices
Related #193
2019-12-23 02:35:32 +03:00
David Pedersen
d63e7a2076 Don't rename when name is the same. Fix #253 (#266)
Currently, renaming a file without changing the name will prompt for
replacing and then delete the file. This will instead cancel the
renaming if the old and new names are the same.
2019-12-18 01:39:02 +03:00
Juris Arturs Majors
f76bf30f65 Asynchronous delete (#238)
* Asynchronous deletion, similar to moving

* Reversed some sloppy new lines from previous commit

* Move delete operations to delete.go

* Simplify to use RemoveAll before

* Send errors directly to ui.exprChan directly
2019-12-02 14:27:58 +03:00
Kennedy Mwenja
9991a40e87 Sort by file extensions (#230)
- preserve natural ordering of filenames if extensions are the same
  or are missing
- files without extensions rank higher on ascending sort and lower
  on descending sort
2019-10-04 21:44:52 +03:00
Kennedy Mwenja
9515bd73d0 Sort By Access Time and Change Time (#226)
- Add access time and change time as sort by types. This is
  powered by github.com/djherbis/times.
- Fall back to modification time if access time and change time
  cannot be determined.
- Add `sa` and `sc` as default bindings for sort by access time and
  sort by change time respectively.
- Add access time and change time to info types allowing them to be
  displayed by the file list in the ui
2019-09-18 21:52:30 +03:00
Daniel Martí
50ac367626 fix ineffective breaks, remove unused parameters (#210)
While at it, simplify a few pieces of code.
2019-08-12 14:52:27 +03:00
David Pedersen
2ab866d474 Make prompt for delete command more descriptive (#206)
This will make the prompt shown when running the delete command more descriptive.
Before: `delete?[y/N]:`
Now when deleting one file: `delete /tmp/abc [y/N]?`
Now when deleting selection: `delete 3 items [y/N]?`
2019-07-23 22:33:43 +03:00
Gokcehan
9f661344ed allow defining a custom rename command 2019-07-21 20:40:57 +03:00
Juris Arturs Majors
bfd01e5ed8 draft rename (#197)
*  basic structure

* working rename, without making dir's and selection change

* mkdirAll if necessary

* updated TODO's

* rename with replace prompting

* path prompt and moved functionality to nav.rename()

* renewing now (no set period is needed)

* documentation, keybidning change, load file info after renaming

* go generate
2019-07-20 19:31:19 +03:00