Compare commits

...

7 Commits

Author SHA1 Message Date
Nikita Revenco
ab68da62c2
Merge 0141aece5f into a219d5aabb 2024-11-20 16:41:21 -05:00
dependabot[bot]
a219d5aabb
build(deps): bump unicode-general-category from 0.6.0 to 1.0.0 (#12089)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-20 11:41:07 -06:00
Michael Davis
d489c03c4f helix-term: Use workspace thiserror dep 2024-11-20 11:40:45 -06:00
dependabot[bot]
f621423e7d build(deps): bump thiserror from 1.0.64 to 2.0.3
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.64 to 2.0.3.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.64...2.0.3)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-20 11:40:45 -06:00
dependabot[bot]
35802cb025
build(deps): bump which from 6.0.3 to 7.0.0 (#12090)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-20 11:40:00 -06:00
Nikita Revenco
0141aece5f feat: add docs for register / 2024-11-08 22:48:51 +00:00
Nikita Revenco
27aea00f28 feat: add register / for parent path 2024-11-08 22:43:06 +00:00
7 changed files with 91 additions and 53 deletions

114
Cargo.lock generated
View File

@ -383,7 +383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7199d965852c3bac31f779ef99cbb4537f80e952e2d6aa0ffeb30cce00f4f46e"
dependencies = [
"libc",
"thiserror",
"thiserror 1.0.69",
"winapi",
]
@ -522,7 +522,7 @@ dependencies = [
"gix-worktree",
"once_cell",
"smallvec",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -535,7 +535,7 @@ dependencies = [
"gix-date",
"gix-utils",
"itoa",
"thiserror",
"thiserror 1.0.69",
"winnow",
]
@ -552,7 +552,7 @@ dependencies = [
"gix-trace",
"kstring",
"smallvec",
"thiserror",
"thiserror 1.0.69",
"unicode-bom",
]
@ -562,7 +562,7 @@ version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f78312288bd02052be5dbc2ecbc342c9f4eb791986d86c0a5c06b92dc72efa"
dependencies = [
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -571,7 +571,7 @@ version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c28b58ba04f0c004722344390af9dbc85888fbb84be1981afb934da4114d4cf"
dependencies = [
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -597,7 +597,7 @@ dependencies = [
"gix-features",
"gix-hash",
"memmap2",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -616,7 +616,7 @@ dependencies = [
"memchr",
"once_cell",
"smallvec",
"thiserror",
"thiserror 1.0.69",
"unicode-bom",
"winnow",
]
@ -631,7 +631,7 @@ dependencies = [
"bstr",
"gix-path",
"libc",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -643,7 +643,7 @@ dependencies = [
"bstr",
"itoa",
"jiff",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -664,7 +664,7 @@ dependencies = [
"gix-traverse",
"gix-worktree",
"imara-diff",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -684,7 +684,7 @@ dependencies = [
"gix-trace",
"gix-utils",
"gix-worktree",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -700,7 +700,7 @@ dependencies = [
"gix-path",
"gix-ref",
"gix-sec",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -718,7 +718,7 @@ dependencies = [
"once_cell",
"prodash",
"sha1_smol",
"thiserror",
"thiserror 1.0.69",
"walkdir",
]
@ -740,7 +740,7 @@ dependencies = [
"gix-trace",
"gix-utils",
"smallvec",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -773,7 +773,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "952c3a29f1bc1007cc901abce7479943abfa42016db089de33d0a4fa3c85bfe8"
dependencies = [
"faster-hex",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -825,7 +825,7 @@ dependencies = [
"memmap2",
"rustix",
"smallvec",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -836,7 +836,7 @@ checksum = "5102acdf4acae2644e38dbbd18cdfba9597a218f7d85f810fe5430207e03c2de"
dependencies = [
"gix-tempfile",
"gix-utils",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -855,7 +855,7 @@ dependencies = [
"gix-validate",
"itoa",
"smallvec",
"thiserror",
"thiserror 1.0.69",
"winnow",
]
@ -877,7 +877,7 @@ dependencies = [
"gix-quote",
"parking_lot",
"tempfile",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -895,7 +895,7 @@ dependencies = [
"gix-path",
"memmap2",
"smallvec",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -907,7 +907,7 @@ dependencies = [
"bstr",
"faster-hex",
"gix-trace",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -920,7 +920,7 @@ dependencies = [
"gix-trace",
"home",
"once_cell",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -935,7 +935,7 @@ dependencies = [
"gix-config-value",
"gix-glob",
"gix-path",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -946,7 +946,7 @@ checksum = "f89f9a1525dcfd9639e282ea939f5ab0d09d93cf2b90c1fc6104f1b9582a8e49"
dependencies = [
"bstr",
"gix-utils",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -966,7 +966,7 @@ dependencies = [
"gix-utils",
"gix-validate",
"memmap2",
"thiserror",
"thiserror 1.0.69",
"winnow",
]
@ -981,7 +981,7 @@ dependencies = [
"gix-revision",
"gix-validate",
"smallvec",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -996,7 +996,7 @@ dependencies = [
"gix-hash",
"gix-object",
"gix-revwalk",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -1011,7 +1011,7 @@ dependencies = [
"gix-hashtable",
"gix-object",
"smallvec",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -1046,7 +1046,7 @@ dependencies = [
"gix-pathspec",
"gix-worktree",
"portable-atomic",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -1061,7 +1061,7 @@ dependencies = [
"gix-pathspec",
"gix-refspec",
"gix-url",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -1098,7 +1098,7 @@ dependencies = [
"gix-object",
"gix-revwalk",
"smallvec",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -1110,7 +1110,7 @@ dependencies = [
"bstr",
"gix-features",
"gix-path",
"thiserror",
"thiserror 1.0.69",
"url",
]
@ -1132,7 +1132,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e187b263461bc36cea17650141567753bc6207d036cedd1de6e81a52f277ff68"
dependencies = [
"bstr",
"thiserror",
"thiserror 1.0.69",
]
[[package]]
@ -1263,7 +1263,7 @@ dependencies = [
"log",
"serde",
"serde_json",
"thiserror",
"thiserror 2.0.3",
"tokio",
]
@ -1319,7 +1319,7 @@ dependencies = [
"serde",
"serde_json",
"slotmap",
"thiserror",
"thiserror 2.0.3",
"tokio",
"tokio-stream",
]
@ -1392,7 +1392,7 @@ dependencies = [
"smallvec",
"tempfile",
"termini",
"thiserror",
"thiserror 2.0.3",
"tokio",
"tokio-stream",
"toml",
@ -1459,7 +1459,7 @@ dependencies = [
"serde_json",
"slotmap",
"tempfile",
"thiserror",
"thiserror 2.0.3",
"tokio",
"tokio-stream",
"toml",
@ -2398,18 +2398,38 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.64"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
dependencies = [
"thiserror-impl",
"thiserror-impl 1.0.69",
]
[[package]]
name = "thiserror"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa"
dependencies = [
"thiserror-impl 2.0.3",
]
[[package]]
name = "thiserror-impl"
version = "1.0.64"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "thiserror-impl"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568"
dependencies = [
"proc-macro2",
"quote",
@ -2551,9 +2571,9 @@ checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217"
[[package]]
name = "unicode-general-category"
version = "0.6.0"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7"
checksum = "24adfe8311434967077a6adff125729161e6e4934d76f6b7c55318ac5c9246d3"
[[package]]
name = "unicode-ident"
@ -2691,9 +2711,9 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "which"
version = "6.0.3"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f"
checksum = "c9cad3279ade7346b96e38731a641d7343dd6a53d55083dd54eadfa5a1b38c6b"
dependencies = [
"either",
"home",

View File

@ -41,7 +41,7 @@ package.helix-term.opt-level = 2
tree-sitter = { version = "0.22" }
nucleo = "0.5.0"
slotmap = "1.0.7"
thiserror = "1.0"
thiserror = "2.0"
[workspace.package]
version = "24.7.0"

View File

@ -44,6 +44,7 @@ ### Special registers
| `#` | Selection indices (first selection is `1`, second is `2`, etc.) | This register is not writable |
| `.` | Contents of the current selections | This register is not writable |
| `%` | Name of the current file | This register is not writable |
| `/` | Folder which contains the current file | This register is not writable |
| `+` | Reads from the system clipboard | Joins and yanks to the system clipboard |
| `*` | Reads from the primary clipboard | Joins and yanks to the primary clipboard |

View File

@ -29,7 +29,7 @@ unicode-segmentation = "1.12"
# For now lets lock the version to avoid rendering glitches
# when installing without `--locked`
unicode-width = "=0.1.12"
unicode-general-category = "0.6"
unicode-general-category = "1.0"
slotmap.workspace = true
tree-sitter.workspace = true
once_cell = "1.20"

View File

@ -15,7 +15,7 @@ homepage.workspace = true
dunce = "1.0"
etcetera = "0.8"
ropey = { version = "1.6.1", default-features = false }
which = "6.0"
which = "7.0"
regex-cursor = "0.1.4"
bitflags = "2.6"

View File

@ -56,7 +56,7 @@ ignore = "0.4"
pulldown-cmark = { version = "0.12", default-features = false }
# file type detection
content_inspector = "0.2.4"
thiserror = "1.0"
thiserror.workspace = true
# opening URLs
open = "5.3.0"

View File

@ -63,6 +63,18 @@ pub fn read<'a>(&'a self, name: char, editor: &'a Editor) -> Option<RegisterValu
let path = doc!(editor).display_name();
Some(RegisterValues::new(iter::once(path)))
}
'/' => {
let relative_path = match doc!(editor).path() {
Some(path) => path,
None => return Some(RegisterValues::new(iter::empty())),
};
let parent = match relative_path.parent() {
Some(path) => path,
None => return Some(RegisterValues::new(iter::empty())),
};
let parent = parent.display().to_string();
Some(RegisterValues::new(iter::once(parent.into())))
}
'*' | '+' => Some(read_from_clipboard(
self.clipboard_provider.as_ref(),
self.inner.get(&name),
@ -82,7 +94,9 @@ pub fn read<'a>(&'a self, name: char, editor: &'a Editor) -> Option<RegisterValu
pub fn write(&mut self, name: char, mut values: Vec<String>) -> Result<()> {
match name {
'_' => Ok(()),
'#' | '.' | '%' => Err(anyhow::anyhow!("Register {name} does not support writing")),
'#' | '.' | '%' | '/' => {
Err(anyhow::anyhow!("Register {name} does not support writing"))
}
'*' | '+' => {
self.clipboard_provider.set_contents(
values.join(NATIVE_LINE_ENDING.as_str()),
@ -107,7 +121,9 @@ pub fn write(&mut self, name: char, mut values: Vec<String>) -> Result<()> {
pub fn push(&mut self, name: char, mut value: String) -> Result<()> {
match name {
'_' => Ok(()),
'#' | '.' | '%' => Err(anyhow::anyhow!("Register {name} does not support pushing")),
'#' | '.' | '%' | '/' => {
Err(anyhow::anyhow!("Register {name} does not support pushing"))
}
'*' | '+' => {
let clipboard_type = match name {
'+' => ClipboardType::Clipboard,
@ -164,6 +180,7 @@ pub fn iter_preview(&self) -> impl Iterator<Item = (char, &str)> {
('#', "<selection indices>"),
('.', "<selection contents>"),
('%', "<document path>"),
('/', "<parent of document path>"),
('+', "<system clipboard>"),
('*', "<primary clipboard>"),
]