New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on opening file in neovim #2774
Comments
How did you install VimTeX? Which version of Vim or neovim are you using? What is your configuration?
Where did you see that suggestion? This option is irrelevant to VimTeX and you don't need it. |
I cloned the repository and installed via VimPlug. I use neovim version 0.9.1 with following configuration: let mapleader =","
if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim
autocmd VimEnter * PlugInstall
endif
map ,, :keepp /<++><CR>ca<
imap ,, <esc>:keepp /<++><CR>ca<
call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"'))
Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree'
Plug 'junegunn/goyo.vim'
Plug 'jreybert/vimagit'
Plug 'vimwiki/vimwiki'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-commentary'
Plug 'ap/vim-css-color'
Plug 'lervag/vimtex'
Plug 'SirVer/ultisnips'
Plug 'KeitaNakamura/tex-conceal.vim'
Plug 'dylanaraps/wal'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
call plug#end()
set title
set bg=light
set go=a
set mouse=a
set nohlsearch
set clipboard+=unnamedplus
set noshowmode
set noruler
set laststatus=0
set noshowcmd
" Some basics:
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
" Enable autocompletion:
set wildmode=longest,list,full
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Perform dot commands over visual blocks:
vnoremap . :normal .<CR>
" Goyo plugin makes text more readable when writing prose:
map <leader>f :Goyo \| set bg=light \| set linebreak<CR>
" Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>o :setlocal spell! spelllang=de,en<CR>
setlocal spellfile=/home/yannik/.config/nvim/spell/de.utf-8.add,/home/yannik/.config/nvim/spell/en.utf-8.add
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
" Nerd tree
map <leader>n :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
if has('nvim')
let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks'
else
let NERDTreeBookmarksFile = '~/.vim' . '/NERDTreeBookmarks'
endif
" vimling:
nm <leader>d :call ToggleDeadKeys()<CR>
imap <leader>d <esc>:call ToggleDeadKeys()<CR>a
nm <leader>i :call ToggleIPA()<CR>
imap <leader>i <esc>:call ToggleIPA()<CR>a
nm <leader>q :call ToggleProse()<CR>
" Shortcutting split navigation, saving a keypress:
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Replace ex mode with gq
map Q gq
" Check file in shellcheck:
map <leader>s :!clear && shellcheck -x %<CR>
" Open my bibliography file in split
map <leader>b :vsp<space>$BIB<CR>
map <leader>r :vsp<space>$REFER<CR>
" Replace all is aliased to S.
nnoremap S :%s//g<Left><Left>
" Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| !compiler "%:p"<CR>
" Open corresponding .pdf/.html or preview
map <leader>p :silent !opout "%:p"<CR>
" Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear %
" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
map <leader>v :VimwikiIndex<CR>
let g:vimwiki_list = [{'path': '~/.local/share/nvim/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]
autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff
autocmd BufRead,BufNewFile *.tex set filetype=tex
" Save file as sudo on files that require root permission
cabbrev w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
" Enable Goyo by default for mutt writing
autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80
autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo | set bg=light
autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR>
autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q!<CR>
" Automatically deletes all trailing whitespace and newlines at end of file on save. & reset cursor position
autocmd BufWritePre * let currPos = getpos(".")
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritePre * %s/\n\+\%$//e
autocmd BufWritePre *.[ch] %s/\%$/\r/e " add trailing newline for ANSI C standard
autocmd BufWritePre *neomutt* %s/^--$/-- /e " dash-dash-space signature delimiter in emails
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
" When shortcut files are updated, renew bash and ranger configs with new material:
autocmd BufWritePost bm-files,bm-dirs !shortcuts
" Run xrdb whenever Xdefaults or Xresources are updated.
autocmd BufRead,BufNewFile Xresources,Xdefaults,xresources,xdefaults set filetype=xdefaults
autocmd BufWritePost Xresources,Xdefaults,xresources,xdefaults !xrdb %
" Recompile dwmblocks on config edit.
autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }
" Turns off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable.
if &diff
highlight! link DiffText MatchParen
endif
" Function for toggling the bottom statusbar:
let s:hidden_all = 0
function! ToggleHiddenAll()
if s:hidden_all == 0
let s:hidden_all = 1
set noshowmode
set noruler
set laststatus=0
set noshowcmd
else
let s:hidden_all = 0
set showmode
set ruler
set laststatus=2
set showcmd
endif
endfunction
nnoremap <leader>h :call ToggleHiddenAll()<CR>
" Load command shortcuts generated from bm-dirs and bm-files via shortcuts script.
" Here leader is ";".
" So ":vs ;cfz" will expand into ":vs /home/<user>/.config/zsh/.zshrc"
" if typed fast without the timeout.
silent! source ~/.config/nvim/shortcuts.vim
" This is necessary for VimTeX to load properly. The "indent" is optional.
" Note that most plugin managers will do this automatically.
filetype plugin indent on
" This enables Vim's and neovim's syntax-related features. Without this, some
" VimTeX features will not work (see ":help vimtex-requirements" for more
" info).
syntax enable
" Viewer options: One may configure the viewer either by specifying a built-in
" viewer method:
let g:vimtex_view_method = 'zathura'
" Or with a generic interface:
let g:vimtex_view_general_viewer = 'zathura'
let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
" VimTeX uses latexmk as the default compiler backend. If you use it, which is
" strongly recommended, you probably don't need to configure anything. If you
" want another compiler backend, you can change it as follows. The list of
" supported backends and further explanation is provided in the documentation,
" see ":help vimtex-compiler".
let g:vimtex_compiler_method = 'latexmk'
" Most VimTeX mappings rely on localleader and this can be changed with the
" following line. The default is usually fine and is the symbol "\".
let maplocalleader = ","
let g:tex_flavor='latex'
let g:vimtex_quickfix_method=0
set conceallevel=1
let g:tex_conceal='abdmg'
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
hi Conceal ctermbg=none
" setlocal spell
" set spelllang=en_us, de
inoremap <C-l> <c-g>u<Esc>[s1z=`]a<c-g>u
" colorscheme wal
set background=dark
autocmd BufWritePost *.tex :silent !compiler "%:p"
let g:deoplete#enable_at_startup = 1
call deoplete#custom#option('ignore_sources', {'_': ['around', 'buffer']})
inoremap <C-f> <Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.g:vimtex#root.'/figures/"'<CR><CR>:w<CR>
nnoremap <C-f> : silent exec '!inkscape-figures edit "'.g:vimtex#root.'/figures/" > /dev/null 2>&1 &'<CR><CR>:redraw!<CR>
if has('unix')
language messages C
else
language messages en
endif I can compile without problems, the concealment works fine but the commands like
I saw this suggestion on a closed Issue where an user hat also problems when opening a latex document. |
To test I also installed vim, linked my init.vim to .vimrc installed the plugins via vim-plug and got the same result all plugins worked (except deoplete which was configured only for neovim) but i get the same error message for vimtex and the only vimtex command that vim and neovim can find is VimtexInverseSearch |
Thanks. I can't see anything immediately wrong. However, you are doing a lot of unnecessary stuff in your vimrc file. I won't comment on it all, because I don't have the time. But some comments are warranted:
The VimTeX specific stuff can be very much simplified. I would remove everything from "This is necessary for VimTeX to load properly" until the UltiSnips stuff with the following single line: let g:vimtex_view_method = 'zathura' The
If
Please refer to that specific closed issue, then. VimTeX is under continuous development, and things that may have been relevant 7 years ago are probably not relevant now.
I believe your problem is related to VimTeX not being properly loaded. It is impossible, so far, to say exactly why. But I would not be surprised if you have installed another LaTeX plugin for Vim in your system. It is easy to check. Do this:
|
Yeah the config is very bad it's from an old server, when i didn't hat any experience no i changed distros and something broke with it and now i want to fix everything and clean everything up, hopefully without having to redo everything
this setting actually is global it works fine and if i comment this line out the concealment is gone
Oh sorry you are right i compile with an autocommand i had the hopes it didn't conflict but maybe there is the error.
|
No, it is not global. But it does probably work fine. But knowing and understanding that it is not local is smart, because it may help understand when things don't work as you expect.
Let me stop you there: You showed earlier that you used vim-plug, but this is clearly packer! Thus, you must have shown me the wrong configuration..? Also, it seems like VimTeX is loaded as expected. One good way to debug this is to "bisect" your vimrc file. Remove all the stuff that is not relevant and check regularly if things start to work. When you are down to the minimum config for VimTeX things really should work, and if not, then you may have a bug report at the end. |
Clearly the problem is my old config full of junk. I think the best thing is to clear everything and start from new with a clean file. Thanks for your time nevertheless I will make an new config and keep it clean this time. This will take some time but maybe it's the best to solve this problem and prevent future errors |
Well, in my opinion it has good value to create a reasonably clean configuration. And, at least for some of us, it is good fun. :) I'm sorry I can't pinpoint your problem more directly, but I hope at least you are able to make a configuration that works and that you are happy with. Feel free to ask questions here if you have some. |
Description
every time i open a latex file i get following error message:
also commands like
:VimtexInfo
are not found. One suggestion was to setg:tex_flavor = 'latex'
but this doesn't helped.Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
No
VimtexInfo
The text was updated successfully, but these errors were encountered: