daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
718 stars 56 forks source link

How to get current GUI font parameters? #36

Open unclechu opened 6 years ago

unclechu commented 6 years ago

Is there any method to get current font configuration? Like kinda let result = rpcrequest(1, 'Gui', 'Font')?

daa84 commented 6 years ago

No, such method does not exists, but it is possible to implement

unclechu commented 6 years ago

@daa84 this would be cool, to be able to control increasing/decreasing font-size from vim-code for example.

christopher-l commented 6 years ago

Increasing/decreasing the font size from Vimscript is possible if you don't want to change the font of open vim instances. My ginit.vim does basically that.

Doesn't solve the initial problem, but working Ctrl + - / + / 0 is very satisfying. :)

daa84 commented 6 years ago

what good solution here? how rpc api can look like? add command for increase/decrease font size or return font description?

unclechu commented 6 years ago

@daa84 I don't personally need actual 'increase' or 'decrease' functions, I could easily implement them if I could just get current font-family and font-size. You could look on my implementation for neovim-qt, it's based on global variable g:GuiFont.

hasufell commented 6 years ago

g:GuiLoaded should probably be implemented for neovim-gtk too

mcepl commented 5 years ago

Well, would it be possible to re-enable guifont option? It works for gvim, but it seems a way more vim-nature, than weird call rpcnotify() call (which would probably still be used in the background). Of course, it would be lovely if the option was bi-directional (so, reading the variable, so it would read the current information via mechanism discussed here).

daa84 commented 5 years ago

looks like it possible to use guifont within option_set event

mcepl commented 5 years ago

looks like it possible to use guifont within option_set event

I am sorry, could you show me some example how to use it? If I just run

:set guifont=Fira\ Code\ Medium\ 11

then the font used by the gui doesn't change (as it does with gvim).

daa84 commented 5 years ago

no it is not implemented, this mean that it is easily can be implemented 😄

unclechu commented 5 years ago

@mcepl You could look at how I personally do it: https://github.com/unclechu/neovimrc/blob/fd9160e34206bbc637de130f3a41d759942dd38c/ginit.vim#L12-L68