-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
1,764 additions
and
594 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# Configuration | ||
|
||
To override global configuration parameters create a `config.toml` file located in your config directory (i.e `~/.config/helix/config.toml`). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Key Remapping | ||
|
||
One-way key remapping is temporarily supported via a simple TOML configuration | ||
file. (More powerful solutions such as rebinding via commands will be | ||
available in the feature). | ||
|
||
To remap keys, write a `config.toml` file in your `helix` configuration | ||
directory (default `~/.config/helix` in Linux systems) with a structure like | ||
this: | ||
|
||
```toml | ||
# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select' | ||
[keys.normal] | ||
a = "move_char_left" # Maps the 'a' key to the move_char_left command | ||
w = "move_line_up" # Maps the 'w' key move_line_up | ||
C-S-esc = "select_line" # Maps Control-Shift-Escape to select_line | ||
|
||
[keys.insert] | ||
A-x = "normal_mode" # Maps Alt-X to enter normal mode | ||
``` | ||
|
||
Control, Shift and Alt modifiers are encoded respectively with the prefixes | ||
`C-`, `S-` and `A-`. Special keys are encoded as follows: | ||
|
||
* Backspace => "backspace" | ||
* Space => "space" | ||
* Return/Enter => "ret" | ||
* < => "lt" | ||
* > => "gt" | ||
* + => "plus" | ||
* - => "minus" | ||
* ; => "semicolon" | ||
* % => "percent" | ||
* Left => "left" | ||
* Right => "right" | ||
* Up => "up" | ||
* Home => "home" | ||
* End => "end" | ||
* Page Up => "pageup" | ||
* Page Down => "pagedown" | ||
* Tab => "tab" | ||
* Back Tab => "backtab" | ||
* Delete => "del" | ||
* Insert => "ins" | ||
* Null => "null" | ||
* Escape => "esc" | ||
|
||
Commands can be found in the source code at `../../helix-term/src/commands.rs` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,63 @@ | ||
use crate::Tendril; | ||
use once_cell::sync::Lazy; | ||
use std::{collections::HashMap, sync::RwLock}; | ||
|
||
// TODO: could be an instance on Editor | ||
static REGISTRY: Lazy<RwLock<HashMap<char, Vec<String>>>> = | ||
Lazy::new(|| RwLock::new(HashMap::new())); | ||
|
||
/// Read register values. | ||
pub fn get(register_name: char) -> Option<Vec<String>> { | ||
let registry = REGISTRY.read().unwrap(); | ||
registry.get(®ister_name).cloned() // TODO: no cloning | ||
use std::collections::HashMap; | ||
|
||
#[derive(Debug)] | ||
pub struct Register { | ||
name: char, | ||
values: Vec<String>, | ||
} | ||
|
||
impl Register { | ||
pub fn new(name: char) -> Self { | ||
Self { | ||
name, | ||
values: Vec::new(), | ||
} | ||
} | ||
|
||
pub fn new_with_values(name: char, values: Vec<String>) -> Self { | ||
Self { name, values } | ||
} | ||
|
||
pub fn name(&self) -> char { | ||
self.name | ||
} | ||
|
||
pub fn read(&self) -> &Vec<String> { | ||
&self.values | ||
} | ||
|
||
pub fn write(&mut self, values: Vec<String>) { | ||
self.values = values; | ||
} | ||
} | ||
|
||
/// Read register values. | ||
// restoring: bool | ||
pub fn set(register_name: char, values: Vec<String>) { | ||
let mut registry = REGISTRY.write().unwrap(); | ||
registry.insert(register_name, values); | ||
/// Currently just wraps a `HashMap` of `Register`s | ||
#[derive(Debug, Default)] | ||
pub struct Registers { | ||
inner: HashMap<char, Register>, | ||
} | ||
|
||
impl Registers { | ||
pub fn get(&self, name: char) -> Option<&Register> { | ||
self.inner.get(&name) | ||
} | ||
|
||
pub fn get_mut(&mut self, name: char) -> Option<&mut Register> { | ||
self.inner.get_mut(&name) | ||
} | ||
|
||
pub fn get_or_insert(&mut self, name: char) -> &mut Register { | ||
self.inner | ||
.entry(name) | ||
.or_insert_with(|| Register::new(name)) | ||
} | ||
|
||
pub fn write(&mut self, name: char, values: Vec<String>) { | ||
self.inner | ||
.insert(name, Register::new_with_values(name, values)); | ||
} | ||
|
||
pub fn read(&self, name: char) -> Option<&Vec<String>> { | ||
self.get(name).map(|reg| reg.read()) | ||
} | ||
} |
Submodule tree-sitter-latex
added at
7f7206
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.