From ac8ebe739da42c7672e3f80aee16d03d8a1301b9 Mon Sep 17 00:00:00 2001 From: Ian Hobson Date: Mon, 28 Oct 2024 14:53:11 +0100 Subject: [PATCH] Add an option to disable .gitignore when completing paths in the prompt --- book/src/editor.md | 1 + helix-term/src/ui/mod.rs | 6 ++++-- helix-view/src/editor.rs | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/book/src/editor.md b/book/src/editor.md index 82d5f8461..3dc0a25a7 100644 --- a/book/src/editor.md +++ b/book/src/editor.md @@ -31,6 +31,7 @@ | `cursorline` | Highlight all lines with a cursor | `false` | | `cursorcolumn` | Highlight all columns with a cursor | `false` | | `gutters` | Gutters to display: Available are `diagnostics` and `diff` and `line-numbers` and `spacer`, note that `diagnostics` also includes other features like breakpoints, 1-width padding will be inserted if gutters is non-empty | `["diagnostics", "spacer", "line-numbers", "spacer", "diff"]` | +| `command-git-ignore` | Whether to read `.gitignore` when listing paths in the command prompt | `true` | | `auto-completion` | Enable automatic pop up of auto-completion | `true` | | `auto-format` | Enable automatic formatting on save | `true` | | `idle-timeout` | Time in milliseconds since last keypress before idle timers trigger. | `250` | diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 6a3e198c1..19169ba89 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -341,7 +341,7 @@ pub mod completers { } pub fn filename(editor: &Editor, input: &str) -> Vec { - filename_with_git_ignore(editor, input, true) + filename_with_git_ignore(editor, input, editor.config().command_git_ignore) } pub fn filename_with_git_ignore( @@ -392,7 +392,7 @@ pub mod completers { } pub fn directory(editor: &Editor, input: &str) -> Vec { - directory_with_git_ignore(editor, input, true) + directory_with_git_ignore(editor, input, editor.config().command_git_ignore) } pub fn directory_with_git_ignore( @@ -472,6 +472,8 @@ pub mod completers { .hidden(false) .follow_links(false) // We're scanning over depth 1 .git_ignore(git_ignore) + .git_global(git_ignore) + .git_exclude(git_ignore) .max_depth(Some(1)) .build() .filter_map(|file| { diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 26dea3a21..6733f469f 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -259,6 +259,8 @@ pub struct Config { pub cursorcolumn: bool, #[serde(deserialize_with = "deserialize_gutter_seq_or_struct")] pub gutters: GutterConfig, + /// Whether .gitignore should be read when listing paths in the command prompt. Defaults to true. + pub command_git_ignore: bool, /// Middle click paste support. Defaults to true. pub middle_click_paste: bool, /// Automatic insertion of pairs to parentheses, brackets, @@ -944,6 +946,7 @@ impl Default for Config { cursorline: false, cursorcolumn: false, gutters: GutterConfig::default(), + command_git_ignore: true, middle_click_paste: true, auto_pairs: AutoPairConfig::default(), auto_completion: true,