home.social

#vim9script — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #vim9script, aggregated by home.social.

  1. #vimtip Better #man support when editing shell script.

    autocmd filetype sh,bash,zsh {
        g:no_man_maps = 1
        g:ft_man_open_mode = 'vert'
        runtime ftplugin/man.vim
        setlocal keywordprg=:Man
    }
    autocmd Filetype man {
        nnoremap <buffer> <silent> q :q<CR>
        setlocal keywordprg=:Man
    }
    

    Pressing K loads the man page of word under cursor in a vertical split. q closes it. See also https://vimhelp.org/filetype.txt.html#manpager.vim

    #vim #vim9script

  2. Vim9script is a statically-typed language, inspired by typescript, but much simpler and more limited.

    A recent PR lifts some of those limitations by adding generic functions to the language: vimhelp.org/vim9.txt.html#gene

    #vim #vim9 #vim9script

  3. At last night’s @mug meeting we looked at a lot of different solutions to #adventofcode day 1 in many different languages. Two that were very interesting to me were #Zig and #haskell. The way these two languages worked was really quite fascinating. After seeing real code in these two languages, I can tell they are not for me; but they were interesting and illuminating nonetheless.

    There was a solution entirely in #SQL. Another in #vim9script. Another in #swiftlang #swift (I don’t think that one’s in the repo yet). I wrote several implementations myself. The one I felt most proud of is #Python with the core written in #rustlang #rust tied together with #PyO3. The one I felt was maybe the best tool for the job was entirely based on #pandas. As I said in a previous post, I tried to solve it in #polars, but the API exposed by Polars at least as far as I could tell, made it no better than simple lists in Python. I need to get deeper knowledge here.

    The repo lives here: github.com/MichiganUnixUserGro.

  4. AFAIK, there's only one existing Vim plugin for buffer checksums, and it's quite old, relying heavily on terminal tools. I've developed a newer version using Vim9Script and the V language. Contributions and ideas are welcome.
    github.com/sevehub/vchecksum.v

  5. #Vim #NeoVim I found what was replacing all my argument lists with underscores: argtextobj.vim. This is one of my favorite plugins. It hasn’t been touched in 15 years, though. Probably something changed in the editor itself that broke it. I could abandon it; I could fix it; or I could rewrite it. I asked my friend what language it should be rewritten in. He said #vim9script of course! I disagreed. That would only work in Vim. #lua would only work in NeoVim. Maybe #vimscript from just before 9. Maybe #Python. Maybe #rustlang. All three of those would run in both. I kinda don’t want to use VimScript, but that’s technically the correct choice.

    Of course it would be waaay easier if it used the #lsp. Otherwise you’re parsing patterns and brackets and strings. Not sure such a solution works in plain old Vim.

    What does the #fediverse say?

  6. If you'd like to convert some of your Vim scripts and configuration to vim9script, this tool could be a useful starting point: github.com/ubaldot/vim9-conver

    #vim #vim9 #vim9script

  7. I wrote an emoji plugin for Vim in vim9script.

    Check it out:
    github.com/wolandark/vim-ez-em

    Its nothing fancy, just two compiled functions consist of a load of abbreviations.
    Does the job and is pretty quick.

    #vim #vimplugin #Vim9 #vim9script

  8. I am finishing up a new plugin entirely in . It seems really fast.