Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,4 @@ Is this your first time here? You should definitely take a look at these scripts
* [FromWau/WeatherScraper](https://github.com/FromWau/WeatherScraper): Scraps the weather.com site and returns a up to 48h weather forecast in json format
* [lgtome/polybar-npm](https://github.com/lgtome/polybar-npm): A polybar script to get updates of specific packages from the npm
* [exaroth/programming-wisdom](https://github.com/exaroth/programming-wisdom) Polybar plugin containing programming wisdom to meditate over during long coding sessions.
* [open_nvim](polybar-scripts/open_nvim) Polybar module for open nvim choice folder to open
26 changes: 26 additions & 0 deletions polybar-scripts/open_nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Script: battery-combined-shell

A shell script that open nvim after you choise folder to open.

Use font Material Icons
```ini
font-1 = Material Icons:style=Regular:size=35;3
```
## Dependencies
- rofi
- nvim
- [nerdfonts](https://www.nerdfonts.com/)

## Module
```ini
[module/open_nvim]
type = custom/text
content = "%{T1} %{T-}"
content-background = ; choise your color
content-foreground = ; choise your color
content-padding = 1
click-left = run_nvim.sh &
```

## Configure
in ```run_nvim.sh``` set your terminal and rofi config
23 changes: 23 additions & 0 deletions polybar-scripts/open_nvim/run_nvim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

RECENT_FILE="$HOME/.recent_folders"
TERMINAL="your_terminal"

# get list recent folder and just folder
recent_dirs=$(cat "$RECENT_FILE" 2>/dev/null)
home_dirs=$(find "$HOME" -maxdepth 1 -type d -not -path '*/\.*' | head -10)

# remove duplicate
all_dirs=$(echo -e "$recent_dirs\n$home_dirs" | sort -u)

selected_dir=$(echo "$all_dirs" | rofi -no-config -no-lazy-grab -show drun -modi drun -theme ~/path_to_your_config -dmenu -p "📁 open in nvim:" -i)

if [ -n "$selected_dir" ] && [ -d "$selected_dir" ]; then
echo "$selected_dir" > temp_recent
cat "$RECENT_FILE" 2>/dev/null | grep -v "$selected_dir" | head -9 >> temp_recent
mv temp_recent "$RECENT_FILE"

# open nvim
cd $selected_dir
exec "$TERMINAL" -e nvim "$FULL_PATH"
fi