Merge branch 'master' into popup-to-popover
This commit is contained in:
commit
04c60cd61f
5
Makefile
5
Makefile
@ -7,10 +7,11 @@ run:
|
|||||||
RUST_BACKTRACE=1 cargo run
|
RUST_BACKTRACE=1 cargo run
|
||||||
|
|
||||||
install: install-resources
|
install: install-resources
|
||||||
mkdir -p $(PREFIX)/bin/
|
cargo install --root $(PREFIX)
|
||||||
cp target/release/nvim-gtk $(PREFIX)/bin/
|
|
||||||
|
|
||||||
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/
|
||||||
|
19
README.md
19
README.md
@ -5,15 +5,12 @@ GTK ui for neovim written in rust using gtk-rs bindings.
|
|||||||
![Main Window](/screenshots/neovimgtk-screen.png?raw=true)
|
![Main Window](/screenshots/neovimgtk-screen.png?raw=true)
|
||||||
For more screenshots and description of basic usage see [wiki](https://github.com/daa84/neovim-gtk/wiki/GUI)
|
For more screenshots and description of basic usage see [wiki](https://github.com/daa84/neovim-gtk/wiki/GUI)
|
||||||
|
|
||||||
# Font settings
|
# Configuration
|
||||||
By default gnome settings are used:
|
To setup font add next line to `ginit.vim`
|
||||||
```bash
|
|
||||||
gsettings get org.gnome.desktop.interface monospace-font-name
|
|
||||||
```
|
|
||||||
To setup font add next line to *ginit.vim*
|
|
||||||
```vim
|
```vim
|
||||||
call rpcnotify(1, 'Gui', 'Font', 'DejaVu Sans Mono 12')
|
call rpcnotify(1, 'Gui', 'Font', 'DejaVu Sans Mono 12')
|
||||||
```
|
```
|
||||||
|
for more details see [wiki](https://github.com/daa84/neovim-gtk/wiki/Configuration)
|
||||||
|
|
||||||
# Command line
|
# Command line
|
||||||
* pass nvim custom execution path (by default used `nvim` command)
|
* pass nvim custom execution path (by default used `nvim` command)
|
||||||
@ -25,6 +22,16 @@ cargo run -- --nvim-bin-path=E:\Neovim\bin\nvim.exe
|
|||||||
cargo run -- --enable-external-popup
|
cargo run -- --enable-external-popup
|
||||||
```
|
```
|
||||||
# Install
|
# Install
|
||||||
|
## From sources
|
||||||
|
By default to `/usr/local`:
|
||||||
|
```
|
||||||
|
make install
|
||||||
|
```
|
||||||
|
Or to some custom path:
|
||||||
|
```
|
||||||
|
make PREFIX=/some/custom/path install
|
||||||
|
```
|
||||||
|
|
||||||
## Ubuntu snap package
|
## Ubuntu snap package
|
||||||
Not usable for now due to some limitation!
|
Not usable for now due to some limitation!
|
||||||
|
|
||||||
|
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