LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   highlight matching brackets in vim (https://www.linuxquestions.org/questions/programming-9/highlight-matching-brackets-in-vim-458150/)

muddywaters 06-25-2006 10:20 AM

highlight matching brackets in vim
 
I'm a kate user but don't have that option on this particular machine.
How do I get vim to highlight matching parenthesis the way kate does?

I know about the "<shift> %" option. Not what I want. So far have added these (and a few other) to .vimrc
set nocompatible
syntax on
set showmatch
set hlsearch
set incsearch
set mat=5

Is there a simple set option for this or is some type of script needed?

Sorry if this is posted in the wrong forum, seemed like a likely place for a good answer.

btw, using Slack 10.1

vls 06-25-2006 12:58 PM

'set showmatch' highlights the matching braces|brackets|parens when the cursor is on a bracket.

What does kate do that you want vim to do?

paulsm4 06-25-2006 02:35 PM

Nor sure you can do it in "vi"
 
Hi -

I think the issue is that vi's "<shift-%>" does brace matching by jumping back and forth between the two braces, whereas kate (and most IDE's and programmer's editors) visually highlight the area between them.

I frankly don't know how to substitute a "visual highlight" for the "jump between" behavior in "vi" (or it's more specialized cousin, "vim").

I googled a little:
1. This page looks interesting (although it doesn't have a solution)
http://www.moolenaar.net/habits.html

2. I also saw mention of a "RadRails plugin for vim". I haven't tried it, but it might be useful to you:
http://www.radrails.org/

3. RadRails looks less like a plug-in than a full-blown IDE. As I said above (and you undoubtedly already know), most IDEs (Eclipse, NetBeans, MSVC, etc etc) and most Programmer's editors (UltraEdit, CodeWright, etc etc) do visual syntax highlighting, hot-key compilation, syntax checking, etc etc

'Hope that helps .. PSM

muddywaters 06-25-2006 02:46 PM

Quote:

Originally Posted by paulsm4
As I said above (and you undoubtedly already know)

You highly overestimate my knowledge :)
Thanks for the info and the links, will check them out.

vls

Thanks for the reply. The behaviour you describe (highlight matching bracket) is what I had hoped for. It doesn't seem to be working that way.

vls 06-25-2006 09:42 PM

Quote:

Originally Posted by muddywaters
vls

Thanks for the reply. The behaviour you describe (highlight matching bracket) is what I had hoped for. It doesn't seem to be working that way.

Okay, I've not given quite accurate info, I apologize. showmatch makes the cursor jump back and forth when you type in a bracket.

There's a plugin to do the highlighting thing. Sorry, it's been awhile since I used vim and was thinking showmatch highlighted also.

This is version 7 vim,
Fire up vim then do the colon command thing, :help showmatch
There's a link in the help files to the plugin in question,
pi_paren.txt. Put your cursor on that and hit ctrl-] and it'll jump you to the docs.

I think I got it this time, I hope.

muddywaters 06-26-2006 08:43 AM

Quote:

Originally Posted by vls
There's a plugin to do the highlighting thing.

No doubt. I had never looked at vim in any serious way before. The number of options and plugins available is a little mindboggling. Finding features that are more interesting than the one I wanted originally.

Thanks for the help.


All times are GMT -5. The time now is 09:13 PM.