aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-03-01 14:41:58 +0100
committerGitHub <noreply@github.com>2017-03-01 14:41:58 +0100
commit504693ce66e61e2976b0af2930177a07bafbe6f3 (patch)
tree04b9dfb1e4fd70335cdd3f8de3e582484b82f5a1 /runtime
parent410da0f6781ddf394f08c5027e2cb4b271f4a53e (diff)
parent5c421080f8d993b0a825a22dc3474e40db4d780d (diff)
downloadrneovim-504693ce66e61e2976b0af2930177a07bafbe6f3.tar.gz
rneovim-504693ce66e61e2976b0af2930177a07bafbe6f3.tar.bz2
rneovim-504693ce66e61e2976b0af2930177a07bafbe6f3.zip
Merge #6139 from justinmk/win32-runtime
win/package: runtime files
Diffstat (limited to 'runtime')
-rw-r--r--runtime/plugin/gui_shim.vim73
1 files changed, 73 insertions, 0 deletions
diff --git a/runtime/plugin/gui_shim.vim b/runtime/plugin/gui_shim.vim
new file mode 100644
index 0000000000..28d82eb1c7
--- /dev/null
+++ b/runtime/plugin/gui_shim.vim
@@ -0,0 +1,73 @@
+" A Neovim plugin that implements GUI helper commands
+if !has('win32') || !has('nvim') || exists('g:GuiLoaded')
+ finish
+endif
+let g:GuiLoaded = 1
+
+" A replacement for foreground()
+function! GuiForeground() abort
+ call rpcnotify(0, 'Gui', 'Foreground')
+endfunction
+
+" Set maximized state for GUI window (1 is enabled, 0 disabled)
+function! GuiWindowMaximized(enabled) abort
+ call rpcnotify(0, 'Gui', 'WindowMaximized', a:enabled)
+endfunction
+
+" Set fullscreen state for GUI window (1 is enabled, 0 disabled)
+function! GuiWindowFullScreen(enabled) abort
+ call rpcnotify(0, 'Gui', 'WindowFullScreen', a:enabled)
+endfunction
+
+" Set GUI font
+function! GuiFont(fname, ...) abort
+ let force = get(a:000, 0, 0)
+ call rpcnotify(0, 'Gui', 'Font', a:fname, force)
+endfunction
+
+" Set additional linespace
+function! GuiLinespace(height) abort
+ call rpcnotify(0, 'Gui', 'Linespace', a:height)
+endfunction
+
+" Configure mouse hide behaviour (1 is enabled, 0 disabled)
+function! GuiMousehide(enabled) abort
+ call rpcnotify(0, 'Gui', 'Mousehide', a:enabled)
+endfunction
+
+" The GuiFont command. For compatibility there is also Guifont
+function s:GuiFontCommand(fname, bang) abort
+ if a:fname ==# ''
+ if exists('g:GuiFont')
+ echo g:GuiFont
+ else
+ echo 'No GuiFont is set'
+ endif
+ else
+ call GuiFont(a:fname, a:bang ==# '!')
+ endif
+endfunction
+command! -nargs=? -bang Guifont call s:GuiFontCommand("<args>", "<bang>")
+command! -nargs=? -bang GuiFont call s:GuiFontCommand("<args>", "<bang>")
+
+function s:GuiLinespaceCommand(height) abort
+ if a:height ==# ''
+ if exists('g:GuiLinespace')
+ echo g:GuiLinespace
+ else
+ echo 'No GuiLinespace is set'
+ endif
+ else
+ call GuiLinespace(a:height)
+ endif
+endfunction
+command! -nargs=? GuiLinespace call s:GuiLinespaceCommand("<args>")
+
+" GuiDrop('file1', 'file2', ...) is similar to :drop file1 file2 ...
+" but it calls fnameescape() over all arguments
+function GuiDrop(...)
+ let l:fnames = deepcopy(a:000)
+ let l:args = map(l:fnames, 'fnameescape(v:val)')
+ exec 'drop '.join(l:args, ' ')
+ doautocmd BufEnter
+endfunction