Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9078247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:34:19+00:00 2026-06-16T19:34:19+00:00

The default behaviour of vim is to write down the first match it found

  • 0

The default behaviour of vim is to write down the first match it found and show a drop down menu with all other. When I use it to auto complete code stuff (like function names from a library) it is often awkward to use as it chooses the longest word and drops down a long list that takes too much effort to either delete half the word or manually search the menu of similar words.

example : I use OpenCV and when I write cvCr(<Ctrl-x><Ctrl-o>) it writes cvCreate2DHMM and shows a menu with some 20-30 things in it all starting with cvCreate. Then I have to either delete half the word or search manually in the menu.

There is a trivial way to change that behaviour to only write down the longest common match like most IDEs do (it’s in the manual and I know how to find it).

However when I use <Ctrl-x>s to fix a spelling error I prefer the default behaviour.

Is there a way to set the behaviour separately for different auto-completions ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:34:20+00:00Added an answer on June 16, 2026 at 7:34 pm

    You mean you want to toggle longest from the 'completeopt' option?!

    You’d have to overwrite the completion triggers, and prepend a no-op :map-expr to change the option, like this:

    function! CompleteoptLongest( isEnable )
        set completeopt-=longest
        if a:isEnable
            set completeopt+=longest
        endif
        return ''
    endfunction
    :inoremap <expr> <SID>CompleteoptLongestOn CompleteoptLongest(1)
    :inoremap <expr> <SID>CompleteoptLongestOff CompleteoptLongest(0)
    
    :inoremap <script> <C-n> <SID>CompleteoptLongestOn<C-n>
    " Repeat for all other completion commands you use...
    
    :inoremap <script> <C-x><C-s> <SID>CompleteoptLongestOff<C-x><C-s>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Auto-binding of request params seems like default behaviour, but I can't find a lot
How to change default emacs mark-paragraph function behaviour to not select first empty line?
The default behaviour of :help in Vim opens the help in a horizontal split.
We all know the default behaviour of Hibernate when using @SequenceGenerator - it increases
I would like to alter the Show default behaviour of a TForm's descendant (for
The default behaviour of mvc when a partial template can not be found is
The default behaviour of LIKE and the other comparison operators, = etc is case-sensitive.
According to docs numpy's default behaviour is to index arrays first by rows then
I thought this was the default behaviour (all the Adobe docs seem to indicate
When the menu of a QTabWidget grows beyond its width, the default behaviour is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.