Vim + Snippets isn't working - vim

I'm not sure if this question should be done in the superusers, but anyway, lets give it a try.
Here is my problem.. I'm running ubuntu 9.10 and I'm tying to create a development environment with Vim and it's plugins.
I've done everything that I needed, but I'm having some issues with the snippets:
When I'm in a model and I press:
bt<TAB>
I got:
belongs_to :<+association_name+><+, :class_name => "<+Object+>", :foreign_key => "<+<+object+>_id+>"+>
But if I start typing, instead of replace the association_name with what I type, it just place the text after the line.
Anyone know what could be happening?
Thanks.

not sure which plugin you're using but snipMate has a much easier config/syntax for creating and using snippets within vim,
http://www.vim.org/scripts/script.php?script_id=2540

Related

Awesome WM help popup messed up (possible soluction with new function)

NOTE: I just started to use awesome not very long ago, and don't really know the lua programming language.
I cloned HikariKnight's awesome theme and started to customize the hotkeys. I have a logitech keyboard that has some launcher keys that will open you default apps (on windows that is). I wanted to make them open the default apps here, so I edited the config. Now the help menu has the name of some of the keys repeated over and over for no apparent reason.
If anyone could help me fix this that would be awesome.
Possible Solution(?)
I might be able to use the new function to use the hide_without_description option. This wouldn't be ideal though as it would just remove the hotkey from the help menu.
I found the documentation for it here, but don't know how to use the new function.
https://www.reddit.com/r/awesomewm/comments/mgqq95/messed_up_help_menu/gszd5u0/?utm_source=reddit&utm_medium=web2x&context=3
To quote PlatformKnuckles:
I think I see the problem. Check the line in the keybindings file:
for i = 1, 9 do
You're starting the keybindings in a loop multiple times.
(I didn't look at your rc.lua at all. I just assume the answer above is correct.)

Linux Utility to `Go to definition`s

I'm starting to develop a fairly large app and am beginning to want some of the IDE features I've used in the past, such as 'right-click->go to definition' of a function. Does any kind of parallel in developing on the command line exist? This is on an Ubuntu Desktop VM. Is recommended to move to using Sublime?
It depends on your preferred editor, but options definitely exist.
I've used c-tags for vim.
Similar options must exist for emacs; a quick search turned this up.
In my experience though, nothing beats a full-fledged IDE (more full-fledged than Sublime, even) for these kinds of introspective utilities.
If you're using VIM, check VIM Taglist plugin. It has a command that takes you to a ctag definition.
You can create a VIM keymap to go to the word/function under the cursor which would solve your problem.

Collapsable code in gedit

How to collapse a function , class , or method in gedit.
i managed to install all plugins for gedit , but unable to find any plugin for the same.
In gedit 3 I am currently am using my own fork of the plugin others have mentioned. It is not perfect, but it works fairly well for me anyway. https://github.com/aeischeid/gedit-folding
I just found this updated version of gedit-folding:
http://code.google.com/p/gedit-folding/issues/detail?id=4
Just download folding.py and folding.gedit-plugin and save them to ~/.local/share/gedit/plugins then enable "Simple Folding" under Edit>Preferences>Plugins.
To use, move to the very beginning of a block and press Alt+Z.
I've given it a quick test with Python, Javascript and HTML files and it seemed to collapse most blocks, with the notable exception of multiline strings and comments.
It isn't perfect, but it's better than nothing, I guess.
Update: I've just tested it with badly indented code. The folding seems to be based on indentation only.
for ubuntu 10.04 works this folding plugin:
http://code.google.com/p/gedit-folding/downloads/list
install it for the user by placing it at
~/.gnome2/gedit/plugins/
or for the system
/usr/lib/gedit-2/plugins/

Interface texshop with vim

Any advice on how you would interface texshop on mac osx with vim? I'm using vim quite a lot lately for coding. I find myself now trying to use vim-commands (replace, search, pattern matching, move, etc) when writing documents for latex with texshop and they obviously don't work. However, I don't want to leave texshop altogether, because it has some pretty nice tools I use very often (maybe the most important one is the ability to click the compliled .pdf file while pressing the CMD key on my macbook to jump immediately to the corresponding place in the .tex file).
Thanks in advance!
Can't really help with the question but if you want to use vim I would highly recommend vim-latex suite. It has a lot of mappings and other latex goodness including completion of references/citations (it loads them from the bib file and gives prompts based on what you've already typed). Also it supports pdfsync forward/backward searching - I use that with Skim. There is some information here on how to get that working (and see other posts on that blog).
Are there any other texshop features you would like to reproduce in Vim?

What's the best thing you've done with vim that helped your programming?

While surfing, I came to know that somebody has done Tower of Hanoi using vim. WOW!!!
Can you people share what all cool things you have been doing in vim.
Edit: Not sure about the Tower of Hanoi solution using vim being all that useful. But I think this question should be re-opened to allow people to comment on any useful things that they've done using vim. For me? See my answer below. (-:
vim has a set of commands that integrate with development tools such as make, gcc, and ctags. You can build your project, navigate to warnings and errors, and jump to function/variable definitions without leaving the editor:
:make builds the project.
:cl lists warnings and errors.
:cc takes you to the to line in the source code that generated the current error.
:cn navigates to the next error.
:cp navigates to the previous error.
:tag name navigates to the definition of the token name. (See man ctags to generate an index of tokens; sometimes make tags will do this automatically.)
Pressing Ctrl+] navigates to the definition of the token under the cursor.
I'm using vim to syntax-color code in my blog and lecture notes. A single Perl line
system "$vimrt\\gvim.exe", qq{
-c "edit /tmp/tmpcode.$ext "
-c "source $vimrt/syntax/2html.vim"
-c "write! /tmp/tmpcode.html"
-c "qa!"};
converts the code into nicely-colored HTML. I know there are stand-alone tools for doing this, but vim is already installed on my system, so this is one less tool to install.
I found myself struggling to be more efficient in vim compared to other non-modal text editors until I learned about "text-objects". Understanding this concept really improved my productivity and also gave me a new way of looking at text which in turn made it easier to deeply understand other vim concepts that I had only understood ephemerally before.
:help text-objects
I was working on a system that had massive log files. We're talking 30,000 10MB logs.
Per day!
Distinguishing between log messages that were coming from the middleware (same company but custom rolled) and our application was getting tedious.
That is until I wrote some custom vim syntax parsing so that anything vim displayed in green was from the middleware (done by the guys in Sophia Antipolis near Cannes) as opposed to anything vim displayed in blue that was from our application software that sat over the top of the SA code.
I also added highlighting to really make exceptions stand out with white lettering on a read background!
Made life so much easier! And it wasn't that hard to do!
Thanks vim!
I couple of months ago I wrote a vim script to save a complete history of all my edits, so I could inspect and measure my programming performance.
I'm using vim a lot recently to edit XML files. I got the xmledit plugin for vim working. Now vim creates closing tags for me, I can enclose highlighted text in an XML tag, and jump to balancing XML tags. It saves a lot of repetitive typing, reduces mistakes, and increases my productivity.

Resources