aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorDan Nases Sha2021-11-20 14:23:36 +0000
committerGitHub2021-11-20 14:23:36 +0000
commit6a4d9693ba12feed5b6d6b1b34a4ff56cb9f9fd7 (patch)
treee05e6dfd08dc8e67b90cd4dd41096447e6d65162 /helix-view
parent05c6cb1d0b576547c14b204e0df543650c93892f (diff)
File picker config (#988)
* squashed WIP commits * hide_gitignore working with config * pass reference to new config parameter of file_picker() * update config option name to match name on walk builder * add comments to config and documentation of option to book * add git_ignore option to WalkBuilder within prompt in commands.rs * WIP: add FilePickerConfig struct * WIP: cleanup * WIP: add more options including max_depth * WIP: changed defaults to match ignore crate defaults * WIP: change WalkBuilder in global_search() to use config options * WIP: removed follow_links, changed max_depth to follow config setting * WIP: update book with file-picker inline table notation * update documentation for file-picker config in book * adjusted to [editor.file-picker] in book configuration.md * adjust comments in editor.rs to be doc comments, cleanup * adjust comments * adjust book
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 364865d9..1ce33760 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -37,6 +37,46 @@ where
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
+pub struct FilePickerConfig {
+ /// IgnoreOptions
+ /// Enables ignoring hidden files.
+ /// Whether to hide hidden files in file picker and global search results. Defaults to true.
+ pub hidden: bool,
+ /// Enables reading ignore files from parent directories. Defaults to true.
+ pub parents: bool,
+ /// Enables reading `.ignore` files.
+ /// Whether to hide files listed in .ignore in file picker and global search results. Defaults to true.
+ pub ignore: bool,
+ /// Enables reading `.gitignore` files.
+ /// Whether to hide files listed in .gitignore in file picker and global search results. Defaults to true.
+ pub git_ignore: bool,
+ /// Enables reading global .gitignore, whose path is specified in git's config: `core.excludefile` option.
+ /// Whether to hide files listed in global .gitignore in file picker and global search results. Defaults to true.
+ pub git_global: bool,
+ /// Enables reading `.git/info/exclude` files.
+ /// Whether to hide files listed in .git/info/exclude in file picker and global search results. Defaults to true.
+ pub git_exclude: bool,
+ /// WalkBuilder options
+ /// Maximum Depth to recurse directories in file picker and global search. Defaults to `None`.
+ pub max_depth: Option<usize>,
+}
+
+impl Default for FilePickerConfig {
+ fn default() -> Self {
+ Self {
+ hidden: true,
+ parents: true,
+ ignore: true,
+ git_ignore: true,
+ git_global: true,
+ git_exclude: true,
+ max_depth: None,
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Deserialize)]
+#[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
pub struct Config {
/// Padding to keep between the edge of the screen and the cursor when scrolling. Defaults to 5.
pub scrolloff: usize,
@@ -62,6 +102,7 @@ pub struct Config {
pub completion_trigger_len: u8,
/// Whether to display infoboxes. Defaults to true.
pub auto_info: bool,
+ pub file_picker: FilePickerConfig,
}
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
@@ -93,6 +134,7 @@ impl Default for Config {
idle_timeout: Duration::from_millis(400),
completion_trigger_len: 2,
auto_info: true,
+ file_picker: FilePickerConfig::default(),
}
}
}