diff --git a/book/src/configuration.md b/book/src/configuration.md index 0890d28328ca..887a1cf9d2c4 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -48,6 +48,7 @@ on unix operating systems. | `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"]` | | `auto-completion` | Enable automatic pop up of auto-completion. | `true` | +| `path-completion` | Enable filepath completion, show files and directories if a path at the cursor was recognized. | `true` | | `auto-format` | Enable automatic formatting on save. | `true` | | `auto-save` | Enable automatic saving on focus moving away from Helix. Requires [focus event support](https://github.com/helix-editor/helix/wiki/Terminal-Support) from your terminal. | `false` | | `idle-timeout` | Time in milliseconds since last keypress before idle timers trigger. Used for autocompletion, set to 0 for instant. | `400` | diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index b6c113fd1c36..5ce3f8a2e838 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3074,16 +3074,17 @@ pub mod insert { }) .collect::>(); - if !trigger_completion_ls_ids.is_empty() || ch == '/' { + if !trigger_completion_ls_ids.is_empty() { cx.editor.clear_idle_timer(); - // TODO path for windows - if ch == '/' { - super::completion_path(cx) - } for id in trigger_completion_ls_ids { super::completion_lsp(cx, id) } } + // TODO path for windows + if ch == '/' && cx.editor.config().path_completion { + cx.editor.clear_idle_timer(); + super::completion_path(cx) + } } fn signature_help(cx: &mut Context, ch: char) { @@ -4246,7 +4247,9 @@ pub fn completion(cx: &mut Context) { completion_lsp(cx, id) } - completion_path(cx); + if cx.editor.config().path_completion { + completion_path(cx); + } } // comments diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index e0cef6d47d23..ddbed01d0769 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -142,6 +142,8 @@ pub struct Config { pub auto_pairs: AutoPairConfig, /// Automatic auto-completion, automatically pop up without user trigger. Defaults to true. pub auto_completion: bool, + /// Filepath completion, show files and directories if a path at the cursor was recognized. Defaults to true. + pub path_completion: bool, /// Automatic formatting on save. Defaults to true. pub auto_format: bool, /// Automatic save on focus lost. Defaults to false. @@ -613,6 +615,7 @@ impl Default for Config { middle_click_paste: true, auto_pairs: AutoPairConfig::default(), auto_completion: true, + path_completion: true, auto_format: true, auto_save: false, idle_timeout: Duration::from_millis(400),