forked from RobbiNespu/fedora-ultimate-setup-script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-and-setup-nnn.sh
More file actions
executable file
·42 lines (34 loc) · 1.53 KB
/
Copy pathinstall-and-setup-nnn.sh
File metadata and controls
executable file
·42 lines (34 loc) · 1.53 KB
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
#!/usr/bin/env sh
#==============================================================================
# Set directory and URL locations as global variables
#==============================================================================
NNN_LOCATION=https://download.opensuse.org/repositories/home:/stig124:/nnn/CentOS_8/x86_64/
NNN_FILENAME=nnn-4.1.1-1.3.x86_64.rpm
curl -LOf $NNN_LOCATION$NNN_FILENAME
chmod +x ./$NNN_FILENAME
sudo dnf install ./$NNN_FILENAME
curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh
# Download the following script to anywhere in your PATH
# curl https://raw.githubusercontent.com/mpv-player/mpv/master/TOOLS/umpv -o "$HOME/Documents/scripts/umpv"
cat >"$HOME/.config/nnn/plugins/addtoplaylist" <<'EOL'
#!/usr/bin/env sh
# Open selected files in MPV playlist
player="umpv"
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
if [ -s "$selection" ]; then
xargs -0 "$player" <"$selection"
else
"$player" "$1"
fi
EOL
chmod +x "$HOME/.config/nnn/plugins/addtoplaylist"
#==============================================================================
# Add settings to .bashrc
#==============================================================================
function add_to_bashrc() {
grep -qxF "$1" "$HOME/.bashrc" || echo "$1" >>"$HOME/.bashrc"
}
add_to_bashrc 'export NNN_PLUG="p:addtoplaylist;f:fzcd"'
add_to_bashrc "export NNN_BMS='d:~/Documents;D:~/Downloads;p:~/Pictures;v:~/Videos;m:~/Music;h:~/'"
add_to_bashrc "export NNN_TRASH=1"
add_to_bashrc 'alias nnn="nnn -xe"'