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 8189729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:22:51+00:00 2026-06-07T03:22:51+00:00

I’m a beginner in vimscript and even if I search the web for hours

  • 0

I’m a beginner in vimscript and even if I search the web for hours I haven’t be able to find how to do the following thing :

I want to create a vimscript who will allow to open a file by typing just some letters :

Assuming

  • I only search in the current working directory
  • I have a python script that could look recursively through the folders and store the files with the given letters in an array

What I want

<leader><leader>p call a function that will do what is necessary (I don’t know what exactly for the moment…)

This function will ask the user to enter the desired letters. While he enter letters, a menu will display the available results (so, this menu needs to be refreshed automaticaly).

I wish that the user could end to type and just move to the desired file by highlighting it.

For exemple :

Autocompletion exemple

What I currently have

if !has('python')
    echo "Error: Sublime Search require vim compiled with +python"
    finish
endif

let s:current_file=expand("<sfile>:r")
let s:script_path = s:current_file . '.py'
exec 'pyfile ' . s:script_path

function SublimeSearchTrigger()

    python lookFor()

endfun

if !exists('g:sublimesearch_keys')
    let g:sublimesearch_keys = 1
endif

if g:sublimesearch_keys
    inoremap <leader><leader>p :call SublimeSearchTrigger()<cr>
    nnoremap <leader><leader>p :call SublimeSearchTrigger()<cr>
endif

And the python file

# -*- encoding: utf-8 -*-

import vim
import sys

def lookFor():

    # Ask user to type something to find
    vim.command("let user_input = input('Sublime search : ')")
    vim.command("call inputrestore()")

    # Visual return of what we typed
    vim.current.buffer.append( vim.eval( 'user_input' ) )

How to start ?

As you can see I’m not sure how to start but I’m really motivated (I’m planning more complex functionalities but there will be implemented with python).

Could someone help me to start ?

Thanks,

Damien

  • 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-07T03:22:52+00:00Added an answer on June 7, 2026 at 3:22 am

    What you show in your screenshot is the wildmenu of the command-line. You can add custom completion to your own commands, see :help :command-completion-custom. Unfortunately, you cannot change the completion behavior of built-in commands like :edit (but you could define your own wrapper command :Edit and make that use your complete function).

    The second mechanism is the insert mode completion (:help ins-completion-menu). This is used for autocompletion, snippets, any text entered into the buffer. Unless you want to insert your file names into the buffer (e.g. for completion of import statements), this isn’t the right thing for you.

    Many plugins implement their own completion mechanism, as this offers the most control. They create a new, split scratch buffer, and use that for displaying the matches, often in combination with the insert-mode completion menu (but not for inserting the chosen text, but acting on it). Have a look at the FuzzyFinder plugin, it employs this very well, and even allows to plug in custom data providers (that could be your Python script!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.