Author Topic: Saving File Extension Setups?  (Read 5731 times)

jkriegshauser

  • Community Member
  • Posts: 5
  • Hero Points: 0
Saving File Extension Setups?
« on: September 27, 2007, 05:36:28 pm »
I configured a file extension setup for lua and I'd like to be able to share it with team members.

Where does SlickEdit save these custom file extension setups?  Is there an easy way to save it and re-import it?

Joshua M. Kriegshauser
Assoc. Technical Director, EverQuest II
Sony Online Entertainment, LLC.

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Saving File Extension Setups?
« Reply #1 on: September 27, 2007, 08:25:23 pm »
There are a few (txt) files containing all assoc. settings. The File Ext. settings are contained in vusrdefs.e and the colorizer stuff is stored in user.vlx (config dir). AFAIK there is curr. no easy way to export them. But the 'user.vlx' can be easily merged (ini file format - 1 section per language) or you could extract the [lua] section to a new 'lua.vlx' file which can be imported directly via 'cload' command (see Help>Index>VLX for details).
The vusrdefs.e settings req. a bit more work.
You'd need to extract all 'replace_def_data("def-<something>-lua',...) lines to a new 'lua_export.e' batch macro module (@see Help>Index>Batch Macro).
It's also not too hard using a good regex search and save the resulting hits displayed in edit win (@see http://community.slickedit.com/index.php?topic=2037.msg8541#msg8541 for some hints).

Finally 'lua_export.e' looks like that:
Code: [Select]
#include 'slick.sh'
defmain()
{
  _config_modify_flags(CFGMODIFY_OPTION|CFGMODIFY_KEYS);
  replace_def_data("def-<something>-lua", ...);
  replace_def_data("def-<something-more>-lua", ...);
  ...
  // you can also integrate the colorizer import here to minimize the manual work
  cload ('lua.vlx');
}
and your team mates can simply import it by invoking it (once) and save their settings of course.

Should work... (I hope)
HS2
« Last Edit: September 27, 2007, 08:34:14 pm by hs2 »

jkriegshauser

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Saving File Extension Setups?
« Reply #2 on: September 27, 2007, 09:56:10 pm »
Awesome, thanks.  It *kind of* worked.

The replace_def_data lines did their job, but the cload() just said it loaded the file without causing a lexer entry to appear in the lexer drop-down.

Here are the files that I used:
lua_export.e
Code: [Select]
#include 'slick.sh'
defmain()
{
   _config_modify_flags(CFGMODIFY_OPTION|CFGMODIFY_KEYS);
   if ( 0 != cload(absolute('lua.vlx',_config_path()) )
   {
      cload('<');
   }
   replace_def_data("def-setup-lua",'MN=lua,TABS=+4,MA=1 74 1,KEYTAB=ext_keys,WW=1,IWT=0,ST=0,IN=2,WC=A-Za-z0-9_$,LN=lua,CF=1,LNL=0,TL=0,BNDS=,CAPS=0,SW=0,SOW=0,');
   replace_def_data("def-options-lua",'4 1 1 0 0 3 0');
   replace_def_data("def-surround-lua",'65535');
   replace_def_data("def-codehelp-lua",'4213612');
}

lua.vlx
Code: [Select]
[lua]
idchars=a-zA-Z 0-9_
case-sensitive=n
styles=dqbackslash sqbackslash
keywords= and break do else elseif end false for function if in local nil
keywords= not or repeat return then true until while
punctuation= [ ] { }
libkeywords= _G _VERSION assert collectgarbage dofile error getfenv getmetatable
libkeywords= ipairs load loadfile loadstring module next pairs pcall print
libkeywords= rawequal rawget rawset require select setfenv setmetatable
libkeywords= tonumber tostring type unpack xpcall
[operators= line deleted]
linecomment=--
mlcomment=--[[ --]]

If I rename lua.vlx to user.vlx, it works just fine.

Thanks for your help, hs2.

Joshua M. Kriegshauser
Assoc. Technical Director, EverQuest II
Sony Online Entertainment, LLC.

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Saving File Extension Setups?
« Reply #3 on: September 27, 2007, 10:17:08 pm »
Thanks for sharing the lua lexer :) !
To be honest - I never tried that procedure myself. Given that it wasn't too bad ;)
It's a pitty that the vlx ex/import doesn't work as expected - but now we know...
HS2

jkriegshauser

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Saving File Extension Setups?
« Reply #4 on: September 28, 2007, 12:42:46 am »
Quote
Thanks for sharing the lua lexer Smiley !
To be honest - I never tried that procedure myself. Given that it wasn't too bad Wink
It's a pitty that the vlx ex/import doesn't work as expected - but now we know...
HS2

You bet, thanks for your help.

I had to delete the operators= line since it was messing up the form submission (i.e. error about the webserver getting a response that it couldn't handle).  Should be easy to reconstruct it though. :)

JMK