flat assembler
Message board for the users of flat assembler.

flat assembler > Main > VIM support for FASM

Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
someone could write VIM filetype plugin for FASM. I would but i am new to VIM so best i managed is syntax highlighting script (attached).

It should be quite easy to make plugin (with folding, jump-to-definition, register/instruciton completion etc.) compared to effort you get - new vi-based FASM IDE.


Description:
Download
Filename: fasm vim.zip
Filesize: 2.79 KB
Downloaded: 725 Time(s)

Post 26 Nov 2003, 19:34
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ronware



Joined: 08 Jan 2004
Posts: 179
Location: Israel
vid wrote:
someone could write VIM filetype plugin for FASM. I would but i am new to VIM so best i managed is syntax highlighting script (attached).

It should be quite easy to make plugin (with folding, jump-to-definition, register/instruciton completion etc.) compared to effort you get - new vi-based FASM IDE.


What exactly do you want to accomplish? I am a vim "guru" by now (six years or so using it, contribute source code).

I normally just edit files and use
Code:
:!fasm %    
to compile the file. I am using the default 'asm' syntax file, but I'll take a look at yours.
Post 08 Jan 2004, 19:09
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
1. folding procedures declared with 'proc'...'return' including comments before procedure to fold. Maybe folding of paragraphs (few lines of code preceded by comment)

2. jump to defnition, CTRL + ] on symbol will jump to it's definition (including local labels, macros etc.) Of course it will not be 100% and probably limited to simple file but would come fine. Also something to open file which is argument to 'include'

3. And mainly, resolving fasm error message to list of errors what allows jumping on error inside macro(s) like in FASMW.

and of course VIM allows much more Smile
Post 08 Jan 2004, 19:27
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ronware



Joined: 08 Jan 2004
Posts: 179
Location: Israel
vid wrote:
1. folding procedures declared with 'proc'...'return' including comments before procedure to fold. Maybe folding of paragraphs (few lines of code preceded by comment)

First, try to accomplish what you want just with manual folding. So 'set fdm=manual' to start with, and then something like:

Code:
:% /proc/,/return/ fold    


To fold everything between lines containing 'proc' to 'return'.

The reason I haven't done something like this is that I don't use 'proc' and 'return' macros; so this isn't terribly useful to me.

However, you could use the 'marker' foldmethod, in which case you just insert appropriate markers in the code (":help fold-marker" for more info). In that case, you would also either want a modeline in the file to set the appropriate fold method, or have a 'filetype' plugin to set things up for all asm files.

Quote:

2. jump to defnition, CTRL + ] on symbol will jump to it's definition (including local labels, macros etc.) Of course it will not be 100% and probably limited to simple file but would come fine. Also something to open file which is argument to 'include'

Look at 'ctags' - ctags.sf.net

Quote:

3. And mainly, resolving fasm error message to list of errors what allows jumping on error inside macro(s) like in FASMW.

:help quickfix
:help make

Quote:

and of course VIM allows much more Smile

[/quote]

Indeed, it does Smile
Post 09 Jan 2004, 17:14
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
mvil



Joined: 20 Sep 2003
Posts: 4
vid wrote:
3. And mainly, resolving fasm error message to list of errors what allows jumping on error inside macro(s) like in FASMW.

I tried to do that a while back, but it seemed really hard to make vim accept fasm-style multiline error messages. Finally I just gave up and modified FASM to give errors in the same format as GCC.

If you get the errorformat working, please do post it here! Smile
thx
Post 10 Jan 2004, 13:59
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
ctags can be used with fasm?

mvil: please post your modified version of FASM
Post 11 Jan 2004, 10:52
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
mvil



Joined: 20 Sep 2003
Posts: 4
OK, the code that displays error messages is in system.inc, so here's my modified version of that file. This is only for Win32...

I have commented out lines 411,412, 429,430 and 470-472, and I've changed the strings in the bottom of the file... Not a perfect solution, but it works. Smile


Description:
Download
Filename: SYSTEM.INC.rar
Filesize: 2.51 KB
Downloaded: 563 Time(s)

Post 11 Jan 2004, 14:55
View user's profile Send private message Reply with quote
ronware



Joined: 08 Jan 2004
Posts: 179
Location: Israel
vid wrote:
ctags can be used with fasm?

Ah, no, sorry. But you could easily write a perl script or something (even ... a FASM code!) to make a tags file.

On the topic of the syntax file you uploaded, I have used it now and made some small modifications. First and most important, you should not hard-code colors in a syntax file - you should prefer to link to 'standard' syntax groups so that the 'colorscheme' settings will allow people to use colors they prefer. Second, I added that a label at the beginning of a line is highlighted as a label.

I am attaching the zipped-up version of the syntax file, v2, for your review.


Description:
Download
Filename: fasm.zip
Filesize: 2.84 KB
Downloaded: 501 Time(s)

Post 14 Jan 2004, 17:52
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
thx, but i dont like tags file way, i would more appreciate direct jumping to labels (in same file). I'll try to code similar thing later.
Post 15 Jan 2004, 19:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ronware



Joined: 08 Jan 2004
Posts: 179
Location: Israel
vid wrote:
thx, but i dont like tags file way, i would more appreciate direct jumping to labels (in same file). I'll try to code similar thing later.

Hi -

Here's an updated syntax file for vim, which I just posted to the vim-dev list for including in the vim distro. Just put the file in your runtime\syntax directory, and do :let asmsyntax='fasm'

It includes all the identifiers from FASM 1.50, using vim to process the FASM source code and suck them up.

Enjoy!


Description: FASM 1.50 syntax file for the vim editor
Download
Filename: fasmvim.zip
Filesize: 3.39 KB
Downloaded: 560 Time(s)

Post 21 Jan 2004, 06:25
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
your file is good (i haven't tested it on-run yet, i just looked at it), but i dislike few things:

1.syn keyword fasmAddressSizes byte dword word
i would rather call this fasmSizeOperator as in docs. And you missed few of them, which are in "fasmSYmbols" (tword).

2. "shr" "and" etc. are defined as fasmoperator, but they should be fasmNumericOperator.

3. fasmSpecial misses %t

4. some registers are in fasmRegister and some in fasmSymbol, they should all be in fasmRegister
Post 21 Jan 2004, 19:51
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ronware



Joined: 08 Jan 2004
Posts: 179
Location: Israel
vid wrote:
your file is good (i haven't tested it on-run yet, i just looked at it), but i dislike few things:

1.syn keyword fasmAddressSizes byte dword word
i would rather call this fasmSizeOperator as in docs. And you missed few of them, which are in "fasmSYmbols" (tword).

2. "shr" "and" etc. are defined as fasmoperator, but they should be fasmNumericOperator.

3. fasmSpecial misses %t

4. some registers are in fasmRegister and some in fasmSymbol, they should all be in fasmRegister


Hi!

The file is generated by a vim script, so I would be able to run it against any future FASM release and keep it up-to-date with very little work.

I'll look at your points and see how to incorporate them.
Post 21 Jan 2004, 19:56
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
ronware



Joined: 08 Jan 2004
Posts: 179
Location: Israel
VIM syntax file for FASM 1.51.

I swtiched to using a perl script which can be more easily tweaked. Please review and give me your feedback.


Description: Newer version for released 1.51
Download
Filename: fasmvim.zip
Filesize: 2.97 KB
Downloaded: 578 Time(s)

Description: VIM syntax for FASM 1.51b4
Download
Filename: fasmvim.zip
Filesize: 2.95 KB
Downloaded: 530 Time(s)

Post 29 Jan 2004, 00:16
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
render



Joined: 25 Jun 2010
Posts: 14
who write correctly errorformat ? I'm very need errorformat=)
errorformat=%E%f\ \[%l\]%.%#:,%Z%m,%Ierror:\ %m,%Z
is not working. Help:)
Post 20 Sep 2011, 10:07
View user's profile Send private message Reply with quote
XVilka



Joined: 04 May 2011
Posts: 42
Location: Russia
My update for vim syntax - added SSEx, AVX and AVX2 instructions.


Last edited by XVilka on 24 May 2012, 18:36; edited 1 time in total
Post 10 May 2012, 17:42
View user's profile Send private message Visit poster's website Reply with quote
gunblade



Joined: 19 Feb 2004
Posts: 209
Thanks for that - I do use vim for fasm work - and the lack of 64-bit registers especially was quite a nuissance.. Should probably push your latest version up to mainstream (maybe after adding any new instructions added by 1.70 (unless you already did but just didnt update the header comment?))
Post 11 May 2012, 10:30
View user's profile Send private message Reply with quote
randall



Joined: 03 Dec 2011
Posts: 153
Location: Poland
Thanks, I also use vim. Some directives are missing (elf64, segment, readable etc.).
Post 11 May 2012, 13:48
View user's profile Send private message Visit poster's website Reply with quote
XVilka



Joined: 04 May 2011
Posts: 42
Location: Russia
Updated comment about supported version, added missing directives and instructions (though not all instructions - need to do deep review of sse and xop commands, or write some script) - after reading fasm sources.


Description: vim fasm syntax file
Download
Filename: fasm.vim.gz
Filesize: 4.04 KB
Downloaded: 429 Time(s)



Last edited by XVilka on 24 May 2012, 18:37; edited 2 times in total
Post 12 May 2012, 16:55
View user's profile Send private message Visit poster's website Reply with quote
gunblade



Joined: 19 Feb 2004
Posts: 209
Nice job fixing it - Just one comment (and a change which I made to your file before using it..) in my opinion, "format" should be a FasmDirective, not a FasmInstr.. so that it shows up as blue as well (well, blue in my theme) - otherwise the colours for Format and ELF/Executable/MZ/PE dont match..

Thanks again
Post 14 May 2012, 15:41
View user's profile Send private message Reply with quote
neuron



Joined: 27 Jun 2013
Posts: 14
Location: Beijing, PRC
This is really helpful! Thanks =)
Post 28 Aug 2013, 11:11
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.