mirror of
https://github.com/helix-editor/helix.git
synced 2025-10-06 16:33:17 +02:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cbb3ebafdc | ||
|
0851110d10 | ||
|
3ace581191 | ||
|
c0264b9f7f | ||
|
22dad592b8 | ||
|
67b1cd32c7 | ||
|
4d12c7c3cf | ||
|
4f56a8e248 | ||
|
dbc392d92c | ||
|
7967d312c0 | ||
|
db48d22384 | ||
|
533ff61d0e | ||
|
b1ce969d80 | ||
|
01bf363446 | ||
|
cc323f7665 | ||
|
60caaf7fc4 | ||
|
ea824ed05d | ||
|
cfae07e7ba | ||
|
56dbc60840 |
@@ -42,6 +42,14 @@ Now copy the `runtime/` directory somewhere. Helix will by default look for the
|
||||
runtime inside the same folder as the executable, but that can be overriden via
|
||||
the `HELIX_RUNTIME` environment variable.
|
||||
|
||||
> NOTE: You should set this to <path to repository>/runtime in development (if
|
||||
> running via cargo).
|
||||
|
||||
## Arch Linux
|
||||
There are two packages available from AUR:
|
||||
- `helix-bin`: contains prebuilt binary from GitHub releases
|
||||
- `helix-git`: builds the master branch of this repository
|
||||
|
||||
# Contributing
|
||||
|
||||
Contributors are very welcome! **No contribution is too small and all contributions are valued.**
|
||||
|
@@ -4,3 +4,6 @@ language = "en"
|
||||
multilingual = false
|
||||
src = "src"
|
||||
theme = "colibri"
|
||||
|
||||
[output.html]
|
||||
cname = "docs.helix-editor.com"
|
||||
|
@@ -6,10 +6,7 @@ We provide pre-built binaries on the [GitHub Releases page](https://github.com/h
|
||||
|
||||
TODO: brew tap
|
||||
|
||||
```
|
||||
$ brew tap helix-editor/helix
|
||||
$ brew install helix
|
||||
```
|
||||
Please use a pre-built binary release for the time being.
|
||||
|
||||
## Linux
|
||||
|
||||
@@ -21,7 +18,9 @@ shell for working on Helix.
|
||||
|
||||
### Arch Linux
|
||||
|
||||
A binary package is available on AUR as [helix-bin](https://aur.archlinux.org/packages/helix-bin/).
|
||||
Binary packages are available on AUR:
|
||||
- [helix-bin](https://aur.archlinux.org/packages/helix-bin/) contains the pre-built release
|
||||
- [helix-git](https://aur.archlinux.org/packages/helix-git/) builds the master branch
|
||||
|
||||
## Build from source
|
||||
|
||||
|
@@ -118,7 +118,7 @@ Jumps to various locations.
|
||||
|-----|-----------|
|
||||
| g | Go to the start of the file |
|
||||
| e | Go to the end of the file |
|
||||
| e | Go to definition |
|
||||
| d | Go to definition |
|
||||
| t | Go to type definition |
|
||||
| r | Go to references |
|
||||
| i | Go to implementation |
|
||||
|
@@ -45,7 +45,7 @@ pub fn move_vertically(
|
||||
|
||||
let new_line = match dir {
|
||||
Direction::Backward => row.saturating_sub(count),
|
||||
Direction::Forward => std::cmp::min(row.saturating_add(count), text.len_lines() - 1),
|
||||
Direction::Forward => std::cmp::min(row.saturating_add(count), text.len_lines() - 2),
|
||||
};
|
||||
|
||||
// convert to 0-indexed, subtract another 1 because len_chars() counts \n
|
||||
@@ -64,7 +64,7 @@ pub fn move_next_word_start(slice: RopeSlice, mut begin: usize, count: usize) ->
|
||||
let mut end = begin;
|
||||
|
||||
for _ in 0..count {
|
||||
if begin + 1 == slice.len_chars() {
|
||||
if begin + 2 > slice.len_chars() {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ pub fn move_next_word_end(slice: RopeSlice, mut begin: usize, count: usize) -> O
|
||||
let mut end = begin;
|
||||
|
||||
for _ in 0..count {
|
||||
if begin + 1 == slice.len_chars() {
|
||||
if begin + 2 > slice.len_chars() {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,10 @@ pub fn find_nth_next(
|
||||
n: usize,
|
||||
inclusive: bool,
|
||||
) -> Option<usize> {
|
||||
if pos >= text.len_chars() {
|
||||
return None;
|
||||
}
|
||||
|
||||
// start searching right after pos
|
||||
let mut chars = text.chars_at(pos + 1);
|
||||
|
||||
|
@@ -107,7 +107,10 @@ fn build_dir(dir: &str, language: &str) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let ignore = vec!["tree-sitter-typescript".to_string()];
|
||||
let ignore = vec![
|
||||
"tree-sitter-typescript".to_string(),
|
||||
".DS_Store".to_string(),
|
||||
];
|
||||
let dirs = collect_tree_sitter_dirs(&ignore);
|
||||
|
||||
let mut n_jobs = 0;
|
||||
|
@@ -473,10 +473,10 @@ fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
|
||||
let last_line = view.last_line(doc);
|
||||
|
||||
// clamp into viewport
|
||||
let line = cursor.row.clamp(
|
||||
view.first_line + scrolloff,
|
||||
last_line.saturating_sub(scrolloff),
|
||||
);
|
||||
let line = cursor
|
||||
.row
|
||||
.min(view.first_line + scrolloff)
|
||||
.max(last_line.saturating_sub(scrolloff));
|
||||
|
||||
let text = doc.text().slice(..);
|
||||
let pos = pos_at_coords(text, Position::new(line, cursor.col)); // this func will properly truncate to line end
|
||||
@@ -1031,6 +1031,9 @@ pub fn command_mode(cx: &mut Context) {
|
||||
}
|
||||
|
||||
let parts = input.split_ascii_whitespace().collect::<Vec<&str>>();
|
||||
if parts.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(cmd) = cmd::COMMANDS.get(parts[0]) {
|
||||
(cmd.fun)(editor, &parts[1..], event);
|
||||
|
@@ -240,10 +240,12 @@ pub fn default() -> Keymaps {
|
||||
code: KeyCode::PageUp,
|
||||
modifiers: KeyModifiers::NONE
|
||||
} => commands::page_up,
|
||||
ctrl!('b') => commands::page_up,
|
||||
KeyEvent {
|
||||
code: KeyCode::PageDown,
|
||||
modifiers: KeyModifiers::NONE
|
||||
} => commands::page_down,
|
||||
ctrl!('f') => commands::page_down,
|
||||
ctrl!('u') => commands::half_page_up,
|
||||
ctrl!('d') => commands::half_page_down,
|
||||
|
||||
|
@@ -10,9 +10,9 @@ use application::Application;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Error;
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
fn setup_logging(verbosity: u64) -> Result<(), fern::InitError> {
|
||||
fn setup_logging(verbosity: u64) -> Result<()> {
|
||||
let mut base_config = fern::Dispatch::new();
|
||||
|
||||
// Let's say we depend on something which whose "info" level messages are too
|
||||
@@ -27,7 +27,7 @@ fn setup_logging(verbosity: u64) -> Result<(), fern::InitError> {
|
||||
_3_or_more => base_config.level(log::LevelFilter::Trace),
|
||||
};
|
||||
|
||||
let home = dirs_next::home_dir().expect("can't find the home directory");
|
||||
let home = dirs_next::home_dir().context("can't find the home directory")?;
|
||||
|
||||
// Separate file config so we can include year, month and day in file logs
|
||||
let file_config = fern::Dispatch::new()
|
||||
@@ -51,7 +51,7 @@ pub struct Args {
|
||||
files: Vec<PathBuf>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
fn main() -> Result<()> {
|
||||
let help = format!(
|
||||
"\
|
||||
{} {}
|
||||
@@ -89,7 +89,7 @@ FLAGS:
|
||||
verbosity = 1;
|
||||
}
|
||||
|
||||
setup_logging(verbosity).expect("failed to initialize logging.");
|
||||
setup_logging(verbosity).context("failed to initialize logging")?;
|
||||
|
||||
let args = Args {
|
||||
files: pargs.finish().into_iter().map(|arg| arg.into()).collect(),
|
||||
@@ -105,17 +105,16 @@ FLAGS:
|
||||
.as_deref()
|
||||
.unwrap_or(include_bytes!("../../languages.toml"));
|
||||
|
||||
LOADER.get_or_init(|| {
|
||||
let config = toml::from_slice(toml).expect("Could not parse languages.toml");
|
||||
Loader::new(config)
|
||||
});
|
||||
let config = toml::from_slice(toml).context("Could not parse languages.toml")?;
|
||||
LOADER.get_or_init(|| Loader::new(config));
|
||||
|
||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||
let runtime = tokio::runtime::Runtime::new().context("unable to start tokio runtime")?;
|
||||
|
||||
// TODO: use the thread local executor to spawn the application task separately from the work pool
|
||||
let mut app = Application::new(args).context("unable to create new appliction")?;
|
||||
runtime.block_on(async move {
|
||||
let mut app = Application::new(args).unwrap();
|
||||
|
||||
app.run().await;
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user