Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helix editor for Bevy #232

Open
nixon-voxell opened this issue Sep 28, 2023 · 4 comments
Open

Helix editor for Bevy #232

nixon-voxell opened this issue Sep 28, 2023 · 4 comments
Labels
1- needs research I need to learn more about this topic first, before writing/accepting content for the book C-enhancement New content that isn't covered already S-setup Dev tools / Environment Setup Z-medium medium task that needs moderate time investment

Comments

@nixon-voxell
Copy link

for the editor part, I find Helix to be quite suitable for bevy workflow. Hopefully someone can add something about it. I can help contribute too if needed.

@inodentry
Copy link
Contributor

Yes. I know nothing about it. If you have useful tips/instructions/info, please provide them here.

So far, in the book, I have only created empty/placeholder pages for the most popular editors (like Vim/Emacs) even though I know nothing about them, to hopefully encourage ppl to provide me with some content to add there. Kakoune is the editor I use, so there is a page for it, where I share my setup. Jetbrains and VSCode are there, because other people have submitted some useful stuff for me to put on the page.

If you want a page for Helix to be created, please provide content for it. This is a more niche editor, so I am not going to create a blank page like I did for Vim/Emacs.

@inodentry inodentry added C-enhancement New content that isn't covered already S-setup Dev tools / Environment Setup Z-medium medium task that needs moderate time investment 1- needs research I need to learn more about this topic first, before writing/accepting content for the book labels Oct 2, 2023
@nixon-voxell
Copy link
Author

Okay haha. Actually Helix is a battery included editor. Which means only very little setup is needed haha.

@Jedsek
Copy link

Jedsek commented Nov 5, 2023

@inodentry Oh, helix is ​​an very easy-to-use editor, similar to kakoune and highly inspired by it, written in pure rust, which is 26k stars now.
You could just put the homepage:https://helix-editor.com/, and installation of lsp: rustup component add rust-analyzer.
Then everything is set up, including syntax highlighting/lsp/keybindings

图片
图片

Personally recommended configuration (version: 23.10):

  • ~/.config/helix/config.toml:
### Theme: Compared to onedark, I prefer zed_onedark
theme = "zed_onedark"
# theme = "nord"
# theme = "catppuccin_frappe"
# theme = "catppuccin_macchiato"
# theme = "catppuccin_mocha"

[editor]
# shell = ["nu", "-c"]
line-number = "relative"
scrolloff = 8
idle-timeout = 0
completion-trigger-len = 2
color-modes = true
bufferline = "multiple"
cursorline = true
cursorcolumn = false
auto-save = true
auto-pairs = true
auto-format = true

[editor.lsp]
display-messages = true
display-inlay-hints = true

[editor.soft-wrap]
enable = true

[editor.cursor-shape]
insert = "bar"
normal = "block"

[editor.statusline]
mode.normal = "NORMAL"
mode.insert = "INSERT"
mode.select = "SELECT"
separator = "=>"
left = ["mode", "spacer", "separator", "file-type", "read-only-indicator", "spinner"]
center = ["file-modification-indicator", "file-name", "diagnostics", "workspace-diagnostics"]
right = ["position", "separator", "spacer", "position-percentage", "spacer", "separator", "total-line-numbers"]


[editor.gutters.line-numbers]
min-width = 0

[editor.indent-guides]
render = true
skip-levels = 0

[editor.whitespace.render]
space = "none"
tab = "none"
newline = "none"

[editor.whitespace.characters]
space = "·"
nbsp = ""
tab = ""
newline = ""
tabpad = "·" # Tabs will look like "→···" (depending on tab width)

[editor.smart-tab]
enable = true
  • ~/.config/helix/languages.toml:
[[language]]
name = "rust"
auto-format = true

[language-server.rust-analyzer.config.check]
command = "clippy"

Feel free to use or just ignore what I said above.

@YoungHaKim7
Copy link

YoungHaKim7 commented Jun 19, 2024

my vim key setting(helix) config.toml

theme = "fleet_dark"

[editor]
line-number = "relative"
mouse = false
color-modes = true
cursorline = true
auto-pairs = true
true-color = true
scroll-lines = 5
idle-timeout = 50
completion-trigger-len = 1

[editor.indent-guides]
render = true
character = ""

[editor.lsp]
display-messages = true
# inlay hint #  :set lsp.display-inlay-hints false
display-inlay-hints = true

[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"

[editor.statusline]
left = ["mode", "spinner", "file-name", "file-type", "total-line-numbers", "file-encoding"]
center = []
right = ["selections", "primary-selection-length", "position", "position-percentage", "spacer", "diagnostics", "workspace-diagnostics", "version-control"]


[editor.file-picker]
hidden = false

# Key Setting

# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
[keys.normal]
a = ["append_mode", "collapse_selection"]
# w = "move_line_up" # Maps the 'w' key move_line_up
g = { a = "code_action" } # Maps `ga` to show possible code actions
C-a = "increment"
C-x = "decrement"
"backspace" = { c = ":sh cargo run", t =":sh cargo nextest run", r = ":reload", f = ":format", s = ":w", l = ":log-open", g = ":sh gcc -pthread -lm -Wall -Wextra -ggdb -o main main.c", d =":sh rm -rf main main.dSYM", n = ":sh touch .gitignore", k = ":sh clang++ -Wall -Wetra -std=c++17 main.cpp -o main", a = ":sh clang -pthread -lm -Wall -Wextra -ggdb -o main main.c", x = ":sh chmod +x build.sh"}  

space.c = "toggle_comments"
space.w.h = "jump_view_left"
space.w.l = "jump_view_right"
space.w.j = "jump_view_down"
space.w.k = "jump_view_up"
space.w.o = "hsplit"
space.w.v = "vsplit"

o = ["open_below", "insert_mode"]
O = ["open_above", "insert_mode"]


# Muscle memory
"{" = ["goto_prev_paragraph", "collapse_selection"]
"}" = ["goto_next_paragraph", "collapse_selection"]
0 = "goto_line_start"
"$" = "goto_line_end"
"^" = "goto_first_nonwhitespace"
G = "goto_file_end"
"%" = "match_brackets"
V = ["select_mode", "extend_to_line_bounds"]
C = ["collapse_selection", "extend_to_line_end", "change_selection"] # Requires https://github.com/helix-editor/helix/issues/2051#issuecomment-1140358950
D = ["extend_to_line_end", "delete_selection"]
S = ["goto_first_nonwhitespace", "collapse_selection", "extend_to_line_end", "change_selection"] # Would be nice to be able to do something after this but it isn't chainable
s = ["delete_selection", "insert_mode"]
X = ["move_char_left", "delete_selection"]

# Extend and select commands that expect a manual input can't be chained
# I've kept d[X] commands here because it's better to at least have the stuff you want to delete
# selected so that it's just a keystroke away to delete
d = { x = ["delete_selection"], d = ["extend_to_line_bounds", "delete_selection"], t = ["extend_till_char"], S = ["surround_add"], s = ["surround_delete"], i = ["select_textobject_inner"], a = ["select_textobject_around"] }

# Clipboards over registers ye ye
x = ["yank_main_selection_to_clipboard", "normal_mode", "flip_selections", "collapse_selection", "delete_selection"]
p = "paste_clipboard_after"
P = "paste_clipboard_before"
# Would be nice to add ya and yi, but the surround commands can't be chained
y = ["yank_main_selection_to_clipboard", "normal_mode", "flip_selections", "collapse_selection"]
Y = ["extend_to_line_bounds", "yank_main_selection_to_clipboard", "goto_line_start", "collapse_selection"]

# Uncanny valley stuff, this makes w and b behave as they do Vim
w = ["move_next_word_start", "move_char_right", "collapse_selection"]
e = ["move_next_word_end", "collapse_selection"]
b = ["move_prev_word_start", "collapse_selection"]


[keys.insert]
j = { k = "normal_mode", space = "extend_line" } # Maps `jk` to exit insert mode

[keys.select]
# Muscle memory
"{" = ["extend_to_line_bounds", "goto_prev_paragraph"]
"}" = ["extend_to_line_bounds", "goto_next_paragraph"]
0 = "goto_line_start"
"$" = "goto_line_end"
"^" = "goto_first_nonwhitespace"
G = "goto_file_end"
D = ["extend_to_line_bounds", "delete_selection", "normal_mode"]
C = ["goto_line_start", "extend_to_line_bounds", "change_selection"]
"%" = "match_brackets"
# S = "surround_add" # Basically 99% of what I use vim-surround for

# Visual-mode specific muscle memory
i = "select_textobject_inner"
a = "select_textobject_around"
# x = "delete_selection"

# Some extra binds to allow us to insert/append in select mode because it's nice with multiple cursors
tab = ["insert_mode", "collapse_selection"] # tab is read by most terminal editors as "C-i"
# C-a = ["append_mode", "collapse_selection"]

# Make selecting lines in visual mode behave sensibly
k = ["extend_line_up", "extend_to_line_bounds"]
j = ["extend_line_down", "extend_to_line_bounds"]

# Clipboards over registers ye ye
d = ["yank_main_selection_to_clipboard", "delete_selection"]
x = ["delete_selection"]
y = ["yank_main_selection_to_clipboard", "normal_mode", "flip_selections", "collapse_selection"]
Y = ["extend_to_line_bounds", "yank_main_selection_to_clipboard", "goto_line_start", "collapse_selection", "normal_mode"]
p = "replace_selections_with_clipboard" # No life without this
P = "paste_clipboard_before"

# Escape the madness! No more fighting with the cursor! Or with multiple cursors!
esc = ["collapse_selection", "keep_primary_selection", "normal_mode"]

YoungHaKim7 added a commit to YoungHaKim7/my_Contributions that referenced this issue Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1- needs research I need to learn more about this topic first, before writing/accepting content for the book C-enhancement New content that isn't covered already S-setup Dev tools / Environment Setup Z-medium medium task that needs moderate time investment
Projects
None yet
Development

No branches or pull requests

4 participants