The Swift n
is a nice little tool to open files or directory in your favourite editor in a blazingly fast way ⚡
It basically allows you to find fuzzily the file and zoxide into the relevant directory if provided giving you workflow
the ultimate smoothness 🌊
There are multiple ways to open your file or folder to ensure that you get your setup in minimum steps:
n
opens fzf interface and opens selected file from fzf in your editor.
n [search-pattern]
opens fzf with search-pattern as query and opens selected file from fzf in your editor.
n [folder-name] [search-pattern]
zoxides into folder-name, opens fzf interface in that directory and opens the selection from fzf in your editor.
n [folder-name] .
zoxides into folder-name and opens that directory in your editor.
There are two tools that need to be installed in order for Swift n
to work; fzf
and zoxide
. Both the tools can be found in most linux distributions' official package repositories. For popular distributions; the installation commands are as follow:
- For Arch Linux & Arch-Based Distros:
sudo pacman -S fzf zoxide
- For Debian and Debian-Based Distros:
sudo apt install fzf zoxide
- For Fedora
sudo dnf install fzf zoxide
There are a few easy steps to install the tool which are as follows:
- Clone the repository in your preferred directory:
git clone https://github.com/smabbasht/swift-n
- Rename variable editor in the script
n
. The editor is by default set tonvim
, you can rename it as per you need for e.g:vim
,code
,clion
etc. - Add script
n
to your path: You will have to add the scriptn
to your path in order to directly use it from anywhere:- If you use
Fish
, add this in your~/.config/fish/config.fish
:
fish_add_path /path/to/swift-n
- If you use
Bash
, add this in your~/.bashrc
export PATH="/path/to/swift-n:$PATH"
- If you use
Zsh
, add this in your~/.zshrc
export PATH=$PATH:/path/to/swift-n
- If you use
The plan is to extend this helper tool to make it a tmux-session
helper
too. This option will be invoked using flags. I want suggestions on as to do it
or not since those who don't use TMUX
might find this an overkill.
You can support this project by giving this repo a 🌟 and by sharing it
with peers 👬
PRs are highly encouraged 🙌