Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/expansion.rs')
-rw-r--r--helix-view/src/expansion.rs39
1 files changed, 0 insertions, 39 deletions
diff --git a/helix-view/src/expansion.rs b/helix-view/src/expansion.rs
index 6a41ae43..99baf4bf 100644
--- a/helix-view/src/expansion.rs
+++ b/helix-view/src/expansion.rs
@@ -33,18 +33,10 @@ pub enum Variable {
BufferName,
/// A string containing the line-ending of the currently focused document.
LineEnding,
- /// Curreng working directory
- CurrentWorkingDirectory,
- /// Nearest ancestor directory of the current working directory that contains `.git`, `.svn`, `jj` or `.helix`
- WorkspaceDirectory,
// The name of current buffers language as set in `languages.toml`
Language,
// Primary selection
Selection,
- // The one-indexed line number of the start of the primary selection in the currently focused document.
- SelectionLineStart,
- // The one-indexed line number of the end of the primary selection in the currently focused document.
- SelectionLineEnd,
}
impl Variable {
@@ -53,12 +45,8 @@ impl Variable {
Self::CursorColumn,
Self::BufferName,
Self::LineEnding,
- Self::CurrentWorkingDirectory,
- Self::WorkspaceDirectory,
Self::Language,
Self::Selection,
- Self::SelectionLineStart,
- Self::SelectionLineEnd,
];
pub const fn as_str(&self) -> &'static str {
@@ -67,12 +55,8 @@ impl Variable {
Self::CursorColumn => "cursor_column",
Self::BufferName => "buffer_name",
Self::LineEnding => "line_ending",
- Self::CurrentWorkingDirectory => "current_working_directory",
- Self::WorkspaceDirectory => "workspace_directory",
Self::Language => "language",
Self::Selection => "selection",
- Self::SelectionLineStart => "selection_line_start",
- Self::SelectionLineEnd => "selection_line_end",
}
}
@@ -82,12 +66,8 @@ impl Variable {
"cursor_column" => Some(Self::CursorColumn),
"buffer_name" => Some(Self::BufferName),
"line_ending" => Some(Self::LineEnding),
- "workspace_directory" => Some(Self::WorkspaceDirectory),
- "current_working_directory" => Some(Self::CurrentWorkingDirectory),
"language" => Some(Self::Language),
"selection" => Some(Self::Selection),
- "selection_line_start" => Some(Self::SelectionLineStart),
- "selection_line_end" => Some(Self::SelectionLineEnd),
_ => None,
}
}
@@ -245,17 +225,6 @@ fn expand_variable(editor: &Editor, variable: Variable) -> Result<Cow<'static, s
}
}
Variable::LineEnding => Ok(Cow::Borrowed(doc.line_ending.as_str())),
- Variable::CurrentWorkingDirectory => Ok(std::borrow::Cow::Owned(
- helix_stdx::env::current_working_dir()
- .to_string_lossy()
- .to_string(),
- )),
- Variable::WorkspaceDirectory => Ok(std::borrow::Cow::Owned(
- helix_loader::find_workspace()
- .0
- .to_string_lossy()
- .to_string(),
- )),
Variable::Language => Ok(match doc.language_name() {
Some(lang) => Cow::Owned(lang.to_owned()),
None => Cow::Borrowed("text"),
@@ -263,13 +232,5 @@ fn expand_variable(editor: &Editor, variable: Variable) -> Result<Cow<'static, s
Variable::Selection => Ok(Cow::Owned(
doc.selection(view.id).primary().fragment(text).to_string(),
)),
- Variable::SelectionLineStart => {
- let start_line = doc.selection(view.id).primary().line_range(text).0;
- Ok(Cow::Owned((start_line + 1).to_string()))
- }
- Variable::SelectionLineEnd => {
- let end_line = doc.selection(view.id).primary().line_range(text).1;
- Ok(Cow::Owned((end_line + 1).to_string()))
- }
}
}