mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-21 01:53:42 -05:00
Updated examples (markdown)
18
examples.md
18
examples.md
@@ -3,8 +3,8 @@ Useful examples
|
|||||||
|
|
||||||
Feel free to edit this page if you have a nice example of using fzf.
|
Feel free to edit this page if you have a nice example of using fzf.
|
||||||
|
|
||||||
Opening files and directories
|
Opening files
|
||||||
-----------------------------
|
-------------
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# fe [FUZZY PATTERN] - Open the selected file with the default editor
|
# fe [FUZZY PATTERN] - Open the selected file with the default editor
|
||||||
@@ -17,6 +17,9 @@ fe() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Changing directory
|
||||||
|
------------------
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# fd - cd to selected directory
|
# fd - cd to selected directory
|
||||||
fd() {
|
fd() {
|
||||||
@@ -35,6 +38,17 @@ fda() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Suggested by @harelba and @dimonomid:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# cdf - cd into the directory of the selected file
|
||||||
|
cdf() {
|
||||||
|
local file
|
||||||
|
local dir
|
||||||
|
file=$(fzf +m -q "$1") && dir=$(dirname "$file") && cd "$dir"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Command history
|
Command history
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user