Highlighting mode for emacs and vim
Moderators: cyao, michael_borland
-
- Posts: 76
- Joined: 29 Oct 2021, 10:41
Highlighting mode for emacs and vim
Dear all,
I have created a highlighting mode for Elegant .ele (commands) and .lte (lattice) files to help myself with file edition.
I leave them here in case they are of any use for someone else.
VIM
https://github.com/orblancog/elegant-vim
EMACS
https://github.com/orblancog/elegant-mode
Best regards,
o
I have created a highlighting mode for Elegant .ele (commands) and .lte (lattice) files to help myself with file edition.
I leave them here in case they are of any use for someone else.
VIM
https://github.com/orblancog/elegant-vim
EMACS
https://github.com/orblancog/elegant-mode
Best regards,
o
- Attachments
-
- elegant.vim.txt
- (9.79 KiB) Downloaded 283 times
-
- elegant.el.txt
- (23.37 KiB) Downloaded 264 times
-
- Posts: 1951
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Highlighting mode for emacs and vim
Thanks, those are useful.
I'm thinking about how we can generate these automatically when elegant is updated. Also, if there's a way to inform emacs or vi about the parameters available for each element or namelist, that would be even better.
--Michael
I'm thinking about how we can generate these automatically when elegant is updated. Also, if there's a way to inform emacs or vi about the parameters available for each element or namelist, that would be even better.
--Michael
-
- Posts: 76
- Joined: 29 Oct 2021, 10:41
Re: Highlighting mode for emacs and vim
Dear Michael,
great to here it is of any help for someone else.
The highlighting file, as it is now, could be easily generated automatically having as input the list of words that could be read by a string editor, ( maybe awk to be sure it runs on any platform, or, emacs-lisp or Julia to contribute with the usage of high performace codes ). For this first release of the highlighting files I have done it manually, which also forces me to learn few things about Elegant on the process.
If I am to include the parameters available for each element to achieve something like auto-completion I'm sure it will be better to use a library ... I'll have a look in february.
Best regards,
o
great to here it is of any help for someone else.
The highlighting file, as it is now, could be easily generated automatically having as input the list of words that could be read by a string editor, ( maybe awk to be sure it runs on any platform, or, emacs-lisp or Julia to contribute with the usage of high performace codes ). For this first release of the highlighting files I have done it manually, which also forces me to learn few things about Elegant on the process.
If I am to include the parameters available for each element to achieve something like auto-completion I'm sure it will be better to use a library ... I'll have a look in february.
Best regards,
o
-
- Posts: 76
- Joined: 29 Oct 2021, 10:41
Re: Highlighting mode for emacs and vim
Dear Michael, dear all,
I have a solution for the autocompletion in vim, at the moment only using vimscripting in VIM 8.2 so it should be compatible with other vim versions.
I show how to use it in https://github.com/orblancog/elegant-vim/, however, I leave here V0.3.
USAGE
a) To autocomplete commands, type in vim while in insert mode :
it will display a list of available commands. One could also autocomplete a partially written command name, e.g.
which shows a smaller list of matching command names.
b) To autocomplete parameters, type in vim while in insert mode :
it will display a list of available parameters for the closest command starting with &.
INSTALLATION:
It is a painful manual installation of 4 files and edition of one more, be patient and from a terminal copy the following files in the following folders :
If any of the folders does not exist, you must create it.
Last, add to your ~/.vimrc file
Sorry for the incovinience, I will check for any other installation method.
Best regards, and let me know of any problems.
Over the time I will add the element parameters, it will go slowly as there are a lot.
I have a solution for the autocompletion in vim, at the moment only using vimscripting in VIM 8.2 so it should be compatible with other vim versions.
I show how to use it in https://github.com/orblancog/elegant-vim/, however, I leave here V0.3.
USAGE
a) To autocomplete commands, type in vim while in insert mode :
Code: Select all
& CTRL+X CTRL+o
Code: Select all
&tune CTRL+X CTRL+o
b) To autocomplete parameters, type in vim while in insert mode :
Code: Select all
CTRL+X CTRL+u
INSTALLATION:
It is a painful manual installation of 4 files and edition of one more, be patient and from a terminal copy the following files in the following folders :
Code: Select all
cd ~/.vim/syntax/
wget https://raw.githubusercontent.com/orblancog/elegant-vim/main/syntax/elegant.vim
cd ~/.vim/ftdetect/
wget https://raw.githubusercontent.com/orblancog/elegant-vim/main/ftdetect/elegant.vim
cd ~/.vim/autoload/
wget https://raw.githubusercontent.com/orblancog/elegant-vim/main/autoload/elegantcomplete.vim
cd ~/.vim/after/plugin/
wget https://raw.githubusercontent.com/orblancog/elegant-vim/main/after/plugin/elegant.vim
Last, add to your ~/.vimrc file
Code: Select all
syntax on
set omnifunc=syntaxcomplete#Complete
Sorry for the incovinience, I will check for any other installation method.
Best regards, and let me know of any problems.
Over the time I will add the element parameters, it will go slowly as there are a lot.
- Attachments
-
- elegant-vim-v0.3.zip
- vim autocompletion v0.3
- (109.43 KiB) Downloaded 255 times
-
- Posts: 1951
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Highlighting mode for emacs and vim
Thanks for the update.
We'll look into how we can generate the configuration automatically from the code, using your files as a template. That should also allow us to install everything when the code is installed.
--Michael
We'll look into how we can generate the configuration automatically from the code, using your files as a template. That should also allow us to install everything when the code is installed.
--Michael
-
- Posts: 76
- Joined: 29 Oct 2021, 10:41
Re: Highlighting mode for emacs and vim
great !
o
o
Re: Highlighting mode for emacs and vim
I have a script that searches the code for the highlightable elements and commands and updates the configuration files you made. The resulting files will be in the elegant/editors/ directory with the next release with instructions on how to install them for emacs and vim.
-
- Posts: 76
- Joined: 29 Oct 2021, 10:41
Re: Highlighting mode for emacs and vim
Dear all,
a colleague of mine uses the text editor nano,
https://www.nano-editor.org/
so, I created a minimal syntax highlighting that I would like to share. The syntax file is attached to this message.
Instructions :
1) Download it and remove the '.txt' from the name
2) Copy elegant.nanorc to ~/.nano/
3) Create a file ~/.nanorc with the following line
I leave also the link to my repository in github:
https://github.com/orblancog/elegant-nano
best regards,
o
a colleague of mine uses the text editor nano,
https://www.nano-editor.org/
so, I created a minimal syntax highlighting that I would like to share. The syntax file is attached to this message.
Instructions :
1) Download it and remove the '.txt' from the name
2) Copy elegant.nanorc to ~/.nano/
3) Create a file ~/.nanorc with the following line
Code: Select all
include "~/.nano/elegant.nanorc"
https://github.com/orblancog/elegant-nano
best regards,
o
- Attachments
-
- elegant.nanorc.txt
- (7.26 KiB) Downloaded 185 times
-
- Posts: 1951
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Highlighting mode for emacs and vim
Thanks for posting this.
--Michael
--Michael
-
- Posts: 76
- Joined: 29 Oct 2021, 10:41
Re: Highlighting mode for emacs and vim
New colleagues prefer to edit files in gedit.
I have created a first version of the gedit elegant syntax highlight to make comments and commands easy to see.
I attach to this message the syntax file.
To install it, check your gtksource version, download the elegant.lang.txt file and remove the ".txt" at the end :
put in ~/.local/share/gtksourceview-2.0/language-specs/elegant.lang
or in ~/.local/share/gtksourceview-3.0/language-specs/elegant.lang
Best regards,
o
I have created a first version of the gedit elegant syntax highlight to make comments and commands easy to see.
I attach to this message the syntax file.
To install it, check your gtksource version, download the elegant.lang.txt file and remove the ".txt" at the end :
put in ~/.local/share/gtksourceview-2.0/language-specs/elegant.lang
or in ~/.local/share/gtksourceview-3.0/language-specs/elegant.lang
Best regards,
o
- Attachments
-
- elegant.lang.txt
- (4.8 KiB) Downloaded 167 times