/zig-helix

Installation environnement ZIG and ZLS and HELIX

Primary LanguageHTML

Helix

2023-10-24  Normally, I finished debugging all the scripts and made it flexible to use.

After a few problems... & a few scares... I switch from VSCode ide to helix-editor I need an editor, maybe less plugin..., but it does exactly what I ask it to do.

Setting up Helix, I work with Linux, you will find in your distribution how to install it.

To develop, it is better to have an installation of ZIG / ZLS, in your HOME, think about changing the version, this allows you to test more easily

https://helix-editor.com/

a) install Zig https://ziglang.org/download/  

b) install Zls LSP https://github.com/zigtools/zls

c) install lldb (pacman -S lldb) for manjaro or arch  include   lldb-vscode  recommend for Helix and ZIG

d) Look at the “enScript” folder: a module to list your source files on the printer (pacman -S enscript)

c) I provide a set of small BASH procedures (which are very simple, modifiable as desired). This will give you a lot of flexibility

d) A tool is available to you TermHx a small 23kb terminal

___________________________________________________________  

personally I put Zig in ./zig and zls in ./zls  

in .profile

add matching paths and aliases  

  export PATH=/home/soleil/.zig:$PATH  

  export PATH=/home/soleil/.zls:$PATH  

___________________________________________________________

.config/helix/  

config.toml file concerns the editor settings  

After searching and gathering the most important and cool points

I thank the various authors...  

tested and bug-free  

__________________________________________________________

mytheme.toml  

origine (dark_plus) very few modifications "|" for the indentation { }...  

a note in config.toml

I put the relationship.

theme = "mytheme"  

copy mytheme to /usr/lib/helix/runtime/themes/

__________________________________________________________

.cache/helix.config/helix

cache/helix  → Contains  helix.log  and  archiveFile.log

.config/helix →Contains  config.toml , langage.toml , mytheme.toml  

__________________________________________________________

ZIG project my architecture

Docs Print src-c library src-zig binary
Term curse Gencurs Gencurs
lib deps
decimal

 

Zterm → Contains compiled binary programs and Folders

Docs    → build-docs

Print    → Contains Docs source

src-c    → source C/C++

libray   → source zig Contains folders import

              curse   → Contains source import

              lib        → source.h  ex: link libpcre2-posix.so 

              decimal → source   import  link mpdecimal.so 

or deps   → Contains folders import

                  curse   → Contains source import

                  lib        → source.h  ex: link libpcre2-posix.so 

                  decimal → source   import  link mpdecimal.so 

src-zig → Contains source and build, folders( library, deps, lib )

 

__________________________________________________________

This is an example of an environment :

for me: using Zig-lang, I configured it and I no longer have link errors with LSP and the language is well recognized.  

Now the tools to compile and a console.  

My compilation tools are pretty much the same as VSCODE and task.  

I have a ".Terminal" folder in which the procedures are located  

I only use the terminal ex: xfce4-terminal

EnvZig.sh

compile: zig build / doc ....

 1. ClearProjet (only cache compile )

 2. Compile_Debug

 3. Compile_Prod

 4. Compile_Safe

 5. Compile_Small

 6. Compile_test

 7. Compile_Doc

The compilations are done with a build which allows a lot of flexibility and incorporates all the settings

EnvCPP.sh

compile: gcc... c/c++

1. ClearProjet

2. Compile_Debug

3. Compile_Prod

The compilations are done with a Makefile which allows a lot of flexibility and incorporates all the settings

MenuDEV.sh

        Langage-ZIG-LANG - Project:  .....

    ------------compile cpp-----------------
 1. Terminal-Gen

    ------------compile Zig-----------------
11. Gencurs

12. app/module

13. study

    ----------------------------------------
33. Debug LLDB

44. enScript Printer

55. Edit my project

66. Edit last source used

77. clear helix.log

88. Console

99. Exit

  1 → Secure terminal for a Client application

11 → ex: Code generator from a designor   

12 → Module under test for integration with Gencurs

13 → Learning the ZIG language

33 → debeugeur LLDB 

44 → List of your print-ready source files

50 → Opening Helix --default-working-directory PROJECT/library

55 → Opening Helix --default-working-directory PROJECT/src-zig

66 → Opening Helix: searches for the latest record in ".cache/helix/archiveFile.log"   

77 → cleaning the helix.log file

88 →  Opening Standard console simulation for customer application testing or other

When you are in the Helix environment:

To retrieve the latest source, you have to A-q keymap (Alt-q) please look at the config.toml please

        Path :/home/soleil/Zterm/src-zig

        q = exit
        ----------------------------------------
        Name source :  mdlRjson.zig

Archive the source: date Time path name allows you to have a follow-up and gives the possibility of opening the last source on which you were.

Recording in the ".cache/helix/archiveFile.log" example

"2023-09-25 20:54:12 file:///home/soleil/Zterm/src-zig/Gencurs.zig"

At the moment we do not have access to the file name to include directly in archiveFile etc..

_________________________________________________________

option 33 :  debugZig.sh

Pacman -S lldb    package includes  ( ldb - lldb-argdumper - lldb-instr - lldb-server - lldb-vscode )

PID ?
q = exit

The script runs in a separate window "pkexec (sudo) lldb attach PID"

   

_________________________________________________________

option: 44 enScript form source to printer

look folder enscript

        Path :/home/soleil/Zterm/

        q = exit
        ----------------------------------------

        Path source :  src-zig

        Name source :  mdlRjson.zig

        ----------------------------------------

        Paper Size  ; A4 / A3 / Letter

        Size : A3

___________________________________________________________

Coming back to the difference between VSCODE and HELIX is that I had direct action from VSCODE, because there is no integrated terminal or possibility of communication from helix and program. RUST security.

But the LSP is meaner than on vscode, so we find it.  

The learning curve is relatively uncomplicated than vim... on the other hand, you have to take the time to practice the tutorial.  

The gain: no more madness in the propagation of caches and various logs and memory extension.  

The gain: no more madness in the propagation of caches and various logs and memory extension.  

I've done quite a few tests of neovim by the way, gvim, kakoune, lite-xl, geany, codeblock, sublime, atom, builder, and a few others, I think this one is the right one, it's still missing one or two things, but not vital.

   start informatique 1976 middle systeme  

my big stops on PC since 1985

Metroworks CodeWarrior. trubo pacal etc.

codeblock, my first more than 25 years ago,

geany, has been my utility for a long time

builder, my sewing machine

vscode ......... in short, I keep it stanbye. (this was a serious advance on PC as a code editor)

more than 50 years ago IBM was 50 years ahead and the LSP was integrated but proprietary

__________________________________________________________

so HELIX is small in size, but does a good job

After working, and spending some time to find the configuration tips, "copy/paste" the most coherent theme, e.g.: brackets and adjustment of the language definition etc. It's starting to be effective

Lorenzo Sétale and Rajasegar Chandran thank-you

I'm working with "helix" and restructuring my sources, because I encounter the end of line positions and spaces are completely inconsistent. 

We can't really do without visualizing spaces, and colors can quickly become inconsistent and unpleasant. 

  • I think that there, I will stabilize. helix --health zig Configured language server: zls Binary for language server: /home/soleil/.zls/zls Configured debug adapter: lldb-vscode Binary for debug adapter: /usr/bin/lldb-vscode Highlight queries: ✓ Textobject queries: ✓ Indent queries: ✓

 

2023-09-22  Testing

  • new mytheme  : comes from  dark_plus > vscode
  • update langage.toml and config.toml There is very little action on the settings already in place, so let it be and opt for the minimum authorized (less inconsistency with Hélix)
  • During an update of VSCODE, the settings changed and my source files became a real hassle. You can resume, with for example "mousepad" a word processor where all the characters are displayed and change the points to tabulation etc. Be careful, you have to go there with little slippers.
  • The debug mode with HELIX is experimental, it does not work completely, for example, we do not obtain the value of the variables in the submodules in a clear way. With the LLDB program you have a complete mode, lldb-vscode is a derivative of lldb But it's strictly the same with VSCODE.      lldb: it is possible to use GUI order  (tui) to have an overview     Point at objects etc... in console mode and follow step by step
  • Saving the name of your current work with "Alt-q" removing "file:///home…" the ABSOLUTE PATH ONLY  “file:/home…”
  • 2023-10-20  important possibility:
Consideration of a mini Terminal based on the VTE3 library.
More security (no "close" button) only ALT-F4 or normal closing of the "Helix" editor.
Very light. TermHx 8mo actif
Font "Noto Sans Mono".
We obtain the same rendering as "xfce4-terminal".
Possibility of having several working sessions (attention LSP will suffer).
No more keys to configure in the terminal
All keyboard keys are available. Except Alt-F4
  • For those who want to keep the traditional terminal system: bash_lastFile.sh and bash_myProject.sh.
  • the terminal is located in the src-c folder TermHX.cpp and the Makefile
  • modification     config.toml  “auto-save”.  Example, you want to compile by changing the window focus automatically, saving your source is done. "auto-signature-help" = false.   LSP is still in development, the overhead is painful. (idem avec VSCODE)  #bufferline = "multiple", Easier to get started. With multiwindowing, buffers etc.
  • 2023-10-24                        helix dissociation and menu_dev (real session)  more HELIX scratch session                     compilation menu test -ZIG with errors returning     /    the size and movement of the binary in the main directory                     Cleaning the cache/out directory                                          How to name your sources                      source = name.zig                     buildefile = buildname.zig
ex: option 2 debug
Compile_Debug
+ zig build --build-file /home/soleil/Zterm/src-zig/buildExemple.zig
BUILD DEBUG     Exemple.zig  ->  /home/soleil/Zterm/Exemple   size : 2,6M
Press[Enter] key to continue


ex option 7 doc
Compile_Doc
+ zig build docs --build-file /home/soleil/Zterm/src-zig/buildExemple.zig
/home/soleil/Zterm/src-zig/Docs_Exemple
BUILD DOCS     Exemple.zig  ->  Docs_Exemple 
Press[Enter] key to continue

an example buildExemple.zig



I am at the same level (VSCODE) code editor with more flexibility and security 

  • tip: when you study.  if you need a copy and paste from an external source make a source  ex: A_copy.zig in your HELIX session with your program made vnew spacebar F choose A_copy go to https://zigbyexample.github.io/  copy a source then open A_copy (mousepad or other) copy again (paste) on your reload session etc... It looks complicated, but it actually goes very quickly
  • 2023-12-04. update lastfile.zig if the file does not exist in the project return
  • 2023-12-26 add folder TerminalHX terminal vte gtk3 for Helix
  • 2023-12-26 delete message nohup from option 55/66 menu-dev
  • 2023-12-28 out of service CTRL-Z with the "vte" terminal "TermHX"






  • 2024-02-25 Adjustment of procedures, an "example" file will help you implement. The TermilaHX folder will allow you to have a VTE3 terminal freed from all keys except ALT-F4 and CTRL-Z by default.




astuce:

I have provided you with two files as examples to make your life easier:
a) compile_zig_exemple, which displays the menu for compilation.
b) menu_Dev_exemple, which displays the general menu.

In the ./config/helix/ directory, I have added a few lines that simplify things.

[keys.normal."+"]
a = ":sh xfce4-terminal --hide-menubar --hide-scrollbar --hide-toolbar --title='General-Menu...' -x ../MenuDEV.sh && exit"
b = ":sh xfce4-terminal --hide-menubar --hide-scrollbar --hide-toolbar --title='Compile-Gencurs' -x ../Compile_Zig.sh 'Gencurs' && exit"
// Example: Specification for the 'Gencurs' project

c = ":sh xfce4-terminal --hide-menubar --hide-scrollbar ---hide-toolbar --title='Compile-Example' -x ../Compile_Zig.sh 'Example' && exit"
q = ":sh xfce4-terminal --hide-menubar --hide-scrollbar --hide-toolbar --title='Save.Memory(66)' -x $HOME/.Terminal/copyZig.sh && exit"
t = ":sh $HOME/.Terminal/console.sh && exit"

which allows you to envy nothing of VSCODE anymore.

  • 2024-02-17 Adjustment of procedures
    Introduction of the concept of "library"
    Improved support for a project

Today, I prefer compiling the "Helix" project because it allows me the opportunity to hack the "KEYMAP" file (...helix/helix-term/src/keymap/default.rs). I have removed a good number of commands to keep only the essential ones.
I reverted to using the basic setup for "ZIG" and adopted the "dark_plus.toml" theme.
I added to the "thermHX" program in "C/C++" the prohibition of CRT-Z, which suspends and clears the terminal by default.


* 2024-03-18 Adjustment of procedures

prerequis:
first compile helix:

cd $HOME
git clone https://github.com/helix-editor/helix

cd helix


cargo install --path helix-term --locked


cp contrib/Helix.desktop ~/.local/share/applications

creer dossier /.local/share/icons
cp contrib/helix.png  ~/.local/share/icons

my keyamp ~/.config/helix/default.rs

simple usuel


clean config.toml add MgetZig.sh MgetZls.sh MgetHelix.sh

change keymap:
I left all the menus as they were
"mode normal only":

    "del" => delete_char_forward,
    "up" => move_visual_line_up,
    "down" => move_visual_line_down,
    "left" => move_char_left,
    "right" => move_char_right,
    "pageup" => page_up,
    "pagedown" => page_down,
    "home" => goto_line_start,
    "end" => goto_line_end_newline,
    "ret" => insert_newline,

    ":" => command_mode,

    "i" => insert_mode,

    "o" => open_below,
    "O" => open_above,


    "A-d" => delete_selection,

    "A-c" => change_selection,



    "s" => select_regex,
    

    "C-s" => split_selection,



    "%" => select_all,
    "x" => extend_line_below,
    "X" => extend_line_above,

    "/" => search,
    "?" => rsearch,
    "n" => search_next,
    "N" => search_prev,
    "*" => search_selection,

    "u" => undo,
    "U" => redo,


    "y" => yank,
    "r" => replace_with_yanked,

    "c" => toggle_comments,


    "Q" => record_macro,
    "q" => replay_macro,

    ">" => indent,
    "<" => unindent,

    "A-," => remove_primary_selection,


    "h" => hover,

    "esc" => normal_mode,

"mode insert only":

    "esc" => normal_mode,
    "tab" => insert_tab,
    "S-tab" => unindent,
    "del" => delete_char_forward,
    "backspace" => delete_char_backward,
    "up" => move_visual_line_up,
    "down" => move_visual_line_down,
    "left" => move_char_left,
    "right" => move_char_right,
    "pageup" => page_up,
    "pagedown" => page_down,
    "home" => goto_line_start,
    "end" => goto_line_end_newline,
    "ret" => insert_newline,

"mode merge only":

    "n" => extend_search_next,
    "N" => extend_search_prev,



    "home" => extend_to_line_start,
    "end" => extend_to_line_end,
    "esc" => normal_mode,

  • 2024-03-21 mineur update option clear => EnvZig / EnvLibZig / MgetHelix

  • 2024-03-29 mineur update option clear => Mctrl-Zig-Zls.sh MgetZig.sh MgetZls.sh I anticipated the possibility of a level error between Zig and Zls... Please use Mctrl-Zig-Zls.sh

  • 2024-03-31 folder icons for zig to linux

  • 2024-04-18 update config.toml

  • 2024-07-15 update change exf4-terminal gnome-terminal

  • 2024-07-15 update EnvlibZig.sh EnvZig.sh