File extension based word wrap, tab and indent settings

File extension based word wrap, tab and indent settings

80
Advanced UserAdvanced User
80

    Jan 27, 2007#1

    By default I have my tabs set to 2, but in certain file types like my Python files I want a tab of 4. The problem is UltraEdit doesn't detect when I switch to the python file and change the tab setting.

    I'm using 12.20b. Does anyone else have a problem overriding the default tab settings based on the file extension?

    Thanks.

    6,682583
    Grand MasterGrand Master
    6,682583

      Jan 28, 2007#2

      Do you always modify the tab stop value for Default?

      This would not be a good idea. It's better to configure the tab stop value different for Python files based on the file extension.
      1. Open Advanced - Settings/Configuration - Editor - Word Wrap / Tab Settings.
        German: Extras - Optionen - Editor - Zeilenumbruch
      2. Click on button Change List....
      3. Enter in the upper field the file extensions of your Python files separated with a space (without point - only the extension).
        Example for HTML: htm html php
        Example for C/C++: c cpp h
      4. Press the button Add and then the button OK.
      5. Back in the word wrap / tab settings dialog, select now in the drop down list the just created new entry.
      6. EVERYTHING below the drop down box is now individually specified for files with the extension shown in the drop down box. Specify now the tab stop value you want for your Python files and also the auto-complete file and the word wrap settings.
      7. Click on button OK to save the settings and close the configuration dialog.
      8. Close UltraEdit and restart it because settings for a just created new file group become active only after a restart. A change in configuration of an already existing file group become active immediately after closing the configuration dialog with button OK.
      Please note: New files not saved with one of the file extensions for Python files are still with the settings for Default until first save. So better save a new Python file before you really start. The settings for Default are applied also to all files with an extension not configured separately.

      80
      Advanced UserAdvanced User
      80

        Jan 29, 2007#3

        It seems to be working now. I think I had a couple problems. Out of habit I put *.py as the file extension instead of py. Also, to get UE to recognize the files properly I had to restart it. Closing and reopening the files might have worked as well. Thanks for the help Mofi.

        1
        NewbieNewbie
        1

          Nov 22, 2007#4

          I had set different tab stops for different extensions, but they didn't work. Now I have discovered the problem: I put a dot in front of the extension name when adding the extension to the Word Wrap/Tab Settings extension list. Once I removed the dot, it worked. The comment:

          File Extensions (separated with a space)

          should be changed to:

          File Extensions (no dot, separated with a space)

          I find it confusing that UE has what appear to be three entirely separate extensions lists, one under Tab Settings, another under File Associations, and another under File Types. Each list appears to be independent.

          6,682583
          Grand MasterGrand Master
          6,682583

            Nov 22, 2007#5

            Ted, please read my first post at Syntax highlighting complex filename extensions to understand how Microsoft has defined the file extension.

            And I think the 3 different list for file types are OK. In my point of view the tab settings list has nothing to do with the file open/save list or the list of files associated with UltraEdit. I use multiple INIs where the tab settings and the file types lists differ from INI to INI.

              Jul 08, 2010#6

              friendly wrote:Is there someway I can change the default indent value?
              Can I also assign a keystroke to add/remove indents?

              I'm used to other editors where I can indent/unindent blocks of selected code with just a keystroke or two.
              Both questions can be answered with YES.

              If a block is selected (= at least 1 entire line with the line ending character(s)) pressing key TAB adds an indent and SHIFT+TAB removes one indent.

              The commands Add Indents and Remove Indents in menu Format are only needed for adding or removing multiple indents at once and often pressing multiple times TAB or SHIFT+TAB is faster for changing the indents of a selected block. The name of these 2 commands in the key mapping configuration dialogs are FormatAddIndents and FormatRemoveIndents when you want to assign your own hotkeys. But I suggest to simply use TAB and SHIFT+TAB.

              What an indent is can be configured at Advanced - Configuration - Editor - Word Wrap / Tab Settings. It can be a tab or a space and the tab stop value respectively the indent spaces value define the width of the indent. Different tab stop values are also possible. All settings you see below the drop down list containing by default only the entry Default are only for the files with the extension displayed in the drop down list. Default means for all files with an extension not defined different by you. See my first post above for a detailed step by step introduction how to setup file extension based word wrap and tab settings and don't forget to press the button Help in this configuration dialog to get additional help when you need it.