|
I've Switched To Spaces |
bamccaig
Member #7,536
July 2006
|
I used to always prefer tabs for indentation, but after struggling with alignment for so long and also learning a bit of Python, which benefits from spaces, I've decided to switch completely over to spaces. Now we can have another tabs vs. spaces flame war, but now I've switched sides... ** EDIT ** I'm so used to Tab meaning a tab character that I keep instinctively using the Space bar to indent now... -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Thomas Fjellstrom
Member #476
June 2000
|
I press tab for indent. regardless of what it means in any given project (my projects tend to use literal tabs, displayed at 3 spaces). -- |
bamccaig
Member #7,536
July 2006
|
I've configured Vim to use spaces to indent, but I just instinctively hit the Space bar 4 times instead of tab... It's starting to make me struggle at j0rb too cause they use tabs there (and they probably haven't reached a point yet where spaces make sense), but I'm starting to get used to using spaces. My environments have always been configured to use tabs, so whenever I used to use spaces to indent (mainly here on Allegro.cc and I suppose recently in Python) I would do so manually with the Space bar; so I started doing that at j0rb the past couple of days. Once I get used to using the tab key for spaces for my own stuff, it should be less of a problem because it should just work most of the time at j0rb (cause it's configured for tabs there) the same as it does at home (which will be configured for spaces). The difference should often be transparent. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
ReyBrujo
Moderator
January 2001
|
I use tab, but let Vim translate those to spaces. I simply detest tab, especially when people use some "odd" tabulation (like 3 spaces, so they combine tab and spaces when having more than 2 or 3 indentation levels). -- |
DanielH
Member #934
January 2001
|
Since the dawn of time... I've been programming for a long time now and have always used spaces. Recently, a couple of months, I switched to tabs to see how I would feel. I like tabs better. |
Thomas Fjellstrom
Member #476
June 2000
|
I haven't seen a decent editor that would let you move properly through text when spaces are used for indentation, so I try not to use them. Its annoying. Have to press the arrow key for each space. Thats how people get carpal-tunnel for peat's sake. -- |
ReyBrujo
Moderator
January 2001
|
Well, if you are not going to make puns, Vim lets you move to the first non blank character of the line (similar to what some Microsoft IDEs do when you press Home, you go to the first non blank character instead of the start of the line). Most editors let you skip all the blanks with CTRL+LEFT, for example. -- |
Shravan
Member #10,724
February 2009
|
I would use spaces between the words of a program and tabs whenever a new block begins.Tabs increase the readability of the code.
|
Peter Wang
Member #23
April 2000
|
Thomas Fjellstrom said: I haven't seen a decent editor that would let you move properly through text when spaces are used for indentation, so I try not to use them. Its annoying. Have to press the arrow key for each space. Thats how people get carpal-tunnel for peat's sake. Right, don't do that. As Rey says, skip entire words at a time. But I wonder why you need to be cursoring over indentation anyway. Every editor I've ever used (except maybe notepad) at least lets you jump to the start of the line past the indentation, if it doesn't place you there already. Another vi/vim tip to avoid cursoring (and this is one I didn't know for a long time): the 'f' command lets you skip directly to the next occurrence of a character on the line, e.g. f, skips to the next comma. 'F' goes in the other direction.
|
Thomas Fjellstrom
Member #476
June 2000
|
Peter Wang said: Right, don't do that. As Rey says, skip entire words at a time. But I wonder why you need to be cursoring over indentation anyway. Every editor I've ever used (except maybe notepad) at least lets you jump to the start of the line past the indentation, if it doesn't place you there already. Modifying indentation for one. CTRL+LEFT is rather hard to press on my laptop, and it goes up to the next line, I rarely want that. I'm trying to navigate around the beginning of the line. If I wanted to navigate to the prior line, I'd press up and maybe end, not CTRL+LEFT a bunch of times. Also, if you set your editor to display whitespace, all those little dots in the indentation gets to be quite distracting. I'd prefer one per indentation level (which is what a hard tab gives you), not one per space (which is what space indentation gives you). Also, I don't use any variant of vi or emacs. Too much a pain in the ass. And yes I tried learning it. Didn't find it worth the effort. I like a good gui editor that blends into my desktop. Not some console editor (except nano for quick ssh editing), or some hacked up mashup (aka gvim). I just don't like either editor very much. Now those aren't the only reasons I've found I had to cursor over the leading white space, just all I could think of at the moment. Also, "Right don't do that" is not a solution. I'm tired of people providing that as a solution to things, that really do have a valid alternative. -- |
Peter Wang
Member #23
April 2000
|
Just trying to save some wrists.
|
Martin Kalbfuß
Member #9,131
October 2007
|
Classic tabs with a length of 8 spaces. http://remote-lisp.spdns.de -- my server side lisp interpreter |
Thomas Harte
Member #33
April 2000
|
Nothing but tabs for me, same as I wouldn't use two hyphens to make an emdash. Actually, scratch that comparison - I've never understood why anyone thinks this decision is anything other than personal preference. And, yes, it does make me feel bad when I post from my iPhone like now and the only dash easily available is a plain hyphen. [My site] [Tetrominoes] |
Evert
Member #794
November 2000
|
Thomas Fjellstrom said: Modifying indentation for one. Well. Any one of <<, == or >> in vim will do that for me (which to use depends on what exactly I need to correct). For entire blocks =i} or =i{ does very well too. Quote: Also, I don't use any variant of vi or emacs. Too much a pain in the ass. And yes I tried learning it. Didn't find it worth the effort. To each his own. Learning to use vim somewhat properly has probably been the most useful time investment I've ever made when it comes to using a computer (probably comparable to learning Perl - between Perl and vim I'm not sure how I managed to use a computer before). Quote: I like a good gui editor that blends into my desktop. Personally I like a good editor. Quote: Not some console editor (except nano for quick ssh editing), or some hacked up mashup (aka gvim). Huh? To what specifically are you referring? Quote: Also, "Right don't do that" is not a solution. I'm tired of people providing that as a solution to things, that really do have a valid alternative. Well, you said "I haven't seen a decent editor that would let you move properly through text when spaces are used for indentation". Vim lets you do exactly that. |
james_lohr
Member #1,947
February 2002
|
I used to use spaces in old crappy IDEs, but I use tabs now since most modern IDEs are intelligent enough to allow spaces and tabs to be used interchangeably with minimal hassle.
|
bamccaig
Member #7,536
July 2006
|
I haven't quite learned to properly navigate through the text in Vim, but I have seen it demonstrated just how easy it is if you know how. It's so much faster to do anything than in a conventional editor. That's why I stick to Vim whenever I can. I'm slowly trying to learn how to use it properly... It would be nice to take an actual course in it actually, but otherwise finding the time to run through decent tutorials should be fine. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Thomas Harte
Member #33
April 2000
|
Yes, I think the last time I deliberately used spaces was back in ye olde days of RHide. EDIT: that Jef Raskin(-inspired?) editor has the fastest text navigation I've ever used. Hold down a modifier and type, the editor jumps to the next instance of that text. Hold down an alternative modifier and it'll search for the previous instance. [My site] [Tetrominoes] |
Timorg
Member #2,028
March 2002
|
I prefer 4 spaces for tabs, and in the editor (Code::Blocks) they act as spaces, but when the file is saved they are converted to tabs. That way if I edit the file with Vim it still works out ok. ____________________________________________________________________________________________ |
ReyBrujo
Moderator
January 2001
|
Martin Kalbfuß said: Classic tabs with a length of 8 spaces. 8 spaces is too large for me. 3 is odd, so I prefer 4. Thomas Harte said: Hold down a modifier and type, the editor jumps to the next instance of that text. Hold down an alternative modifier and it'll search for the previous instance. You use / to search forward in Vim, and ? to search backwards. Even Firefox uses / for quick search. -- |
Sirocco
Member #88
April 2000
|
I love the TAB key. What I love most is that when I press it, four spaces are inserted into my code instead. Fuck yeah. --> |
Thomas Harte
Member #33
April 2000
|
ReyBrujo said: You use / to search forward in Vim, and ? to search backwards That's modal rather than quasimodal, which means that it takes more mental processing to make reflexive. Modal = need to keep more in your mind at once. Essentially though, it's nice that bamccaig and I agree, even if I didn't realise it. EDIT: I guess it's like the difference between CAPS LOCK and using the shift key. Except for a feature that you probably use much less frequently. [My site] [Tetrominoes] |
Indeterminatus
Member #737
November 2000
|
Use code formatting tools. Focus your worries on something else (meaning, more important). \o/ _______________________________ |
bamccaig
Member #7,536
July 2006
|
Ooh, I've just discovered tagging in Vim! \o/ Generate a tags file with ctags (not sure if it only supports C or if it has support for other languages... Maybe there are similar commands for other languages). [bamccaig@rufus trunk]$ ctags `find -name \*.h -o -name \*.c` [bamccaig@rufus trunk]$ vim tests/bam_list_test/src/main.c From within Vim: :tag bam_list_create Vim automatically finds the definition of bam_list_create in src/bam_list.c (technically it just matches it in the tags file) and opens it. ** EDIT ** [bamccaig@rufus trunk]$ ctags --list-languages Asm Asp Awk Basic BETA C C++ C# Cobol Eiffel Erlang Fortran HTML Java JavaScript Lisp Lua Make Pascal Perl PHP Python REXX Ruby Scheme Sh SLang SML SQL Tcl Vera Verilog Vim YACC [bamccaig@rufus trunk]$ Nvm. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Thomas Fjellstrom
Member #476
June 2000
|
I really don't know why people continue to give vim examples to me. I don't use it, and likely never will -- |
Thomas Harte
Member #33
April 2000
|
That example at least undercuts anyone who might assume that text based software is inherently less featured. Though I doubt anyone here would. You know, other than making general observations about the correlations between launch date and probability of software being text based and between launch date and the probability of software having <arbitrary feature>. [My site] [Tetrominoes] |
|
|