Ranger manager configure
My personal ranger config
Contents
Note
This article was last updated on 2024-06-22, the content may be out of date.
This is my personal config for the ranger
file manager. Some basic information:
OS | Arch Linux |
---|---|
Font | Iosevka 14 |
Terminal | Termite |
WM | i3 |
1 Ranger icons
1.1 Install
- First install a nerd font which can be found here: https://github.com/ryanoasis/nerd-fonts. After that, run the following command:
git clone https://github.com/alexanderjeurissen/ranger_devicons ~/.config/ranger/plugins/ranger_devicons
Then execute the following:
echo "default_linemode devicons" >> $HOME/.config/ranger/rc.conf
# (or wherever your rc.conf is located).
1.2 Configure spacing between icon and text:
In ~/.config/ranger/plugins/ranger_devicons
, edit the following file __init__.py
:
import ranger.api
from ranger.core.linemode import LinemodeBase
from .devicons import *
@ranger.api.register_linemode
class DevIconsLinemode(LinemodeBase):
name = "devicons"
uses_metadata = False
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path
@ranger.api.register_linemode
class DevIconsLinemodeFile(LinemodeBase):
name = "filename"
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path
In line return devicon(file) + ' ' + file.relative_path
, add or delete spaces in ' '
to adjust the spacing between the icons and your file/folder name.
2 Add syntax highlighting preview
Just install highlight
package:
- Arch:
$ sudo pacman -S highlight
- Ubuntu:
$ sudo apt-get install highlight
Then reopen ranger
.
Ranger
configures highlighting in scope.sh
. To use a specific theme, the HIGHLIGHT_STYLE
variable should be set, for example: export HIGHLIGHT_STYLE=clarity
.
3 Image preview
First, install python-ueberzug-git
from aur by running this command:
yay -S python-ueberzug-git
In your ranger config file (~/.config/ranger/rc.conf
), add this line:
set preview_images_method ueberzug
4 File management
Shortcuts | Description |
---|---|
H |
Show hidden files and folders. |
r |
Open with <APPLICATION> . |
D |
Delete the marked file or the selected files. |
<Space> |
Selects the current file/folder. |
v |
Marks all files and folders in the current directory. |
a |
Edit the name of the file/folder by putting the cursor last. |
I |
Edit the name of the file/folder by putting the cursor first. |
cw |
Change the name of the file/folder. |
o |
Sort current directory.oa to sort by time. os to sort by name size and so on. |
'<LETTER> |
Jump to bookmark. |
m<LETTER> |
Bookmarks the current directory. |
:bulkrename |
Lets you bulk rename the selected files and folders by using your $EDITOR. |
Buy me a cup of coffee