Change tab size through macro?

General and specific configuration/INI settings

Change tab size through macro?

Postby sstrubli » Tue Feb 28, 2006 3:01 pm

Hello,

My company does work in both Linux and Windows environments, and there is no 'standard' indent value for tabs, but most everyone uses 4 or 8 character indenting. And as I'm sure you all know, it's a real pain to run across files edited in 'tab 4' style that have embedded spaces instead of tabs when you are working in 'tab 8' mode.

I am looking or a way to switch between tabs at 4 characters and tabs at 8 characters (or to select a tab indent value) without having to go through the 'Advanced Configuration' settings... say something that could be done as a macro.

Any suggestions?

TIA,

Steve
User avatar
sstrubli
Newbie
 
Posts: 4
Joined: Tue Mar 22, 2005 12:00 am

Re: Change tab size through macro?

Postby Mofi » Tue Feb 28, 2006 4:20 pm

That's easy. First replace all strings with exactly 8 spaces by 1 tab. Then replace all tabs by 4 spaces.

Top
Find " "
Replace All "^t"
Find "^t"
Replace All " "

Same method for conversion from 4 to 8 spaces. First replace all strings with exactly 4 spaces by 1 tab. Then replace all tabs by 8 spaces.

Top
Find " "
Replace All "^t"
Find "^t"
Replace All " "

Before closing the file you should convert all 4 or 8 spaces back to tabs or the 4 spaces.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4042
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Change tab size through macro?

Postby sstrubli » Tue Feb 28, 2006 4:59 pm

Hi Mofi,

I appreciate the reply, but I'm not looking to CONVERT tabs to spaces (or vice versa)... I'm looking to change the way I see tabs in my editor, as either 4 or 8 characters (as currently configured through Advanced->Configuration->Word Wrap/Tab Settings).

I was hoping to find a way to change the 'Tab Stop' and 'Indent Spaces' Values without having to traverse the menu. I do not want to modify the file.

Thanks again,

Steve
User avatar
sstrubli
Newbie
 
Posts: 4
Joined: Tue Mar 22, 2005 12:00 am

Re: Change tab size through macro?

Postby Bego » Wed Mar 01, 2006 6:48 am

Hi,

Well, if I understood it right:

Just change the value of this line
Indent1=4
in uedit32.ini to 4 or 8 before starting UE.
You can either start UE with a Parameter to a specific ini-file or work with ONE uedit32.ini and change this value before stating UE.
Many ways lead to Rome there...

rds Bego
User avatar
Bego
Master
Master
 
Posts: 357
Joined: Wed Nov 24, 2004 12:00 am
Location: Germany

Re: Change tab size through macro?

Postby sstrubli » Wed Mar 01, 2006 2:31 pm

Again, thanks for the advice... but perhaps I haven't explained what I'm looking for as precisely as I thought.

I'm looking for a way to change the 'Tab Stop' and 'Indent Spaces' values, on-the fly, without altering the file I'm viewing, through the use of a macro or other means without having to navigate the menu tree. Ideally this would be something you could attach to a button on a toolbar or a hotkey.

I"m starting to believe that this is not a feature of UE at this time. Though I'm sutrprised it hasn't been asked for before... I see a lot of mixed VI/Windows environments where tab stop sizes are different, especially when viewing C and assembly files (C files at 4 character tabs, assembly at 8). Wouldn't it be nice to be able to change tab stop sizes on the fly?

Thanks once more,

Steve
User avatar
sstrubli
Newbie
 
Posts: 4
Joined: Tue Mar 22, 2005 12:00 am

Re: Change tab size through macro?

Postby Mofi » Wed Mar 01, 2006 3:21 pm

Do you already know, that you can set different tab stop and indent values based on the file extension?

You already can set a tab stop of 4 for *.c and *.h files and a tab stop of 8 for *.asm, *.src and *.lst files.

Even better you can set for example for assembler files that first tab stops at column 12, second tab at 16, third at 25 and further tabs at every 8 to get correct aligned the assembler code with only 3 tabs. Example:

Label:»MOV»R15,#000Fh»; comment

That's the reason why nobody has needed till now to change the tab settings on the fly. The only problem is that for example 1 developer uses a tab stop of 3 and another developer a tab stop of 4 and both are editing the same source files or files with the same extension. But there is also a solution for this problem: either with the macros above or better change the file extension for example from .c to .c4 or .c3 and specify the tab stop value 4 for extension .c4 and 3 for .c3.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4042
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Change tab size through macro?

Postby chrisdfeld » Mon Dec 07, 2009 12:42 am

sstrubli wrote:I'm looking for a way to change the 'Tab Stop' and 'Indent Spaces' values, on-the fly, without altering the file I'm viewing, through the use of a macro or other means without having to navigate the menu tree. Ideally this would be something you could attach to a button on a toolbar or a hotkey.

I'm reviving this thread because I'd like to request exactly the same feature (still absent as of UltraEdit 15.20). Frequently I switch back and forth between source files from different third-party projects written in the same programming language. Different developers create code with different tab stops and changing between tab settings is something I do frequently. UltraEdit currently makes this extremely cumbersome because:

  • I can't see what my current tab settings are, unless I go to Advanced -> Configuration -> Editor -> Word Wrap/Tab Settings (4 clicks - assuming I remember correctly which of the 10+ Configuration categories I'm looking for)
  • I can't change the tab settings unless, likewise, I go through the 4-click process and then change 3 settings by hand (Use spaces in place of tabs, Tab Stop value, and Indent spaces)
  • UE will only remember one set of tab settings per file extension, which is of no help when switching between projects written in the same language with different tab stops

Any or all of the following would be huge improvements here.

  • Show an indicator of the current tab stop settings (e.g. SPC/4/4 or TAB/4/2) in the status bar, similar to the current insert/overwrite/caps lock/text file format indicators
  • Provide a direct menu option or toolbar button for switching between user-defined tab settings
  • Allow tab stop settings to be stored and loaded with project settings
  • Allow tab stop settings to be changed directly using an UltraEdit JavaScript method, so I can create my own key shortcut/menu option/toolbar button

Renaming another developer's files to a different file extensions in order to work around UE's limitation here is, I think, an unworkable suggestion. Tab stops vary from project to project and UltraEdit settings should work the same way. At the very least, UE should make it possible to view and switch these settings without navigating to a configuration setting buried several layers deep.
User avatar
chrisdfeld
Newbie
 
Posts: 4
Joined: Sun Dec 06, 2009 1:45 pm

Re: Change tab size through macro?

Postby touriga » Thu Mar 04, 2010 12:51 pm

I emailed IDM in 2006 requesting a similar feature to that mentioned by chrisdfeld above. I seem to recall that I got a reply that wasn't really applicable to my requirement.

In my case I often use UltraEdit to manipulate data files as in data cleansing. Often these are CSV files or files with rows of data and tabs between the fields in each row. In order to visually check a file I need to set the tab stop appropriate to the data in each field column. Currently this is real pain having to navigate through the configuration menu to the TAB Stop value setting.

In addition to chrisdfeld's good suggestions, what would be incredibly helpful would be to be able to right click on the Ruler and set/unset a tab stop. i.e. similar to Microsoft Word. Is there any reason why this is difficult or a bad idea to add as a feature to UltraEdit?

I have now emailed IDM again to request a simpler way to change the Tab Stop value.

-- Rob --
touriga
Newbie
 
Posts: 2
Joined: Sun Jan 10, 2010 11:07 am

Re: Change tab size through macro?

Postby Mofi » Fri Mar 05, 2010 2:06 am

Rob, why do you not convert your CSV files to fixed column using Column - Convert to Fixed Column and after finishing editing back to a CSV file using Column - Convert to Character Delimited which are designed for working with CSV files?
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4042
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Change tab size through macro?

Postby touriga » Fri Mar 05, 2010 3:17 am

Thanks for your reply Mofi and helpful suggestion, but I'd be converting back and forth all day. i.e. like using the configuration menu, I'd be doing additional onerous mouse and click work that would be unnecessary if I had a more convenient and efficient way to change the TAB Stop value.
-- Rob --
touriga
Newbie
 
Posts: 2
Joined: Sun Jan 10, 2010 11:07 am


Return to Configuration/INI Settings