diff options
| author | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-03 22:21:25 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-04 00:23:03 +0300 |
| commit | 2eae5db069dc171f74cd863487655f6a88e5384d (patch) | |
| tree | 2d9d05e09978a2a44acbfbb8d651f240df3ca052 /uvim/runtime/plugin/openPlugin.mnv | |
| parent | 473d922faed49241a5d29d9e37dc4819cd512006 (diff) | |
| download | Project-Tick-2eae5db069dc171f74cd863487655f6a88e5384d.tar.gz Project-Tick-2eae5db069dc171f74cd863487655f6a88e5384d.zip | |
NOISSUE rebrand vim to MNV's not Vim
Signed-off-by: Mehmet Samet Duman <yongdohyun@projecttick.org>
Diffstat (limited to 'uvim/runtime/plugin/openPlugin.mnv')
| -rw-r--r-- | uvim/runtime/plugin/openPlugin.mnv | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/uvim/runtime/plugin/openPlugin.mnv b/uvim/runtime/plugin/openPlugin.mnv new file mode 100644 index 0000000000..ee51cd1acd --- /dev/null +++ b/uvim/runtime/plugin/openPlugin.mnv @@ -0,0 +1,46 @@ +mnv9script + +# MNV runtime support library +# +# Maintainer: The MNV Project <https://github.com/Project-Tick/Project-Tick> +# Last Change: 2025 Jun 22 + +if exists("g:loaded_openPlugin") || &cp + finish +endif +g:loaded_openPlugin = 1 + +import autoload 'dist/mnv9.mnv' + +command -complete=shellcmd -nargs=1 Launch mnv9.Launch(trim(<f-args>)) + +# technically, -nargs=1 is correct, but this throws E480: No match +# when the argument contains a wildchar on Windows +command -complete=file -nargs=* Open mnv9.Open(trim(<f-args>)) +# Use URLOpen when you don't want completion to happen +# (or because you want to avoid cmdline-special) +command -nargs=1 URLOpen mnv9.Open(trim(<f-args>)) + +const no_gx = get(g:, "nogx", get(g:, "netrw_nogx", false)) +if !no_gx + def GetWordUnderCursor(): string + const url = matchstr(expand("<cWORD>"), '\%(\%(http\|ftp\|irc\)s\?\|file\)://\S\{-}\ze[^A-Za-z0-9/]*$') + if !empty(url) + return url + endif + + const user_var = get(g:, 'gx_word', get(g:, 'netrw_gx', '<cfile>')) + return expand(user_var) + enddef + + if maparg('gx', 'n') == "" + nnoremap <Plug>(open-word-under-cursor) <scriptcmd>mnv9.Open(GetWordUnderCursor())<CR> + nmap gx <Plug>(open-word-under-cursor) + endif + if maparg('gx', 'x') == "" + xnoremap <Plug>(open-word-under-cursor) <scriptcmd>mnv9.Open(getregion(getpos('v'), getpos('.'), { type: mode() })->join())<CR> + xmap gx <Plug>(open-word-under-cursor) + endif +endif + +# mnv: ts=8 sts=2 sw=2 et |
