Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable text autocompletions #3269

Open
squili opened this issue Apr 25, 2024 · 3 comments
Open

Disable text autocompletions #3269

squili opened this issue Apr 25, 2024 · 3 comments

Comments

@squili
Copy link

squili commented Apr 25, 2024

Description of the problem or steps to reproduce

I have a file that uses tabs as part of it's specification. Specifically, you might have a file that looks like: @<tab>A<tab>1.2.3.4. When entering this using micro, sometimes micro tries to autocomplete one of the parts of the line, which forces weird cursor movements to avoid the prompts. I assume there's a setting to disable this, but I cannot find it!

Specifications

Commit hash: 68d88b5
OS: Arch Linux
Terminal: GNOME Terminal

@Andriamanitra
Copy link
Contributor

I don't know if there's a setting to disable auto-complete but bind Tab InsertTab is a nice workaround.

@dmaluka
Copy link
Collaborator

dmaluka commented Apr 25, 2024

I thing bind Tab InsertTab is the way to disable autocomplete.

The Tab key by default is bound to Autocomplete|IndentSelection|InsertTab, which means: try to autocomplete; if that failed (i.e. no completion found, or there is nothing to complete), try to indent the selection; if that failed (i.e. if there is no selection), just insert the tab.

So if you want the Tab key to just insert the tab, just bind it to InsertTab instead.

@Andriamanitra
Copy link
Contributor

One downside of using keybindings instead of having a setting is that you can't have them apply only to certain filetypes.

We could add a setting so you could do something like this in settings.json:

{
    "*.tsv": {
        "autocomplete": false
    }
}

Alternatively we could add the globbing feature from settings.json to bindings.json too? One potential issue here is that bindings.json already supports pane type specific keybindings using similar syntax which might complicate the implementation.

Or we could leave it as is. It's a pretty niche feature that's really easy to implement as a plugin:

function preAutocomplete(bufpane)
    -- disable autocomplete if filetype is set to "tsv"
    return bufpane.Buf:FileType() ~= "tsv"
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants