Peter Michaux wrote:
Hi All,

I'm finally trying to buckle down and learn a real text editor. I'll
give vim a go first since it looks like I won't have to hold down ctrl
all the time like emacs. I currently use Textmate on OS X and it has
some great features but I am tired of reaching for my mouse and it
doesn't get automatic code formatting correct very often. I want to
make sure my favorite text editing features won't disappear on me. I
understand some vim basics like moving around and copying and pasting
but what about these features...

You've come to the right place. Vim supports the mouse but everything can also be down with only the keyboard. Its "modal" character means that a lot of things can be done without the need to use keychords, especially complex ones, unduly often.


Does vim have the concept of a project of files? I like the project
drawer to the left of the editing window which shows the files and
directory structure on my hard drive.

If vim does have the concept of a project can I do a project wide
search or search and replace in my project? I find this essential for
refactoring and cleaning up code when I realize what I should have
called a variable.

Maybe not as such, but it is easy to implement, almost trivial. Just make a distinct directory tree for each project. Then it is very easy to search and/or replace in all subdirectories of the "project" directory: for instance,

        :args ./**/*.[ch]
        :argdo 1,$s/\<ThisVariable\>/thisVariable/g |update

replaces ThisVariable by thisVariable (but only as a separate word) in all *.c and *.h files in the current directory and all its subdirectories to (IIUC) a depth of 100 levels.


Are there good syntax highlighters for HTML, CSS, JavaScript, C, Lisp?

Yes. And many others.

I see there are indentation packages for C and Lisp, what about HTML,
CSS
and JavaScript? If I have multiple files open with different languages
does vim know which file goes with which language by the filename
extension and use the appropriate indentation and highlighting?

I think so, but I don't use very sophisticated custom indent packages myself: I disable filetype-related indenting and use only 'autoindent' and 'smartindent'. However, looking at vim70/indent/*.vim in the distribution or in its archive will tell you which languages already have custom indenting supported.


Are there code completion bundles available for HTML, CSS and JavaScript?

For HTML, yes, with Vim 7 "and higher" (there is no higher yet). It's called "omni completion" and will complete possible tag names, attribute names, attribute values etc. This feature is rather young and maybe not perfect but the details are implemented by runtime scripts so if what exists is not good enough for you, you can contribute to making it better.

For CSS and JavaScript, I think so; but I'm not sure. If it isn't available yet, it can be made available without recompilation, by writing the necessary completion scripts.

In any case, there exists a default "syntax-based" completion script which can do code completion at an elementary level for any language having a syntax highlighting script.


Sorry for all the question. Diving into vim is a bit bewildering as it
doesn't come as complete (as far as I know) as Textmate or other GUI
editors seem to.

Thanks for any help.

Peter


I don't know Textmate. Vim beats hands down any other GUI editor /I/ know, but I guess they aren't the same as those you're accustomed to.

Vim has an /extremely/ complete help system (and a friendly user community). See one of my recent posts in a different thread about how to find your needle in the help system haystack.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
69. Yahoo welcoms you with your own start page

Reply via email to