LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-25-2006, 10:20 AM   #1
muddywaters
Member
 
Registered: May 2005
Location: Winnipeg, Canada
Distribution: mostly mepis
Posts: 427

Rep: Reputation: 30
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
 
Old 06-25-2006, 12:58 PM   #2
vls
Member
 
Registered: Jan 2005
Location: The grassy knoll
Distribution: Slackware,Debian
Posts: 192

Rep: Reputation: 31
'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?
 
Old 06-25-2006, 02:35 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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
 
Old 06-25-2006, 02:46 PM   #4
muddywaters
Member
 
Registered: May 2005
Location: Winnipeg, Canada
Distribution: mostly mepis
Posts: 427

Original Poster
Rep: Reputation: 30
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.
 
Old 06-25-2006, 09:42 PM   #5
vls
Member
 
Registered: Jan 2005
Location: The grassy knoll
Distribution: Slackware,Debian
Posts: 192

Rep: Reputation: 31
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.
 
Old 06-26-2006, 08:43 AM   #6
muddywaters
Member
 
Registered: May 2005
Location: Winnipeg, Canada
Distribution: mostly mepis
Posts: 427

Original Poster
Rep: Reputation: 30
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vim syntax highlight fails after debian upgrade darknails Linux - Software 7 05-19-2009 04:11 AM
vim region highlight problem? Chowroc Linux - Software 2 02-17-2006 06:57 AM
Emacs-like paren matching in vim jrdioko Linux - Software 0 01-23-2006 04:28 PM
How to make own highlight scheme in vim? kornerr Linux - General 2 01-04-2006 08:39 PM
vim matching parenthesis rohr Linux - Software 2 04-23-2005 05:12 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration