![]() |
|
I've Switched To Spaces |
Evert
Member #794
November 2000
![]() |
Thomas Fjellstrom said: I really don't know why people continue to give vim examples to me. I don't use it, and likely never will
Probably because you complain about editors not being able to do such and so while vim can do such and so easily. |
gnolam
Member #2,030
March 2002
![]() |
Thomas Harte said: quasimodal An interface making extensive use of \a? -- |
Thomas Harte
Member #33
April 2000
![]() |
gnolam said: An interface making extensive use of \a? Not so much using it as just going on about it tediously. Never invite a quasimodal interface to a dinner party. [My site] [Tetrominoes] |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Evert said: Probably because you complain about editors not being able to do such and so while vim can do such and so easily. I didn't say editors couldn't modify indentation Even kate has a short cut for modifying indentation. I can never remember all of the extra shortcuts though (one reason why vi/emacs would be USELESS for me), so I tend to just do things manually. -- |
ReyBrujo
Moderator
January 2001
![]() |
bamccaig said: Ooh, I've just discovered tagging in Vim! It is kind of obsolete now that Vim features native intellisense, but it is still pretty powerful. By the way, I thought you were talking about marks (using m[a-zA-Z] to mark a position in the file, then '[a-zA-Z] to go to the mark). -- |
bamccaig
Member #7,536
July 2006
![]() |
ReyBrujo said: It is kind of obsolete now that Vim features native intellisense, but it is still pretty powerful.
Yeah, but I haven't gotten that far yet. You wouldn't happen to know the relevant commands/configuration settings, or even better a tutorial or reference, for getting intellisense configured in Vim? ** EDIT ** Making some progress, maybe. While in insert mode, press CTRL-X to enter CTRL-X mode where it seems the insert completion functionality is. More can be found with :h ins_completion. -- 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
![]() |
If you have set your paths correctly (set path=/usr/include,.,../include or similar, so that they include all your headers) you can use [i to see the declaration of a variable, and CTRL-W i to go to the declaration in a new window with the original Vim parsing (without the tags). Now that you already got tagging working, add set tags=~/.vim/stdtags,./tags,../tags,tags to your vimrc file, then create the tags, putting the tag file in one of the previously mentioned positions (for example, ./tags or ../tags). Then in the vimrc add autocmd FileType c set omnifunc=ccomplete#Complete to bind the file type with the omnifunction to use. Finally, just declare an object and try to access its members, if you are using gvim a popup will appear with the members. Omni requires ctags to work (adding all the ctags code into the Vim executable would be a waste of time). However, it natively supports CSS and other types. Check :help ft-c-omni for more information. (Edited: Maybe this old guide helps you?) -- |
bamccaig
Member #7,536
July 2006
![]() |
[bamccaig@rufus ~]$ du -h ~/.vim/systags 702M /home/bamccaig/.vim/systags [bamccaig@rufus ~]$
What do I do about this? -- 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
![]() |
You probably have a shit load of dev packages installed -- |
bamccaig
Member #7,536
July 2006
![]() |
I removed ~/.vim/systags from the list for now because clearly it's unreasonably large. I just tried to open project specific intellisense though and I get "unknown function ccomplete"... -- 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
![]() |
Do a <i>du -h usr/include to weight the directory. I got around 50mb, which generates a 75mb systags file. You probably passed too many arguments to ctags, generating a lot of information (that may not be necessary). (Edited: bamccaig said: I just tried to open project specific intellisense though and I get "unknown function ccomplete" Which version are you using? It looks you are missing ccomplete.vim. Try locate ccomplete to see if you have it somewhere, I had it at /usr/share/vim/vim72/autoload/ccomplete.vim.) -- |
bamccaig
Member #7,536
July 2006
![]() |
ReyBrujo said: Do a du -h usr/include to weight the directory. I got around 50mb, which generates a 75mb systags file. You probably passed too many arguments to ctags, generating a lot of information (that may not be necessary). 148M. ReyBrujo said: Which version are you using? It looks you are missing ccomplete.vim. Try locate ccomplete to see if you have it somewhere, I had it at /usr/share/vim/vim72/autoload/ccomplete.vim.) Same. -- 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 |
BAF
Member #2,981
December 2002
![]() |
Guh, I simply do not understand the use of spaces for indenting. At all. Any proper editor should be able to emulate spaces/set whatever spacing you want/etc for tabs. Using spaces forces your shitty indentation styles on others, makes file sizes larger (negligible though), etc. And if python benefits from using spaces vs. tabs, then it's a shitty language. |
ReyBrujo
Moderator
January 2001
![]() |
Quote: 148M. Then yeah, it is possible. Maybe you can only parse the directories you want (say, don't go into subdirectories you don't need). bamccaig said: Same. What are the contents of your vimrc? -- |
bamccaig
Member #7,536
July 2006
![]() |
BAF said: Guh, I simply do not understand the use of spaces for indenting. At all. Any proper editor should be able to emulate spaces/set whatever spacing you want/etc for tabs. Using spaces forces your shitty indentation styles on others, makes file sizes larger (negligible though), etc. Technically, there's no reason a powerful editor couldn't also switch between space-based indentation. You should be able to say "This file was created with 4-space based indentation. Convert them to tabs." I used to agree with tabs (and really the difference in indentation width sort of scares me about using spaces, though it should still be convertible most of the time), but I have just found tabs to be disorganized when it comes to alignment. Sure, you can use tabs to indent and spaces to align, but in practice I've found it insufficient. I'm hoping spaces corrects that problem. I don't dislike tabs, but I'm hoping moving to entirely spaces will be more organized and portable. BAF said: And if python benefits from using spaces vs. tabs, then it's a shitty language. I don't even remember why spaces are recommended (though not required) for indentation in Python, but I remember accepting it as best practice. The interpreter even has command-line arguments to warn (-t) or even error (-tt) when tabs are used for indentation. Python is by no means my favorite language, though I appreciate its differences. ReyBrujo said: What are the contents of your vimrc?
[bamccaig@rufus trunk]$ cat ~/.vimrc :set autoindent :set expandtab :set hidden :set ignorecase :set nowrap :set number :set ruler :set shiftwidth=4 :set softtabstop=4 :set tabstop=4 ":set tags+=~/.vim/systags,~/.vim/tags,../tags,./tags :set tags+=../tags,./tags :autocmd FileType c set omnifunc=ccomplete :autocmd FileType cpp set omnifunc=cppcomplete :autocmd FileType cs set omnifunc=cscomplete :autocmd FileType css set omnifunc=csscomplete :autocmd FileType d set omnifunc=dcomplete :autocmd FileType javascript set omnifunc=javascriptcomplete :autocmd FileType php set omnifunc=phpcomplete :autocmd FileType python set omnifunc=pythoncomplete :autocmd FileType xml set omnifunc=xmlcomplete :autocmd FileType xsl set omnifunc=xslcomplete "set term=ansi "set term=color_xterm syntax on :colorscheme bam ":colorscheme bam-dark [bamccaig@rufus trunk]$
(As you can see I may have gotten carried away with the omnifunc bits... -- 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 |
deps
Member #3,858
September 2003
![]() |
Neil Walker
Member #210
April 2000
![]() |
I see using spaces as only of relevant if the position of text in columns is important, such as tabular data. But for coding, I couldn't care less if tab is 4 characters on one computer and 8 on the other - you can still see the code layout as it was intended. Or think of it in this way: If you use tab then you can set your preferred viewing method. If you use spaces that's all you get. I think the pattern emerging here is those using modern IDE's use tab, and those using text based unix editors prefer spaces. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
GullRaDriel
Member #3,861
September 2003
![]() |
It's a lost cause. It'll always end in a war thread, between those who only think in space, and those who only thrust tabs. My point of view on that subject is that it doesn't matter. Space and tabs are mostly ignored during compilation, and when you program something for your enterprise, only the result matters. They'll never look at your code, even if it crash. "Code is like shit - it only smells if it is not yours" |
bamccaig
Member #7,536
July 2006
![]() |
Neil Walker said: Or think of it in this way: If you use tab then you can set your preferred viewing method. If you use spaces that's all you get. While I agree with you for simple indentation, when it comes to alignment things get a little bit more complicated. Since most people have their editors configured to not show whitespace, it isn't obvious when you accidentally tab code into alignment. --->--->really_long_function_name1(really_long_argument1, --->--->---> really_long_argument2); // ^ Oops, that should be 4 spaces instead of a tab, but with invisible // whitespace you wouldn't notice.
When that code is opened in an editor whose tabstop isn't 4 the code won't line up properly anymore. It's not a show stopper (I don't have any really useful examples to show right now), but if you're obsessive about formatting like I am it's frustrating fighting with it. There's also the fact that tabs typically display as 8 characters wide in text terminals so if you spend a lot of time in them (and you should I also find myself fighting with indentation in JavaScript, where I often use lots of JSON and getting it to line up properly with tabs and spaces combined is often a struggle. Neil Walker said: I think the pattern emerging here is those using modern IDE's use tab, and those using text based unix editors prefer spaces. I use both (I develop with Visual Studio at j0rb), but I prefer working in text terminals. Even at work though (as I said, with JavaScript, for example) I still struggle to keep alignment right. -- 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
![]() |
GullRaDriel said: It's a lost cause. It'll always end in a war thread, between those who only think in space, and those who only thrust tabs. My point of view on that subject is that it doesn't matter. But how do you feel about Hungarian Notation? Or, ummmm, Windows versus Mac? Z80 or 6502? Coke or Pepsi? Jalapenoes or chillis? Winston or Salem? Marmite or absolutely any other spread? EDIT: bamccaig said: if you're obsessive about formatting like I am it's frustrating fighting with it My only obsession, which I've been trying desperately to fight for years, is that I hate otherwise completely empty lines that have white space on them. One of my standard brain unengaged tasks when I'm thinking about a real problem is to go through source files and kill them by hand. I don't know why. [My site] [Tetrominoes] |
bamccaig
Member #7,536
July 2006
![]() |
Thomas Harte said: My only obsession, which I've been trying desperately to fight for years, is that I hate otherwise completely empty lines that have white space on them. One of my standard brain unengaged tasks when I'm thinking about a real problem is to go through source files and kill them by hand. I don't know why. Yeah, that bothers me too. Another gripe is trailing whitespace. Fortunately, with a powerful editor it's relatively easy to get rid of both automatically. :%s/\s\+$//g Obviously not unique to Vim, though I would say that of the editors that I use regularly it's easiest to do in Vim. I think Visual Studio used to do this automatically, but recent iterations don't seem to have that feature by default anymore. -- 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
![]() |
bamccaig said: Fortunately, with a powerful editor it's relatively easy to get rid of both automatically. Yeah, I know. But I like to occupy myself with a mindless task when I'm trying to think, so I prefer to do it myself. Or, at least, leave it to be done when next I have an actually hard problem rather than the routine nothingness that is 95% of all programming. In any language. [My site] [Tetrominoes] |
bamccaig
Member #7,536
July 2006
![]() |
Mmmmmz, automatic. func! DeleteTrailingWS() exe "normal mz" %s/\s\+$//ge exe "normal `z" endfunc autocmd BufWrite * :call DeleteTrailingWS() [1] References
-- 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
![]() |
Thomas Harte said: My only obsession, which I've been trying desperately to fight for years, is that I hate otherwise completely empty lines that have white space on them. My only one is deleting the lonely { after opening a block or function. Poor {, don't you see it is sad there alone? -- |
Thomas Harte
Member #33
April 2000
![]() |
So you prefer: if(a){ to: if(a) { then? Because you know you shouldn't just delete the opening curly braces? [My site] [Tetrominoes] |
|
|