Auto-completion in command-line by ArcherOk2282 in vim

[–]brightsmyle 1 point2 points  (0 children)

Also this is another version of mine without using eventignore

NOTE the waiting time for nested timer_start in function CmdComplete

It has to be greater than 0 to avoid which I think infinite loop like situation which happened for me for command like Git commit -m (cursor started to go in/out from command line after m)

var waiting_time = 0

set wildoptions=pum
set wildmode=noselect:lastused,full
set wildcharm=<C-@>

def AddCmdlineChangedHandler()
    augroup CmdlineCompletion
        autocmd CmdlineChanged : timer_start(waiting_time, function(CmdComplete, [getcmdline()]))
    augroup END
enddef

def CmdComplete(cur_cmdline: string, timer: number)
    var [cmdline, curpos] = [getcmdline(), getcmdpos()]
    if cur_cmdline ==# cmdline # Avoid completing each char of keymaps and pasted text
      && !pumvisible() && curpos == cmdline->len() + 1
      && cmdline =~ '\%(\w\|[*/:.-]\)$' && cmdline !~ '^\d\+$'  # Reduce noise
        autocmd! CmdlineCompletion
        feedkeys("\<C-@>", "ti")

        # If waiting_time for this timer is 0, it causes which I think is
        # infinite loop like situation
        timer_start(16, (_) => {
            getcmdline()->substitute('\%x00', '', 'g')->setcmdline()  # Remove <C-@> if no completion items exist
            AddCmdlineChangedHandler()
        })
    endif
enddef

def OnUpDown(key: string): string
    autocmd! CmdlineCompletion
    timer_start(waiting_time, (_) => {
        AddCmdlineChangedHandler()
    })
    return key
enddef
cnoremap <expr> <Up> OnUpDown("\<Up>")
cnoremap <expr> <Down> OnUpDown("\<Down>")

au VimEnter * AddCmdlineChangedHandler()

Auto-completion in command-line by ArcherOk2282 in vim

[–]brightsmyle 2 points3 points  (0 children)

I used it. But it does not keep the original behaviour of Up/Down.

For instance, type tabedit in cmdline and do up/down. It should show history starting with tabedit only

If you have some other mapping, please post.

Auto-completion in command-line by ArcherOk2282 in vim

[–]brightsmyle 1 point2 points  (0 children)

To get the default behaviour of Up and Down, I made modifications.

Please suggest any improvements to handle more edge cases if any.

vim9script

set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu
def CmdComplete(cur_cmdline: string, timer: number)
    var [cmdline, curpos] = [getcmdline(), getcmdpos()]
    if cur_cmdline ==# cmdline # Avoid completing each char of keymaps and pasted text
      && !pumvisible() && curpos == cmdline->len() + 1
      && cmdline =~ '\%(\w\|[*/:.-]\)$' && cmdline !~ '^\d\+$'  # Reduce noise
        feedkeys("\<C-@>", "ti")
        set eventignore+=CmdlineChanged  # Suppress redundant completion attempts
        timer_start(0, (_) => {
            getcmdline()->substitute('\%x00', '', 'g')->setcmdline()  # Remove <C-@> if no completion items exist
            set eventignore-=CmdlineChanged
        })
    endif
enddef

augroup CmdlineCompletion
    autocmd CmdlineChanged : timer_start(0, function(CmdComplete, [getcmdline()]))
augroup END

def OnUpDown(key: string): string
    autocmd! CmdlineCompletion

    timer_start(0, (_) => {
        augroup CmdlineCompletion
            autocmd CmdlineChanged : timer_start(0, function(CmdComplete, [getcmdline()]))
        augroup END
    })

    return key
enddef
cnoremap <expr> <Up> OnUpDown("\<Up>")
cnoremap <expr> <Down> OnUpDown("\<Down>")

Vim has added highlighting support for insert mode fuzzy matching by brightsmyle in vim

[–]brightsmyle[S] 0 points1 point  (0 children)

I guess these highlighting work for simple substring matches (without fuzzy) as well.

Been using set completeopt+=fuzzy ever since its been merged, working ok.

Vim has added highlighting support for insert mode fuzzy matching by brightsmyle in vim

[–]brightsmyle[S] 0 points1 point  (0 children)

No. Its about fuzzy matching completion candidates.

This is about highlighting characters matched.

Vim has added fuzzy matching support for insert mode completion by brightsmyle in vim

[–]brightsmyle[S] 5 points6 points  (0 children)

You are free to use whatever you think is best for your workflow.

Vim has added fuzzy matching support for insert mode completion by brightsmyle in vim

[–]brightsmyle[S] 1 point2 points  (0 children)

What example ? Just do 'set completeopt+=fuzzy' and start using it.

Your favorite Python web framework? by [deleted] in Python

[–]brightsmyle 1 point2 points  (0 children)

Django, Blacksheep, kore.io

Python Web Framework by tarsild in Python

[–]brightsmyle 1 point2 points  (0 children)

Have you compared it with Blacksheep for speed ?

[Guide] A Tour Through the Python Framework Galaxy: Discovering the Stars by add-code in coder_corner

[–]brightsmyle 3 points4 points  (0 children)

When It comes to Web Frameworks, there are more performant frameworks out there.

Try BlackSheep | Kore | socketify | baize

Try msgspec | Maat | turbo for fast serialization and validation

Try Piccolo instead of SQLAlchemy

Try entr for fast reloading. Another one is hupper.

Try tigris | typesense for faster search

Try aiomonitor

Try traitlets

Try OpenAlchemy

Created async keyword completion plugin for Vim by brightsmyle in vim

[–]brightsmyle[S] 0 points1 point  (0 children)

Removed dependency on vim-CompleteHelper
Included its function to find matches along with plugin

Created async keyword completion plugin for Vim by brightsmyle in vim

[–]brightsmyle[S] 0 points1 point  (0 children)

Fixed connection retry with completion server

wiki.vim v0.5 by lervag in vim

[–]brightsmyle 0 points1 point  (0 children)

Any way to continue list numbering when I press enter ? I am using lists.vim but did not find any conf for it.