Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
openPlugin.vim47 linesDownload Raw Back to plugin
1vim9script2 3# Vim runtime support library4#5# Maintainer:   The Vim Project <https://github.com/vim/vim>6# Last Change:  2025 Jun 227 8if exists("g:loaded_openPlugin") || &cp9  finish10endif11g:loaded_openPlugin = 112 13import autoload 'dist/vim9.vim'14 15command -complete=shellcmd -nargs=1 Launch vim9.Launch(trim(<f-args>))16 17# technically, -nargs=1 is correct, but this throws E480: No match18# when the argument contains a wildchar on Windows19command -complete=file -nargs=* Open vim9.Open(trim(<f-args>))20# Use URLOpen when you don't want completion to happen21# (or because you want to avoid cmdline-special)22command -nargs=1 URLOpen vim9.Open(trim(<f-args>))23 24const no_gx = get(g:, "nogx", get(g:, "netrw_nogx", false))25if !no_gx26  def GetWordUnderCursor(): string27    const url = matchstr(expand("<cWORD>"), '\%(\%(http\|ftp\|irc\)s\?\|file\)://\S\{-}\ze[^A-Za-z0-9/]*$')28    if !empty(url)29      return url30    endif31 32    const user_var = get(g:, 'gx_word', get(g:, 'netrw_gx', '<cfile>'))33    return expand(user_var)34  enddef35 36  if maparg('gx', 'n') == ""37    nnoremap <Plug>(open-word-under-cursor) <scriptcmd>vim9.Open(GetWordUnderCursor())<CR>38    nmap gx <Plug>(open-word-under-cursor)39  endif40  if maparg('gx', 'x') == ""41    xnoremap <Plug>(open-word-under-cursor) <scriptcmd>vim9.Open(getregion(getpos('v'), getpos('.'), { type: mode() })->join())<CR>42    xmap gx <Plug>(open-word-under-cursor)43  endif44endif45 46# vim: ts=8 sts=2 sw=2 et47 
codekingpro/portable-devtools · Team Ai