Skip to content

Commit

Permalink
run telescope.git_files when inside a Git repo with edit
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoine committed Jun 26, 2023
1 parent 1801a95 commit e9b13e8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nu_scripts/scripts/misc.nu
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def _throw-not-a-list-of-strings [files: any] {
export def edit [
...rest: path
--no-auto-cmd (-n): bool
--auto-cmd: string = "lua require('telescope.builtin').find_files()"
--auto-cmd: string
--projects (-p): bool
] {
let files = ($in | default [])
Expand All @@ -602,7 +602,13 @@ export def edit [
} else if $projects {
"lua require('telescope').extensions.projects.projects{}"
} else {
$auto_cmd
$auto_cmd | default (
if (".git/" | path exists) {
"lua require('telescope.builtin').git_files()"
} else {
"lua require('telescope.builtin').find_files()"
}
)
}
)

Expand Down

0 comments on commit e9b13e8

Please sign in to comment.