equalsraf / neovim-qt

Neovim client library and GUI, in Qt5.
https://github.com/equalsraf/neovim-qt/wiki
ISC License
1.85k stars 171 forks source link

neovim-qt fails to start when calling Guifont in init #444

Closed owais closed 6 years ago

owais commented 6 years ago

neovim-qt does not start for me if I set Guifont in the init file. When Guifont is set, it results in the following error:

Request 1 timed out: 135                                                                                             
Neovim fatal error "Neovim is taking too long to respond"

when I have

Guifont ubuntu mono:h18

in ~/.config/nvim/init.vim

If I remove the line, nvim-qt starts fine and then I can call :Guifont ubuntu mono:h18 manually to make it work.

I have equalsraf/neovim-gui-shim plugin installed as well. I think I'm probably using the config wrong.

neovim-qt version is 0.2.8.3

nvim --version                                                                                                           0|00:09:12
NVIM v0.2.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-_mzR4z/neovim-0.2.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=2 -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/neovim-_mzR4z/neovim-0.2.2/build/config -I/build/neovim-_mzR4z/neovim-0.2.2/src -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/build/neovim-_mzR4z/neovim-0.2.2/build/src/nvim/auto -I/build/neovim-_mzR4z/neovim-0.2.2/build/include
Compiled by pkg-vim-maintainers@lists.alioth.debian.org

Features: +acl +iconv +jemalloc +tui 
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Here is my full config:

filetype plugin indent on
syntax enable

let g:python_host_prog="/usr/bin/python2"
let g:python3_host_prog="/usr/bin/python3"

function! DoRemote(arg)
  UpdateRemotePlugins
endfunction

call plug#begin('~/.nvim/plugged')

Plug 'equalsraf/neovim-gui-shim'
Plug 'juliosueiras/vim-terraform-completion'
Plug 'mindriot101/vim-yapf'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-fugitive'
Plug 'editorconfig/editorconfig-vim'
Plug 'scrooloose/nerdcommenter'
Plug 'simnalamburt/vim-mundo'
Plug 'gcmt/taboo.vim'
Plug 'idris-hackers/idris-vim'
Plug 'Shougo/neoinclude.vim'
Plug 'xolox/vim-misc'
Plug 'tell-k/vim-autoflake'
Plug 'tell-k/vim-autopep8'
Plug 'fisadev/vim-isort'
Plug 'xolox/vim-session'
Plug 'alvan/vim-closetag'
Plug 'mbbill/undotree'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'benekastah/neomake'
Plug 'majutsushi/tagbar', { 'do': 'sudo apt install ctags' }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'jamessan/vim-gnupg'
Plug 'mhartington/oceanic-next'
Plug 'sheerun/vim-wombat-scheme'
Plug 'ryanoasis/vim-devicons' 
Plug 'Raimondi/delimitMate'
Plug 'itchyny/lightline.vim'
Plug 'Chiel92/vim-autoformat'
Plug 'Shougo/deoplete.nvim', { 'do': function('DoRemote') }
Plug 'davidhalter/jedi-vim'
Plug 'dart-lang/dart-vim-plugin'
Plug 'fatih/vim-go'
Plug 'zchee/deoplete-go', { 'do': 'make'}
Plug 'nvie/vim-flake8'
Plug 'zchee/deoplete-jedi'
Plug 'mhartington/deoplete-typescript'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'pangloss/vim-javascript',
Plug 'jelera/vim-javascript-syntax',
Plug 'mxw/vim-jsx',
Plug 'flowtype/vim-flow'
Plug 'othree/yajs.vim',
Plug 'isRuslan/vim-es6',
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' }
call plug#end()

let $NVIM_TUI_ENABLE_TRUE_COLOR=1
set encoding=utf-8
set nu
colorscheme OceanicNext
set background=dark

if (has("termguicolors"))
 set termguicolors
endif

let g:base16_airline=1

Guifont ubuntu mono:h18

let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ }

let mapleader=" "

let $FZF_DEFAULT_COMMAND = 'ag -g ""'

nnoremap <Leader>o :FZF<CR>
nnoremap <Leader>w :w<CR>

" airline
let g:airline#extensions#tabline#fnamemod = ':~'

" autoformat
noremap <F3> :Autoformat<CR>

" Easily source vimrc
noremap <C-F12> :source ~/.config/nvim/init.vim<cr> 
" Open virmrc for editing easily
noremap <F12> :tabnew ~/.config/nvim/init.vim<cr>

" Left/Right switch Tabs
noremap <Right> <Esc>:tabnext<cr>
noremap <Left> <Esc>:tabprevious<cr>

" map copy/paste to system clipboard
vmap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P

nmap <Leader><Leader> V

" Automatically jump to end of text you pasted:
vnoremap <silent> y y`]
vnoremap <silent> p p`]
nnoremap <silent> p p`]

nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

" Undo tree
nnoremap <leader>u :UndotreeToggle<cr>

let g:deoplete#enable_at_startup = 1
let g:deoplete#sources = {}
let g:deoplete#sources.python = ['jedi']
let g:deoplete#sources#jedi#enable_cache = 0

" Use deoplete.
"let g:deoplete#enable_at_startup = 1
set completeopt=menu
"let g:deoplete#enable_ignore_case = 'ignorecase'
"let g:deoplete#auto_completion_start_length = 0
"let g:min_pattern_length = 0

"inoremap <silent><expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
"let g:deoplete#omni#input_patterns = {}

"let g:tern_show_argument_hints = 'on_hold'
"let g:tern_show_signature_in_pum = 1

"let g:deoplete#ignore_sources = {}
" let g:deoplete#ignore_sources._ = ['buffer', 'vim', 'member']
"let g:deoplete#sources = {}
"let g:deoplete#sources.python = ['jedi']
"let g:deoplete#sources.javascript = ['ternjs']
"let g:deoplete#sources#go= 'vim-go'

" closetag
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js"

" Neomake
autocmd! BufWritePost,BufEnter * Neomake

set colorcolumn=99
set bsdir=current
try
    set switchbuf=usetab
    set stal=2
catch
endtry
set expandtab
set shiftwidth=2
set tabstop=2
set softtabstop=2
set smarttab
set shiftround
set ignorecase
set smartcase
set showmatch
set showcmd
set foldlevel=99 

set autoindent
set smartindent
set wrap  "Wrap lines
set formatoptions=1 "visual wrap only
set lbr
set tw=500

set scrolloff=10

set wildmenu
set showcmd

" Fix Backspace
set backspace=indent,eol,start
set nobackup
set nowb
set noswapfile
set noerrorbells visualbell t_vb=
set mouse=a

set hlsearch
set incsearch
set showmatch

set listchars=tab:>-,trail:-,nbsp:-
set list

"Sessions
let g:sessions_project_path = "$HOME/projects"
let g:session_autosave = 'yes'
let g:session_autoload = 'no'
let g:session_persist_font = 0
let g:session_persist_colors = 0

" Required for operations modifying multiple buffers like rename.
set hidden

" Golang
autocmd FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
au FileType go nmap <Leader>gb <Plug>(go-doc-browser)<Paste>
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <Leader>e <Plug>(go-rename)
au FileType go nmap <leader>rt <Plug>(go-run-tab)
au FileType go nmap <Leader>t <Plug>(go-implements)
au FileType go set nolist

let g:go_fmt_command = "gofmt"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1

" Dart
autocmd BufWritePost *.dart DartFmt

" Python
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4 colorcolumn=99
\ formatoptions+=croq softtabstop=4 smartindent
\ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
let python_highlight_all=1
let g:autopep8_disable_show_diff=1
let g:autoflake_disable_show_diff=1

" Function to activate a virtualenv in the embedded interpreter for
" omnicomplete and other things like that.
function! LoadVirtualEnv()
    let cwd = getcwd()

    if !empty(glob(cwd . '/venv-native'))
      let venv = cwd . '/venv-native/bin/'
    else
      let venv = cwd . '/venv/bin/'
    endif

    if !empty(glob(venv . 'python2'))
      let g:python_host_prog = venv . 'python2'
    endif

    if !empty(glob(venv . 'python3'))
      let g:python3_host_prog = venv . 'python3'
    endif

    let g:neomake_python_enabled_makers = ['flake8', 'mypy']
    let g:neomake_python_flake8_maker = {
      \ 'exe': venv . 'flake8'
      \ }
    let g:neomake_python_mypy_maker = {
      \ 'exe': venv . 'mypy'
      \ }
    let g:deoplete#sources#jedi#python_path = venv . 'python'
    silent UpdateRemotePlugins

    let activate_file = venv . 'activate'
    if getftype(cwd) == "dir" && filereadable(activate_file)
        python << EOF
import sys, os

cwd = vim.eval('l:cwd')

base = os.path.join(cwd, 'venv-native')
if not os.path.exists(base):
  base = os.path.join(cwd, 'venv')

old_os_path = os.environ.get('PATH', '')
os.environ['PATH'] = os.path.join(base, 'bin') + os.pathsep + old_os_path

site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'site-packages')

prev_sys_path = list(sys.path)
import site
site.addsitedir(site_packages)
sys.real_prefix = sys.prefix
sys.prefix = base
# Move the added items to the front of the path:
new_sys_path = []
for item in list(sys.path):
    if item not in prev_sys_path:
        new_sys_path.append(item)
        sys.path.remove(item)
sys.path[:0] = new_sys_path
EOF
    endif
endfunction

" Function to activate a virtualenv in the embedded interpreter for
" omnicomplete and other things like that.
function! SetPythonVenv(path)
    let cwd = getcwd()

    let g:neomake_python_enabled_makers = ['flake8',]
    let g:neomake_python_flake8_maker = {
      \ 'exe': cwd . '/venv/bin/flake8'
      \ }
    " let g:python_host_prog = cwd . '/venv/bin/python'
    let g:deoplete#sources#jedi#python_path = cwd . '/venv/bin/python'
    UpdateRemotePlugins
endfunction

autocmd FileType python call LoadVirtualEnv()
" autocmd FileType python call SetPythonVenv("venv")

" javascript
" ----------
autocmd FileType javascript setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2 colorcolumn=79 omnifunc=tern#Complete
let javascript_enable_domhtmlcss=1
let g:tern_show_signature_in_pum = 1
let g:neomake_open_list=0
let g:neomake_javascript_enabled_makers = ['eslint']
let g:neomake_jsx_enabled_makers = ['eslint']
if findfile('.eslintrc', '.;') !=# ''
  let g:neomake_javascript_eslint_maker = {
        \ 'exe': './node_modules/.bin/eslint_d'
        \ }
  let g:jsx_ext_required = 0
endif

" Web
autocmd FileType html,xhtml,xml,htmldjango,htmljinja,mako setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2 omnifunc=htmlcomplete#CompleteTags
autocmd BufNewFile,BufRead *.mako setlocal ft=mako
autocmd BufNewFile,BufRead *.tmpl setlocal ft=htmljinja
autocmd BufNewFile,BufRead *.py_tmpl setlocal ft=python
autocmd BufNewFile,BufRead *.html,*.htm  setlocal ft=html ()
let html_no_rendering=1

autocmd FileType html,htmldjango,htmljinja,mako,xhtml,js let b:closetag_html_style=1
au FileType xml,html,htmldjango,htmljinja,mako,xhtml,js let b:delimitMate_matchpairs = "(:),[:],{:}"

" rst
" ---
autocmd BufNewFile,BufRead *.rst setlocal ft=rst
autocmd FileType rst setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4 colorcolumn=79
\ formatoptions+=nqt textwidth=79

" markdown
" ---
autocmd BufNewFile,BufRead *.txt,*.markdown,*.md setlocal ft=markdown colorcolumn=79
autocmd FileType rst setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4 colorcolumn=79

" vim
" ---
autocmd FileType vim setlocal expandtab shiftwidth=2 tabstop=4 softtabstop=2

" CSS
" ---
autocmd FileType css setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4

" Custom Commands and Functions
function! _showHiddenChars()
    set listchars=tab:>-,trail:-,nbsp:-
    set list
endfunction

command! ShowHiddenChars :call _showHiddenChars()

function! _hideHiddenChars()
    set nolist
endfunction

command! HideHiddenChars :call _hideHiddenChars()

command! FormatJson :%!python -m json.tool

let g:ycm_autoclose_preview_window_after_completion = 1

" Tabs
noremap <C-t> <Esc>:tabnew<cr>
noremap <C-w> <Esc>:tabclose<cr>

" ReasonML
" let g:opamshare = substitute(system('opam config var share'),'\n$','','''')
" execute "set rtp+=" . g:opamshare . "/merlin/vim"
BoltsJ commented 6 years ago

The GUI shim commands aren't available when init.vim is sourced. You should create ginit.vim for GUI specific settings.