parent
c16f70ac1d
commit
64c5fb1147
2
Makefile
2
Makefile
@ -10,6 +10,8 @@ install: install-resources
|
|||||||
cargo install --root $(PREFIX)
|
cargo install --root $(PREFIX)
|
||||||
|
|
||||||
install-resources:
|
install-resources:
|
||||||
|
mkdir -p $(PREFIX)/share/nvim-gtk/
|
||||||
|
cp -r runtime $(PREFIX)/share/nvim-gtk/
|
||||||
mkdir -p $(PREFIX)/share/applications/
|
mkdir -p $(PREFIX)/share/applications/
|
||||||
cp desktop/nvim-gtk.desktop $(PREFIX)/share/applications/
|
cp desktop/nvim-gtk.desktop $(PREFIX)/share/applications/
|
||||||
mkdir -p $(PREFIX)/share/icons/hicolor/128x128/apps/
|
mkdir -p $(PREFIX)/share/icons/hicolor/128x128/apps/
|
||||||
|
45
runtime/plugin/nvim_gui_shim.vim
Normal file
45
runtime/plugin/nvim_gui_shim.vim
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
" A Neovim plugin that implements GUI helper commands
|
||||||
|
if !has('nvim') || exists('g:GuiLoaded')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:GuiLoaded = 1
|
||||||
|
|
||||||
|
" Set GUI font
|
||||||
|
function! GuiFont(fname, ...) abort
|
||||||
|
call rpcnotify(1, 'Gui', 'Font', s:NvimQtToPangoFont(a:fname))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Some subset of parse command from neovim-qt
|
||||||
|
" to support interoperability
|
||||||
|
function s:NvimQtToPangoFont(fname)
|
||||||
|
let l:attrs = split(a:fname, ':')
|
||||||
|
let l:size = -1
|
||||||
|
for part in l:attrs
|
||||||
|
if len(part) >= 2 && part[0] == 'h'
|
||||||
|
let l:size = strpart(part, 1)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if l:size > 0
|
||||||
|
return l:attrs[0] . ' ' . l:size
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:attrs[0]
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
" 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>")
|
||||||
|
|
14
src/nvim.rs
14
src/nvim.rs
@ -1,4 +1,5 @@
|
|||||||
use std::io::{Result, Error, ErrorKind};
|
use std::io::{Result, Error, ErrorKind};
|
||||||
|
use std::env;
|
||||||
use std::process::{Stdio, Command};
|
use std::process::{Stdio, Command};
|
||||||
use std::result;
|
use std::result;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -82,8 +83,21 @@ pub fn initialize(shell: Arc<UiMutex<shell::State>>,
|
|||||||
.arg("--headless")
|
.arg("--headless")
|
||||||
.arg("--cmd")
|
.arg("--cmd")
|
||||||
.arg("set termguicolors")
|
.arg("set termguicolors")
|
||||||
|
.arg("--cmd")
|
||||||
|
.arg("let g:GtkGuiLoaded = 1")
|
||||||
.stderr(Stdio::inherit());
|
.stderr(Stdio::inherit());
|
||||||
|
|
||||||
|
if let Ok(runtime_path) = env::var("NVIM_GTK_RUNTIME_PATH") {
|
||||||
|
cmd.arg("--cmd")
|
||||||
|
.arg(format!("let &rtp.=',{}'", runtime_path));
|
||||||
|
}
|
||||||
|
else if let Some(prefix) = option_env!("PREFIX") {
|
||||||
|
cmd.arg("--cmd")
|
||||||
|
.arg(format!("let &rtp.=',{}/share/nvim-gtk/runtime'", prefix));
|
||||||
|
} else {
|
||||||
|
cmd.arg("--cmd").arg("let &rtp.=',runtime'");
|
||||||
|
}
|
||||||
|
|
||||||
let session = Session::new_child_cmd(&mut cmd);
|
let session = Session::new_child_cmd(&mut cmd);
|
||||||
|
|
||||||
let session = match session {
|
let session = match session {
|
||||||
|
Loading…
Reference in New Issue
Block a user