LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-05-2011, 09:02 AM   #1
possum
LQ Newbie
 
Registered: Dec 2004
Location: Vermont, USA
Distribution: Mint 17.2 KDE
Posts: 13

Rep: Reputation: 0
VIM auto completion


Hello,

I am using Vim 7.2 and trying to get autocompletion to work when writing bash scripts in RHEL 6. According to the VIM documentation, any language that offers syntax highlighting should be supported.

Is this really supported in VIM?
 
Old 04-05-2011, 09:11 AM   #2
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Rep: Reputation: 12
don't know if this is what you need, but try it

In 'compatible' mode, e.g. if you have no vimrc, the autocomplete key is
by default not Tab but Ctrl-E

See :help 'wildchar'
 
Old 04-05-2011, 09:23 AM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Should be -- take a look at http://www.techrecipes.net/applicati...auto-complete? and give it a try.

Something useful you can do with all ex-based editors (vi and vim are viual modes of ex) is create a file, .exrc in your home directory with content like this
Code:
cat .exrc
set autoindent showmode showmatch
which will, automagically, set those options (autoindent keeps tabs aligned when you're doing indented code, you go backwards with CTL-D, showmode display what mode you're in, showmatch keeps parens ( ( ) ), braces ( { } ) and brackets honest -- when you type a closing paren, brace or bracket the cursor will flip back to the matching opening one).

You can see what you can set if, in vim, you type :set.

Hope this helps some.
 
Old 04-23-2011, 01:29 PM   #4
possum
LQ Newbie
 
Registered: Dec 2004
Location: Vermont, USA
Distribution: Mint 17.2 KDE
Posts: 13

Original Poster
Rep: Reputation: 0
Just getting back to this....Thanks for all the tips.

I've been using the supertab plugin as I've found the native auto-complete key combinations to be a little difficult to master. I call it within my .VIMRC using:

Quote:
let g:SuperTabDefaultCompletionType = "context"
Indenting is not something I've configured yet, but for handling matching bracket pairs, etc., the autoclose plugin does a pretty good job.I'll give the indenting setting a try.

Confirming what I am seeing when VIM editing a bash script, the above article states how (depending on the language) auto-complete only prompts based on words which already exist in the document. To do more requires further configuration.

This statement however requires further qualification....because in reality, support for auto-complete is language dependent.

An example of this is HTML, where by default the language is fully supported and auto-complete provides a comprehensive list of all possible options, regardless of how many words already exist in the document.

So it looks like the answer is:

By default, some languages are fully supported. Whereas other languages (at least BASH, PHP, Python, etc.) are only partially supported (which means VIM requires supplication to fully support them).

This begs the question...why native full support for HTML only? Auto-complete seems a bit half-baked in this regard.

Last edited by possum; 04-23-2011 at 01:43 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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: auto-completion in ex chexmix Solaris / OpenSolaris 1 08-28-2008 02:26 PM
Vim omin-completion for PHP rmanocha Linux - Software 1 05-16-2008 09:46 AM
vim code completion problem shogun1234 Linux - Software 1 03-08-2008 07:36 PM
does vim have an option for code completion? sneak Linux - Software 4 07-20-2004 07:05 AM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 04:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:49 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