Author Topic: [PLUGIN WANTED] Automatic white space adder  (Read 17189 times)

Offline Mad Scientist

  • Multiple posting newcomer
  • *
  • Posts: 25
[PLUGIN WANTED] Automatic white space adder
« on: March 01, 2007, 12:05:49 am »
I have been just learning python and when finding i need to add an if statement to a long list thought it would be nice if there was a macro/plugin that could be used to add whitespace. For test commands in the file I was thinking something like:
Code
//Some code
...
...
code
...
...
Code
//Add the text commands to the file
...
>> SPACE 2
...
code
...
>> SPACE END
...
Code
//Indented code
...
  ...
  code
  ...
...
Or a simpile right click/menu option would be nice to.

Some options for it that would be nice are add/remove('>>' or '<<'), space or tab('SPACE' or 'TAB') and how many.

Thanks in advance for any time used to do this. :D

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #1 on: March 01, 2007, 12:36:49 am »
Maybe you mean that:

Select source you want to indent and then TAB - adds one tab in front of each selected line, alt+Tab removes one tab for each line if there's any

Offline Mad Scientist

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #2 on: March 01, 2007, 02:03:36 am »
Ya thanks thats what I was looking for. If only it worked for spaces and Alt Tab wasnt already taken by windows :x Well then i am looking for someone to add spaces and a differnet key combo then alt - tab for windows.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7678
    • My Best Post
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #3 on: March 01, 2007, 02:11:24 am »
Ya thanks thats what I was looking for. If only it worked for spaces and Alt Tab wasnt already taken by windows :x Well then i am looking for someone to add spaces and a differnet key combo then alt - tab for windows.

Verify your settings, it should work for spaces.

"settings" -> "editor"
"General Settings" verify "Use TAB Character" is unchecked.

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Mad Scientist

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #4 on: March 01, 2007, 06:55:13 am »
O thanks for showing me the options but I was looking more for adding one space at a time not a tab indent with spaces. I like to indent with 2 spaces and have tab be 8 spaces long to keep the files looking right with other programs and with code blocks.  :(

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2808
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #5 on: March 01, 2007, 02:10:48 pm »
O thanks for showing me the options but I was looking more for adding one space at a time not a tab indent with spaces. I like to indent with 2 spaces and have tab be 8 spaces long to keep the files looking right with other programs and with code blocks.  :(

KeyMacs is a plugin that allows the user to define a hotkey as a sequence of keystrokes. You could define (say) alt-shift-2 as two spaces, or alt-shft-4 as four spaces etc.

If you're using SVN source, try compiling KeyMacs.
If your using the Nightly, and you think that KeyMacs will help,
tell me which Nightly you're using and I'll make a binary for  you.

Help entry (Wiki):
http://wiki.codeblocks.org/index.php?title=KeyMacs_plugin
Forum:
http://forums.codeblocks.org/index.php?topic=4681.0
« Last Edit: March 01, 2007, 02:41:04 pm by Pecan »

Offline kkez

  • Almost regular
  • **
  • Posts: 153
    • WinapiZone
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #6 on: March 01, 2007, 08:08:25 pm »
Maybe you mean that:

Select source you want to indent and then TAB - adds one tab in front of each selected line, alt+Tab removes one tab for each line if there's any

On my os it's Shift+Tab, not Alt+Tab ...

Offline Mad Scientist

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #7 on: March 01, 2007, 09:46:51 pm »
Pecan: Ya, thanks that would be great just compile it for the latest nightly that is availible and ill upgrade when its compiled.

kkez: Yup Shift-Tab works could of sworn I tried that along with all the other modifier keys.

Thanks to everyone for all the help   :D

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2808
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #8 on: March 02, 2007, 12:46:01 am »
Pecan: Ya, thanks that would be great just compile it for the latest nightly that is availible and ill upgrade when its compiled.

kkez: Yup Shift-Tab works could of sworn I tried that along with all the other modifier keys.

Thanks to everyone for all the help   :D

Please see: http://forums.codeblocks.org/index.php/topic,5308.new.html#new

Offline Mad Scientist

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #9 on: March 03, 2007, 07:05:53 am »
Ok I have KeyMac setup just wondering if i could have it add a space to the first line of the selected block of text every time i press space and remove a space from the first line with Shift-Space in a similer way that it is done with Tab and Shift - Tab?
« Last Edit: March 03, 2007, 08:22:35 am by Mad Scientist »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2808
Re: [PLUGIN WANTED] Automatic white space adder
« Reply #10 on: March 03, 2007, 03:30:48 pm »
Ok I have KeyMac setup just wondering if i could have it add a space to the first line of the selected block of text every time i press space and remove a space from the first line with Shift-Space in a similer way that it is done with Tab and Shift - Tab?

I cannot think of a combination of keys that would do that directly, but KeyMacs can make it easier to prefix a space to a line with
a keymac of {space}{down}{home} associated with a hot key of say Ctri-Shift-I.

Each time you hit Ctrl-Shift-I, a space will be added to the beginning of the line and the cursor will advance to the beginning of the next line.

If you had 10 lines, just hold now Ctrl-Shift and hit "I" ten times.

You could also temporarily define the Tab key as a 1 space tab, then use mark/tab mark/shift-tab as usual.

To redefine TAB, MainMenu=>Setting=>Editor=>"TAB size in spaces: 1"

A workaround that allows both a 4space tab and a 1space tab is:
1)set Tab to a 1space tab(as above).
2) with KeyMacs define (say)Alt-Ctrl-T as {TAB 4} to simulate the old tab.

You cannot use a single character (like space) as a hotkey for either KeyMacs or a menu item, else you wouldn't be able to use it as a regular text key. However, you can use any combination of a text key with Ctrl,Shift, or Alt.

Alt/Ctrl Tab cannot be used as a hotkey because it's overridden by MicroSoft.


« Last Edit: March 03, 2007, 03:58:34 pm by Pecan »