Raised This Month: $ Target: $400
 0% 

gVim Syntax Hilighting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
naris
AlliedModders Donor
Join Date: Dec 2006
Old 12-31-2007 , 13:56   gVim Syntax Hilighting
Reply With Quote #1

I derived a syntax hilighting settings file for vim from ones from other editors I found here.

Just unzip the vimfiles zipfile into vim's root directory to place the appropriate files into the vimfiles directory. For some reason I also had to add the ftdetect lines into vim's filetype.vim file to get it to work.
Attached Files
File Type: zip vimfiles.zip (6.0 KB, 609 views)
naris is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 12-11-2008 , 20:40   Re: gVim Syntax Hilighting
Reply With Quote #2

Forgive the necromancy, but this is great for vim users.

Non-Windows, non-root users will want to unzip this to their ~/.vim directory but get rid of the vimfiles directory so that syntax and ftdetect are directly in ~/.vim. They'll also want to change ftdetect/sourcepawn.vim and replace "setf sourcepawn" with "set filetype=sourcepawn". This will override any default file types set for *.sp and *.inc files (my vim by default thinks they're "spice" and PHP inc files). setf will only set the type if there isn't one set already.

Have you updated your syntax file to contain newer SourcePawn natives, by any chance?
Fyren is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 01-04-2009 , 23:47   Re: gVim Syntax Hilighting
Reply With Quote #3

I wrote a Perl script that scrapes (I'm hesitant to say parses, heh) the .inc files to generate part of the syntax file. It just finds all the function names, defines, and so on and then wraps it with the stuff in naris' syntax file (minus the old functions, etc.).

I've attached the script plus the output from it when run over the includes from 1.2 off the respository as of now. I renamed them so that the forum would let me attach them without zipping.
Attached Files
File Type: log vim.pl.log (14.4 KB, 382 views)
File Type: log sourcepawn.vim.log (49.7 KB, 377 views)

Last edited by Fyren; 01-04-2009 at 23:57. Reason: reattached right files
Fyren is offline
Downtown1
Veteran Member
Join Date: Mar 2004
Old 01-06-2009 , 02:01   Re: gVim Syntax Hilighting
Reply With Quote #4

Hmmm, maybe we can get some binds to use the compiler from inside vim too?
Downtown1 is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 01-06-2009 , 19:03   Re: gVim Syntax Hilighting
Reply With Quote #5

Quote:
Originally Posted by Downtown1 View Post
Hmmm, maybe we can get some binds to use the compiler from inside vim too?
I added this to my syntax file:
Code:
set makeprg=/path/to/spcomp\ %
set errorformat=%f\(%l\)\ :\ fatal\ %t%*[^0-9]%n:\ %m,%f\(%l\)\ :\ %t%*[^0-9]%n:\ %m
Of course, change the path. Leave the "\ %" on the end. You can put it anywhere in the syntax file, so if you've got vim set up to automatically set the syntax when you open an .sp file, it'll set makeprg and the error format.

Then you can do :make and it'll compile it and use the built in quickfix stuff for pointing out errors. (:help quickfix) You can bind a key yourself to do :make if you want. This works for me and I don't see why it wouldn't work for others, but I haven't tested except on my Linux system.
Fyren is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 01-16-2009 , 02:41   Re: gVim Syntax Hilighting
Reply With Quote #6

Updated the script to catch some things it missed before. Again, named it .log so I could attach.
Attached Files
File Type: log vim.pl.log (14.5 KB, 383 views)
Fyren is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 03-09-2009 , 07:51   Re: gVim Syntax Hilighting
Reply With Quote #7

Script is a little smarter again. Output is from running it on the current trunk, which is probably the exact same as 1.2.0 right now.
Attached Files
File Type: log vim.pl.log (14.6 KB, 353 views)
File Type: log sourcepawn.vim.log (49.7 KB, 349 views)
Fyren is offline
Stinkyfax
BANNED
Join Date: Aug 2007
Old 10-01-2011 , 10:41   Re: gVim Syntax Hilighting
Reply With Quote #8

Quote:
Originally Posted by Fyren View Post
Script is a little smarter again. Output is from running it on the current trunk, which is probably the exact same as 1.2.0 right now.
Sorry for bumping, but huge thanks for this perl script, if there is any newer version available please share it, as there are still alot of people finding it useful
Stinkyfax is offline
withgod
New Member
Join Date: Aug 2008
Location: tokyo,japan
Old 03-19-2012 , 02:13   Re: gVim Syntax Hilighting
Reply With Quote #9

hello all vim lovers.
i packaged(with sm 1.4 and hook sdk) and hosting github.
https://github.com/withgod/vim-sourcepawn

install manually or use Vundle(easyway).

Quote:
Bundle 'withgod/vim-sourcepawn.git'
thanks original post naris and Fyren!

Last edited by withgod; 03-19-2012 at 02:14.
withgod is offline
Send a message via Skype™ to withgod
El Diablo War3Evo
Veteran Member
Join Date: Jun 2013
Old 12-27-2014 , 03:23   Re: gVim Syntax Hilighting
Reply With Quote #10

I just started learning VIM, as I want to enhance my editing skills and speed.

In the process.. I've been spending time trying to make VIM more like home... and much thanks to withgod bundle, it makes the process a lot easier.

For those whom like to compile either a single file or the whole directory.. VIM only has 1 makeprg as much as I can find. I had to create a map key so that I could do both.

I first got https://github.com/embear/vim-localvimrc and used it to so i can have a local directory settings for each of my projects.

in my .lvimrc file:

Code:
let &l:makeprg="cd ".g:localvimrc_script_dir." && ./compile.sh"
syntax on
set nu
set autoindent
map <silent> <F8> :make<CR>
map <silent> <F9> :make %:p<CR>
So, if I press F8, it compiles the whole directory. If I press F9, it compiles on the single file I'm working on.

I hope this helps prevent you from having to look and search as hard as I did for this information.



Also..

for some reason VIM doesn't like partial paths for QucikFix. If you double click an error using the current compile.sh file, you won't open the file up.

Here is my compile.sh
Code:
#!/bin/bash
cd "$(dirname "$0")"

fullpath=${PWD};

test -e compiled || mkdir compiled

if [[ $# -ne 0 ]]
then
    for i in "$@";
    do
        smxfile="`echo $i | sed -e 's/\.sp$/\.smx/'`";
        echo -n "Compiling $i...";
        ./spcomp $i -ocompiled/$smxfile
    done
else

for sourcefile in *.sp
do
    fullpathsourcefile="`echo $fullpath/$sourcefile`";
    smxfile="`echo $sourcefile | sed -e 's/\.sp$/\.smx/'`";
    echo -n "Compiling $sourcefile ...";
    ./spcomp $fullpathsourcefile -ocompiled/$smxfile
done
fi
__________________

Last edited by El Diablo War3Evo; 12-27-2014 at 04:52.
El Diablo War3Evo is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode