Home How to install and custom lf
Post
Cancel

How to install and custom lf

How to install lf

Instalation

Instalation

1
2
3
4
5
6
sudo apt update && sudo apt install -y wget tar unzip vim
cd /tmp
wget https://github.com/gokcehan/lf/releases/download/r27/lf-linux-amd64.tar.gz
tar xvf lf-linux-amd64.tar.gz
chmod +x lf
sudo mv lf /usr/bin

Configuration File

Create a configuration file on ~/.config/lf/lfrc

1
2
mkdir ~/.config/lf
vim ~/.config/lf/lfrc

Configuration of lfrc config file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Basic Settings
set preview on
set icons on
set drawbox on

# Custom Functions
cmd mkdir ${{
  printf "Directory Name: "
  read ans
  mkdir $ans
 }}

cmd mkfile ${{
  printf "File Name: "
  read ans
  $EDITOR $ans
 }}

cmd sudomkfile ${{
  printf "File Name: "
  read ans
  sudo $EDITOR $ans
 }}

# Archive bindings
cmd unarchive ${{
  case "$f" in
    *.zip) unzip "$f" ;;
    *.tar.gz) tar -xzvf "$f" ;;
    *.tar.bz2) tar -xjvf "$f" ;;
    *.tar) tar -xvf "$f" ;;
    *)echo "Unsupported format" ;;
  esac
 }}

cmd zip %zip -r "$f" "$f"
cmd tar %tar cvf "$f.tar" "$f"
cmd targz %tar cvzf "$f.tar.gz" "$f"
cmd tarbz2 %tar cjvf "$f. tar.bz2" "$f"

# Bindings
# Remove some defaults
map m
map o
map n
map "'"
map '"'
map d
map e

# Basic Functions
map . set hidden!
map DD delete
map p paste
map x cut
map y copy
map mf mkfile
map ms sudomkfile
map md mkdir
map <enter> open
map <esc> quit

# File Openers
map ee $$EDITOR "$f"
map es $sudo $EDITOR "$f"

#Archive Mappings
map az zip
map at tar
map ag targz
map ab tarbz2
map au unarchive

Add Icons

For all these icons to work we need first download a Nerd Fonts, and then install in your terminal.

Now we need to create a file that contains all the icons on ~/.config/lf/ICONS

1
fi=:di=:ln=:pi=|:so=ﯲ:db=:cd=c:or=:su=:sg=:tw=:ow=:st=:ex=:*.7z=:*.a=:*.aac=:*.ace=:*.ai=:*.alz=:*.apk=:*.arc=:*.arj=:*.asf=:*.asm=:*.asp=:*.au=:*.aup=:*.avi=:*.avi=:*.bash=:*.bat=:*.bmp=:*.bz2=:*.bz=:*.c++=:*.c=:*.cab=:*.cbr=:*.cbz=:*.cc=:*.cgm=:*.class=:*.clj=:*.cljc=:*.cljs=:*.cmake=:*.cmd=:*.coffee=:*.conf=:*.cp=:*.cpio=:*.cpp=:*.cs=:*.css=:*.cue=:*.cvs=:*.cxx=:*.d=:*.dart=:*.db=:*.deb=:*.diff=:*.dl=:*.dll=:*.doc=:*.docx=:*.dump=:*.dwm=:*.dz=:*.ear=:*.edn=:*.eex=:*.efi=:*.ejs=:*.elf=:*.elm=:*.emf=:*.epub=:*.erl=:*.esd=:*.ex=:*.exe=:*.exs=:*.f#=:*.fifo=|:*.fish=:*.flac=:*.flc=:*.fli=:*.flv=:*.flv=:*.fs=:*.fsi=:*.fsscript=:*.fsx=:*.gem=:*.gif=:*.git=:*.gl=:*.go=:*.gz=:*.gzip=:*.h=:*.hbs=:*.hh=:*.hpp=:*.hrl=:*.hs=:*.htaccess=:*.htm=:*.html=:*.htpasswd=:*.ico=:*.img=:*.ini=:*.iso=:*.jar=:*.java=:*.jl=:*.jpeg=:*.jpg=:*.js=:*.json=:*.jsx=:*.key=:*.less=:*.lha=:*.lhs=:*.log=:*.lrz=:*.lua=:*.lz4=:*.lz=:*.lzh=:*.lzma=:*.lzo=:*.m2v=:*.m4a=:*.m4v=:*.markdown=:*.md=:*.mid=:*.midi=:*.mjpeg=:*.mjpg=:*.mka=:*.mkv=:*.ml=λ:*.mli=λ:*.mng=:*.mov=:*.mp3=:*.mp4=:*.mp4v=:*.mpc=:*.mpeg=:*.mpg=:*.msi=:*.mustache=:*.nix=:*.nuv=:*.o=:*.oga=:*.ogg=:*.ogm=:*.ogv=:*.ogx=:*.opus=:*.pbm=:*.pcx=:*.pdf=:*.pgm=:*.php=:*.pl=:*.pm=:*.png=:*.ppk=:*.ppm=:*.ppt=:*.pptx=:*.pro=:*.ps1=:*.psb=:*.psd=:*.pub=:*.py=:*.pyc=:*.pyd=:*.pyo=:*.qt=:*.ra=:*.rar=:*.rb=:*.rc=:*.rlib=:*.rm=:*.rmvb=:*.rom=:*.rpm=:*.rs=:*.rss=:*.rtf=:*.rz=:*.s=:*.sar=:*.scala=:*.scss=:*.sh=:*.slim=:*.sln=:*.so=:*.spx=:*.sql=:*.styl=:*.suo=:*.svg=:*.svgz=:*.swm=:*.t7z=:*.t=:*.tar=:*.taz=:*.tbz2=:*.tbz=:*.tga=:*.tgz=:*.tif=:*.tiff=:*.tlz=:*.ts=:*.twig=:*.txz=:*.tz=:*.tzo=:*.tzst=:*.vim=:*.vimrc=:*.vob=:*.war=:*.wav=:*.wav=:*.webm=:*.wim=:*.wmv=:*.xbm=:*.xbps=:*.xcf=:*.xhtml=:*.xls=:*.xlsx=:*.xml=:*.xpm=:*.xspf=:*.xul=:*.xwd=:*.xz=:*.yaml=:*.yml=:*.yuv=:*.z=:*.zip=:*.zoo=:*.zsh=:*.zst=:*.src=:*.ebuild=:

Next step we need edit the ZSH config file on ~/.zshrc, or if you are using BASH go to ~/.bashrc and add the code above.

1
2
export EDITOR="vim" # You can change to your favorite editor (nano, nvim, gedit...)
export LF_ICONS=$(cat ~/.config/lf/ICONS)

Using

To execute the command type lf. Easy like fly hahahaha
Result:

result For more information go to Gokcehan Github and Doc

This post is licensed under CC BY 4.0 by the author.
Contents