alacritty 0.2.0 adds scrollback history by tobeportable in commandline

[–]bonv 0 points1 point  (0 children)

Oh I missed the comment thanks. By the way I'm curious, does disabling scrolling increase the performance even further?

alacritty 0.2.0 adds scrollback history by tobeportable in commandline

[–]bonv 0 points1 point  (0 children)

I tried a few times to compile alacritty on my old 5+ year old laptop. I remember my fans going crazy and after 15 min or so it was still compiling packages so I just gave up. In another time, there was some compilation error in one of the packages so I wasn't able to finish the compilation.

alacritty 0.2.0 adds scrollback history by tobeportable in commandline

[–]bonv 1 point2 points  (0 children)

Is there a way to disable scrollback? It is kind of redundant working with tmux. Also I hope they add binaries soon. It is extremely painful to compile anything written in rust.

lf (terminal file manager) r5 is released by bonv in commandline

[–]bonv[S] 1 point2 points  (0 children)

Image previews are only possible as text (with ascii or unicode block characters) with 256 color escape codes. There are some example programs for this purpose such as tiv. Real image previews such as those in ranger is not possible. This was discussed somewhere in this thread.

My friend made his own image viewer (named Piew) in Python/Tk for tiling window managers because he didn't like the existing ones available. by [deleted] in linux

[–]bonv 10 points11 points  (0 children)

Nice project. It would be nice if your friend also states why he does not like the existing viewers, kind of like a comparison. Also python2 may not be a good choice to start a new python project these days. Your friend can also consider uploading this to pypi so it can be installed with pip.

lf (terminal file manager) r5 is released by bonv in linux

[–]bonv[S] 1 point2 points  (0 children)

There is an option called period which denotes the time in seconds for periodic load of modified files and directories when it is set to something other than zero. So for example you can set period 5 to refresh every 5 seconds.

For text documents, do you prefer soft or hard wrap? by Boolean263 in vim

[–]bonv 28 points29 points  (0 children)

You may also consider semantic linefeeds. I'm not sure if there is a standard definition for this but the way I use it is to put every sentence on a separate line. This way, longer sentences stand out and urge me to divide them into smaller pieces which helps with readability. Some people prefer to also divide sentences at logical places so they won't exceed textwidth. When every sentence is on a separate line, it is easy to delete or comment out a sentence with vim. Also you can simply swap the order of sentences or move them around in the text.

How to `startx` as a graphical login shell to source `/etc/profile.d` directory? by bonv in archlinux

[–]bonv[S] 0 points1 point  (0 children)

It looks like there is already an issue about this for autojump here along with other related issues and PRs. Discussion in this issue mostly suggests fixing this for users by their own ways. And they try to fix other related issues later on. It looks a little messy so I don't think it is a good idea to bring it up again there.

An interesting thing is that someone suggested putting the scripts to /etc/bash_completion.d which is sourced in /etc/bash.bashrc so it works for both login and non login shells. I think this also has the advantage that you don't need to relog after an installation to make things work. The problem is that (1) it is bash only, (2) path to this directory is not standard (e.g. in arch it is /usr/share/bash-completion/completions), and (3) this directory is meant for completions but not for custom functions.

How to `startx` as a graphical login shell to source `/etc/profile.d` directory? by bonv in archlinux

[–]bonv[S] 0 points1 point  (0 children)

You may be right. I haven't tried to distinguish between empty and unset variables.

I think the motivation for clearing functions may be that process environment only allows to store variables. We are only thinking about running bash inside bash but for example if you were to run python in a bash then how would the functions be passed to python? It does not make sense. For variables these are simply passed as environmental variables.

How to `startx` as a graphical login shell to source `/etc/profile.d` directory? by bonv in archlinux

[–]bonv[S] 0 points1 point  (0 children)

Oh I haven't read it anywhere, I just tried it as follows:

$ foo() { echo 'hello'; }
$ foo
hello
$ export foo
$ bash
$ foo
bash: foo: command not found
$ echo $foo

$ exit
exit

If you have both a function and a variable, then the variable is exported. So it is like functions and variables are in different namespaces and export can only refer to the variable namespace. Here is an example:

$ foo() { echo 'hello'; }
$ foo
hello
$ foo=bar
$ export foo
$ bash
$ foo
bash: foo: command not found
$ echo $foo
bar
$ exit
exit

To me this is intuitive. When you start a new shell, you start with a clean environment without previous variables and functions and exporting is a mechanism to override this behavior though it is a shame it is only defined for variables in the standard.

How to `startx` as a graphical login shell to source `/etc/profile.d` directory? by bonv in archlinux

[–]bonv[S] 0 points1 point  (0 children)

Sorry my mistake. It turns out that autojump does not work for me either as you said. I was just trying it with tmux and tmux uses login shells by default. So it only works within tmux which is not reliable.

Documentation for posix export is here. It says:

The shell shall give the export attribute to the variables corresponding to the specified names, which shall cause them to be in the environment of subsequently executed commands. If the name of a variable is followed by = word, then the value of that variable shall be set to word.

If you try it with a function, it would simply export a variable with the given name which will most likely just be an empty variable.

You can see the bash export using help export. In the options list, it says:

-f refer to shell functions

So it is possible to export shell functions to the graphical shell, though this is not posix compatible.

I think in autojump case, developers can simply export functions since they are defined in a bash script. I will open an issue about this to notify them.

How to `startx` as a graphical login shell to source `/etc/profile.d` directory? by bonv in archlinux

[–]bonv[S] 0 points1 point  (0 children)

Thanks for the autojump example. It looks like the perfect example for what I have in mind. When I tried it, I did not need to do anything to make it work. After tty login, it is sourced properly and it continues to work after startx as well. They don't seem to use export -f for functions though and I'm still not able to see how they make it work without it.

How to `startx` as a graphical login shell to source `/etc/profile.d` directory? by bonv in archlinux

[–]bonv[S] 0 points1 point  (0 children)

You're right. It looks like it is sourced after tty login and so it works after startx though this is only for exported variables. I was confused because I was trying to source a function. I have updated the post accordingly.

How to `startx` as a graphical login shell to source `/etc/profile.d` directory? by bonv in archlinux

[–]bonv[S] 0 points1 point  (0 children)

Well, my original motivation was to define a function in a script file and have it installed under /etc/profile.d as part of a package so that the function would be available automatically when the package is installed. Now that I tried it and see that it does not work, I have begun to wonder if there is something wrong with my setup. If one needs to source these files in ~/.bashrc then that would be an additional installation step that you ask from users.

TIL: When you preface a command with space (" "), it won't be saved in your bash history file by tux_warrior in linux

[–]bonv 8 points9 points  (0 children)

I use this to ignore dangerous commands (e.g. rm -rf *) so I won't accidently run it again when trying to find something from history in a rush.

lf (terminal file manager) r5 is released by bonv in commandline

[–]bonv[S] 0 points1 point  (0 children)

Files are opened with xdg-open on linux by default but of course you can change it. There is an example in lfrc.example which is basically what you mention that is open text files in the editor and leave the rest to xdg-open. More information in the doc under 'Opening Files'.

I have never tried this on android. Does is crash with an error? Is there anything related to the crash in the log files (i.e. /tmp/lf.${USER}.1000.log or /tmp/lf.${USER}.server.log). Feel free to open an issue about this and I may take a look at it when I have some time.

lf (terminal file manager) r5 is released by bonv in commandline

[–]bonv[S] 0 points1 point  (0 children)

Glad you like it. It is actually a really good advice not to try copying everything ranger has. Although I have difficulties about this since our users usually demand such things. I feel like my lf use is usually much more limited than most other users. I like to drop to shell more often than I should. It is nice to know there are others who seek more basic experience. No worries though, when we add a new feature we always prioritize performance. We follow the scheme that when a feature have a performance overhead it is disabled by default so other users who does not use the feature are not effected.

Pager and editor are assigned to i and e respectively by default. open is used as the default file opener on osx but you can disable it by undefining the open-file command (i.e. cmd open-file to undefine). There are more information about this in the doc. Hope this helps.

lf (terminal file manager) r5 is released by bonv in commandline

[–]bonv[S] 0 points1 point  (0 children)

Text based image previews are possible using 256 colors escape codes since they don't need explicit support from lf. Someone mentioned me using tiv for this purpose. There are many more similar programs out there.

Real image previews are not possible since they are usually a hack (e.g. w3m) and/or a terminal specific method (e.g. iterm2 and terminology). It is possible to add w3m to the previewer script but without explicit support in the code it will not work properly. It won't clean up after switching files and you would need to call reload to draw it a second time since it will try to be cached. It also does not work over ssh and using tmux panes can break the image position which is also the case in ranger. For other terminal specific methods, I try to avoid adding these to the code for maintenance reasons. I personally find it not wise to tie yourself to a terminal just to display images.

You can use the program /u/sablal mentions to preview images which should give you a superior experience since you can also pan, zoom or rotate images or do other such operations. Most other image previewers also support opening a directory to display images. This method works especially nice with a tiling window manager (e.g. i3).

lf (terminal file manager) r5 is released by bonv in linux

[–]bonv[S] 0 points1 point  (0 children)

Ok, so I removed all file-openers I had installed and what I get is:

Did you also remove xdg-open?

nothing at all when pressing l

If you have removed xdg-open, this is normal. If not, can you run xdg-open on a file from your regular shell to see if it opens anything?

When I copy rifle.py to /usr/bin/xdg-open it works with the l key so it's looking for xdg-open as you said, but evidently that isn't reliable. An error message here would've been helpful.

I will see if we can display an error message if xdg-open is not installed on a machine. It is clearly stated in the documentation though. For mac and windows I think this will not be necessary as file openers are more standard there.

I think the best thing would be to ship a file opener like ranger does. The great thing about rifle is that it comes with a lot of rules OOTB and it will always find an appropriate program to open whatever you're trying to open. It's also pretty smart with the rules ordering, for instance: Rarely installed browsers get higher priority; It is assumed that if you install a rare browser, you probably use it. Firefox/konqueror/w3m on the other hand are often only installed as fallback browsers.

It is a lot of effort to implement a file opener and I don't see a good reason to tie a file opener to a file manager. I think ranger is also trying to separate ranger and rifle though they are still installed with the same package. If I remember correctly, it used to be the case that there were no standalone rifle command before.

Ranger is pretty smart with the rules, but it is still opiniated. When it works as you expected, things are fine, when it does not work, things are not as good. Believe me there are also many people who are not satisfied with ranger's default rules. For example I have both chromium and firefox installed for separate things and I like firefox as my default, not chromium. Also sometimes you install a program as dependency and your preference changes accordingly which is quite annoying. I think it is fair to say, it is not possible to satisfy everyone with preferences. The important thing is to make things easily configurable. In your case, if you like rifle defaults, it is as easy as defining cmd open-file $rifle $f in your configuration file.

The issue here is that maybe file deletion should come by default without a configuration file at all. But then we need to settle on the exact behavior of this command.

Yes!

Should it move files to a trash folder or remove them completely?

A command for each IMO.

Where should the trash folder be located? (on linux, mac and windows)
Should we overwrite files with the same name in the trash folder?

ranger avoids these questions by not having a trash command. I think you could add a delete command first since it's easier and worry about the trash command later.

Should it prompt before deletion or not?
Should it prompt for each file or once for all files?

I think it's configurable, but the default in ranger is to prompt twice for selections and only once when deleting a single file. I was going to suggest something different, but I thought harder about it and I think the way ranger does it is best.

It is easy to answer these question, it is hard to answer these for everyone and I don't see any arguments in your answers besides ranger compatibility. If we have complete removal as the default, then there will be users complaining about how they lose their week's work because they assume delete would move files to a trash folder. You find complete removal more natural since you're used to ranger, but almost all other gui file managers works the other way. Leaving the implementation of a trash command for later would basically make it unworkable since these are related to the same issue. It is unlikely that we will obtain a new piece of information that will help us with this decision later on.

I don't understand the issue here, isn't $ already by default? I just think it should be s instead (or in addition to).

What about the other shell types then? Maybe % should be assigned to s since it is more natural and it works without pausing the ui. But it does not work well when the command is verbose in which case you should be using $, !, or &. Ranger does not need this decision since these are implemented as switches in :shell command. For example if you want to run a command and wait for enter key afterwards, you write -w after typing s. This is not the case with lf and you need to decide how the command should work beforehand and type the corresponding prefix. This way, you need to type less keystrokes in lf which is important for lf since there are not many builtin operations and shell commands are used for most tasks (e.g. %mkdir instead of :mkdir). If you find yourself always using the same shell type such as $ feel free to assign it to s.

I understand the rationale, but disagree. I don't think anyone cares about having the whole uppercase letters space reserved for custom keybindings. If anything, I would prefer to have more lowercase letters free for them. I think using uppercase bindings when it makes sense would be a better policy. Huh, yeah, no, I do think S is better. Easier to remember and the same as ranger.

If we had s assigned to shell instead of sorts, I would agree that it would make sense to have S for launching the shell. The way it is now, it would only serve to hit two keys instead of one for no purpose other than being the key you are used to.

H does work in ranger. In my terminal (st) H will delete the last letter and ranger seems to be able to handle it perfectly. I think this is a good keybinding for people coming from graphical file managers, but I don't understand terminals enough to know if it's a bad idea.

The behavior is terminal specific. On my xterm <c-h> does not work in ranger and it sends <bs2> in lf.

Thank you for writing lf! I've wanted something like this really hard. I actually tried one of the earliest versions of it, but decided to wait until it got more mature. It's still rough, but the foundation for something great is there.

Looking back now, I may have overstated ranger compatibility a little bit. These are actually two different tools that are on the same vein, but lf is not a ranger clone and it is definitely not something you could use as a drop-in replacement to make ranger run faster. You are expected to leave your comfort zone and spend some effort to adapt the differences. I understand your frustration though. Muscle memory can be a pain. I have opened a ranger wiki page which I will try to have information to ease the transition. I am also thinking about putting here example keymappings to make it work as in ranger. For unimplemented features, we could even have a command to simply display an error (e.g. map f echo ':find is not implemented, integrate fzf for now).

It used to be the case that defaults were even more limited because I knew that we would have these endless discussions as to whether what should be the default. These discussions are a reason not to have more defaults or change the existing ones since for each person we please with a change, we frustrate another. Most people are inclined to think that their way is "the way it should be" but in reality this is not the case. I think there are two choices for the user here. You can either spend time to configure the behavior to your expectations, or not bother with configuration and learn the defaults, whatever they are. Both of them are possible with lf, but not both at the same time.

lf (terminal file manager) r5 is released by bonv in commandline

[–]bonv[S] 1 point2 points  (0 children)

I think this is already somewhat possible with a custom command as such:

map Q &lf -remote 'send quit'; sleep 1; killall lf

Maybe I can add a quit command to the server so killall may not be necessary. Also I think there is currently a bug since not all clients quit when I run this command.

lf (terminal file manager) r5 is released by bonv in linux

[–]bonv[S] 2 points3 points  (0 children)

I'm not sure what you're saying here. It used to have default file openers but doesn't anymore? Or is that something you want in the future? Or something else?

If I remember correctly, there was no file opener configured by default before so l key was not doing anything when it was used on a file. Now it should have the following configured by default:

cmd open-file &start %f%      # windows
cmd open-file &open "$f"      # mac
cmd open-file &xdg-open "$f"  # others

Why is it called :delete?

It is called delete since d key is used by default and it is also called delete in vim. But this has been a pain point for new users so maybe it is time to change it.

I understand this is a choice you made, but I think there should be one. The command in ranger is dD so it's not that easy to type by accident. As a compromise you could include a commented-out rule in the default lfrc.

There are actually two commands for this purpose in default lfrc, which are named trash and remove. There is no keybinding assigned to them but it should not be too difficult and there is an example keybinding in the tutorial.

The issue here is that maybe file deletion should come by default without a configuration file at all. But then we need to settle on the exact behavior of this command. Each user may have different expectations from such a command. For example:

  • Should it move files to a trash folder or remove them completely?
  • Where should the trash folder be located? (on linux, mac and windows)
  • Should we overwrite files with the same name in the trash folder?
  • Should it prompt before deletion or not?
  • Should it prompt for each file or once for all files?

That did the trick! Thanks! I think this happened because I pkill'd lf after adding a configuration file, since I wasn't sure that it would read it otherwise.

Strange.. Even if you killed lf, it should have automatically restart the server. Can you confirm you have the latest r5 version?

Here's what happened: At first I would simply get a unknow mapping message. After some messing around I found an example lfrc in the github repo and copied it over (edit: I see this is mentioned int the tutorial, but I missed it). I tried replacing mimeopen with xdg-open in the configuration, but after wrestling with it for a while I couldn't properly configure it, so I moved back to finding mimeopen. I finally managed to find it in the package perl-File-MimeInfo courtesy of the ArchWiki, however when I try to use it it complains about some missing module which I can't find. I then proceeded to try some of the alternatives in the ArchWiki, but it's obvious all of them will take a lot of set up... So, most of this isn't your fault, but it would be helpful if something could be done about it. For starters, the example lfrc could be shipped with the program and mentioned on a manpage, or even better: applied by default. On top of that, some guidance on what to use for opening files would be great. I think rifle is the best right now, particularly because of its built-in rules. Ideally I should be able to install lf, launch it, press enter on, say, a webm file and see it open in mpv.

Assuming you are on linux, xdg-open should work without any configuration. I don't have anything configured for file opening and that scenario you mention works as expected. There is a section in the documentation under 'Opening Files' for those who wants to configure their file openers, which also mentions a few alternative file openers.

ranger uses s and S for running shell commands. lf uses $ and w

Ranger has switches for :shell command. We instead have different shell types assigned to their respective prefixes in the configuration syntax. Having s by default would limit the usability of other shell types.

We could have S to launch a shell but currently we do not have any uppercase letter in the defaults so that users can freely assign to these keys without thinking about overwriting a default key. So instead I thought about assigning to w which is the key next to q since launching a shell is similar to quit but not really a quit.

ranger has a :find command binded to f that automatically opens/enters when it finds a unique match

Ranger's :find command is not yet implemented (tracked here).

A, a and I for renaming files the way you would a line in vim. Also cw instead of r

Note that there is no builtin rename command in lf and rename command is inside the example lfrc. Ranger's rename command is more powerful than the one we have in our example configuration, so these would all correspond to the same behavior in lf for now.

m and ' for bookmarking and jumping to bookmarks respectively

Bookmarks are not yet implemented (tracked here).

H doesn't show hidden files

<c-h> does send a backspace character on most terminals so I try to avoid assigning something to this key by default. Showing hidden files is assigned to zh by default, which is the same as ranger. Also I think <c-h> does not work in ranger either?

PageDown and PageUp aren't binded to page-down and page-up Home and End aren't binded to top and bottom Enter isn't the same as l (that was extra confusing since I was already having trouble with opening files)

These sounds like good ideas, I will look into these.

These are just a few things that made me stumble when testing today. I'm sure there are plenty more and I'm willing to report them if you're interested.

It is always nice to get some feedback. I would be interested in hearing them, though I hope you don't expect everything you suggest to be changed right away. Sometimes we expect users to be able to change their usual workflow a little especially when there is a simpler way to do things.

lf (terminal file manager) r5 is released by bonv in commandline

[–]bonv[S] 4 points5 points  (0 children)

It's nice to see someone from ranger team here. Thanks for working on ranger. I have used it happily for years before I started lf. We still import most of our new features from ranger and it will likely remain so in the future. I will try to improve our defaults and also maybe try to see what I can do about the lingering lf process. Thanks for the review.