mirror of
https://github.com/helix-editor/helix.git
synced 2024-09-11 10:55:45 +03:00
using rust builtin extension function for %{ext}
This commit is contained in:
parent
b5cae57b1e
commit
e774706440
@ -74,15 +74,12 @@ pub fn expand_variable_in_string<'a>(&self, input: &'a str) -> anyhow::Result<Co
|
||||
+ 1)
|
||||
.to_string(),
|
||||
"lang" => doc.language_name().unwrap_or("text").to_string(),
|
||||
"ext" => match doc.relative_path() {
|
||||
Some(path) => path
|
||||
.to_string_lossy()
|
||||
.split(".")
|
||||
.last()
|
||||
.unwrap_or("")
|
||||
.to_string(),
|
||||
_ => "".to_string(),
|
||||
},
|
||||
"ext" => doc
|
||||
.relative_path()
|
||||
.and_then(|p| {
|
||||
p.extension()?.to_os_string().into_string().ok()
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
"selection" => doc
|
||||
.selection(view.id)
|
||||
.primary()
|
||||
|
Loading…
Reference in New Issue
Block a user