Open moustachio-belvedere opened 3 years ago
Same here.
I found that it can be avoided by using Latex-to-Unicode via keymap.
It would be very helpful to know exactly:
g:latex_to_unicode_tab
or similar?)Anyway I just had a try. I'm actually on nvim-0.5.0 (pre-release), I don't know if it makes any difference.
I had never used coc.nvim before so I just copied over the whole example configuration that is found in their README, with all the remappings, including that of Tab.
I ran some tests without installing the julia extension for the LSP. Then I installed :CocInstall coc-julia
restarted and tested again.
What I've seen so far:
completeopt
, but the substitutions themselves seem to work to me.LaTeXtoUnicode#Disable()
has no effect. The problem is that \alpha
gets substituted with \α
, keeping the backslash. This actually seems like an issue with either LSP or coc.TextChanged
might be involved, or how julia-vim is supposed to support it exaclty.So in conclusion it's not clear to me what we could do on the julia-vim side.
@carlobaldassi Thanks for sharing your opinion and sorry for not providing the information in my case.
As you pointed out, julia-vim
itself works fine without coc-julia
(probably it's LSP; sorry. I'm not aware of details).
Probably many users with Julia and vim will consider julia-vim
and coc-julia
at the same time, so it would be very useful if you provide a guideline to resolve this issue (for example, change the way of LaTex-to-Unicode to keymap).
The following is what I experienced and I hope this is helpful. FYI, I'm using neovim v0.5. Here's my configuration file (Of course keymap-based LaTex-to-Unicode is commented out for reproducing this error. It is quite bulky and contains many comments even including Korean, sorry for that it would make you confused):
" neovim
" This is for Mac
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call plug#begin('~/.vim/plugged')
""""""""""Plug""""""""""
Plug 'gmarik/Vundle.vim'
" NERDTree: file tree
Plug 'scrooloose/nerdtree'
Plug 'vim-scripts/indentpython.vim'
" Buffergator: for convenient buffer
Plug 'jeetsukumaran/vim-buffergator'
" vim-arline: status bar
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" vim-gitgutter: Git plugin (Git changed part check)
Plug 'airblade/vim-gitgutter'
" vim-fugitive: Git plugin (Git function available)
Plug 'tpope/vim-fugitive'
" vim-rhubarb: Git plugin (for Github)
Plug 'tpope/vim-rhubarb'
" comment out and uncomment plugin
Plug 'tpope/vim-commentary' " Trigger: gc
" surround.vim
Plug 'tpope/vim-surround'
" syntastic: syntax error check
Plug 'scrooloose/syntastic'
Plug 'jpalardy/vim-slime'
" ctrlp: find file
Plug 'ctrlpvim/ctrlp.vim'
" Color scheme
Plug 'morhetz/gruvbox'
" vimtex
Plug 'lervag/vimtex'
Plug 'https://github.com/nvie/vim-flake8'
" markdown previewer
Plug 'suan/vim-instant-markdown', {'rtp': 'after'}
" Julia
Plug 'JuliaEditorSupport/julia-vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'fannheyward/coc-julia'
call plug#end()
filetype plugin indent on
set hls
set scs
set visualbell
" set ignorecase
set showmatch
set number
set clipboard=unnamed
set smartindent
set tabstop=4
set expandtab
set shiftwidth=4 " >> 또는 << 키로 들여쓰기 할 때 스페이스의 개수, 기본값 = 8"
set splitbelow
set splitright
set belloff=all " to prevent blinking (flashing)
set spell spelllang=en_us " spelling check
let &colorcolumn=join(range(80,999),",")
set fileencodings=utf-8,euc-kr
set termencoding=utf-8
set encoding=utf-8
" Mouse scroll in Vim
set mouse=a
let b:surround_{char2nr('e')}
\ = "\\begin{\1environment: \1}\n\t\r\n\\end{\1\1}"
let b:surround_{char2nr('c')} = "\\\1command: \1{\r}"
" ctrlp speed up
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|public$\|log$\|tmp$\|vendor$',
\ 'file': '\v\.(exe|so|dll)$'
\ }
let g:ctrlp_working_path_mode = 0
let g:mapleader =','
" vimtex view method
" let g:vimtex_view_method = 'zathura'
let g:vimtex_view_method = 'skim'
let g:tex_flavor = 'latex'
let g:vimtex_compiler_progname = 'nvr' " for neovim
" julia-vim
" let g:latex_to_unicode_keymap = 1 " to avoid conflict with coc-julia and
" make it available for editor command such as /
runtime macros/matchit.vim " block-wise movements
" flake8: PEP8 checker
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_loc_list_height = 3
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_tex_checkers = ['chktex']
let g:syntastic_tex_chktex_quiet_messages = {'level': 'warnings'}
let g:syntastic_python_checkers = ['flake8']
let g:syntastic_python_flake8_post_args = '--ignore=E501,E226,W503,F401,E731,E999'
""" Color scheme gruvbox
set background=dark
let g:gruvbox_italic=1 " for italic comment
let &t_ZH="\e[3m" " for italic comment
let &t_ZR="\e[23m" " for italic comment
syntax on
colorscheme gruvbox
" slime
let g:slime_target = 'tmux'
let g:slime_paste_file = tempname()
" airline extension-tabline
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#fnamemod=':t'
" markdown preview
filetype plugin on
"Uncomment to override defaults:
"let g:instant_markdown_slow = 1
let g:instant_markdown_autostart = 1
"let g:instant_markdown_open_to_the_world = 1
"let g:instant_markdown_allow_unsafe_content = 1
"let g:instant_markdown_allow_external_content = 0
let g:instant_markdown_mathjax = 1
"let g:instant_markdown_logfile = '/tmp/instant_markdown.log'
"let g:instant_markdown_autoscroll = 0
"let g:instant_markdown_port = 8888
"let g:instant_markdown_python = 1
" 모든 auto-commands를 삭제하여, vimrc 파일이 한 번 이상
" source된 경우 autocommands가 두 번 적용되는 것을 방지한다.
autocmd!
"LaTeX autocmds
" autocmd BufRead *.tex source ~/.vim-files/.vimrc.latex
" autocmd BufNewFile *.tex source ~/.vim-files/.vimrc.latex
""""""""""mapping"""""""""
" rc
nnoremap <Leader>rc :rightbelow vnew ~/.vimrc<CR>
" NERDTree
map <Leader>nt <ESC>:NERDTreeToggle<CR>
" Buffergator
" Python
map <Leader>pydb oimport ipdb; ipdb.set_trace()<ESC>
map <Leader>pym oif __name__ == ""__main__"":<ESC>opass<ESC>
" Julia
map <Leader>jlm oif abspath((PROGRAM_FILE) == @__FILE__<ESC>oend<ESC>
map <Leader>jli oinclude("
" MATLAB
map <Leader>mtdb okeyboard;<ESC>
map <Leader>mtc <S-O><ESC>wi%<SPACE><ESC>kdd
" for general
inoremap { {}<Left>
inoremap {<CR> {<CR>}<ESC>0
inoremap {{ {
inoremap {} {}
inoremap ( ()<Left>
inoremap (<CR> (<CR>)<ESC>0
inoremap (( (
inoremap () ()
inoremap [ []<Left>
inoremap [<CR> [<CR>]<ESC>0
inoremap [[ [
inoremap [] []
inoremap ' ''<Left>
inoremap '' '
inoremap " ""<Left>
inoremap "" "
inoremap """ """
inoremap <C-H> <C-O>h
inoremap <C-J> <C-O>j
inoremap <C-K> <C-O>k
inoremap <C-L> <C-O>a
" the below mappings are mostly only for LaTeX"
" Note: vimtex instruction
" motions
" " [[, [], ][, ]]
" " [m, [M, ]m, ]M
" " [*, ]*
" " %
" text objects
" " ic ac
" " id ad
" " ie ae
" " i$ a$
" " iP aP
" other mappings
inoremap <Leader>{ \{\}<Left><Left>
inoremap <Leader>dd _{}<Left>
inoremap <Leader>uu ^{}<Left>
inoremap $ $$<Left>
inoremap $$ $
inoremap ,, ,
inoremap $<CR> $<CR>$<ESC>0
inoremap <Leader>fr \frac{}{}<Left><Left><Left>
inoremap <Leader>beq \begin{equation}<CR>\end{equation}<ESC><S-O>
inoremap <Leader>bleq \begin{equation}<CR>\end{equation}<ESC><S-O>\label{eq:}<Left>
inoremap <Leader>bsp \begin{split}<CR>\end{split}<ESC><S-O>
inoremap <Leader>bal \begin{align}<CR>\end{align}<ESC><S-O>
inoremap <Leader>blal \begin{align}<CR>\end{align}<ESC><S-O>\label{eq:}<Left>
inoremap <Leader>pipe \|>
inoremap <Leader>map ->
inoremap -> \rightarrow
inoremap <- \leftarrow
inoremap <Leader>bfg \begin{figure}<CR>\end{figure}<ESC><S-O>\centering<CR>\caption{}<CR>\label{fig:}<Left>
inoremap <Leader>sbfg \begin{subfigure}{.5\textwidth}<CR>\end{subfigure}<ESC><S-O>
inoremap <Leader>addfg \includegraphics[width=.8\linewidth]{}<Left>
inoremap <Leader>pthfg \graphicspath{{/}}<ESC>hhi
" Setting
syntax on
When I type \alpha
followed by <TAB>
, it fails to transform it to α
and just makes a space (as usual <TAB>
).
If I type <TAB>
again, it occurs the following error and it also makes an additional space.
[coc.nvim]: Some plugin change completeopt on insert mode: Last set from ~/.vim/plugged/julia-vim/autoload/LaTeXtoUnicode.vim line 404!
Some plugin change completeopt on insert mode: Last set from ~/.vim/plugged/julia-vim/autoload/LaTeXtoUnicode.vim line 404!
Press ENTER or type command to continue
And then, if I move the cursor to right after \alpha
and type <TAB>
, \alpha
changes to the letter α
but the same error message appears.
Apologies I don't have access to a computer I can install Julia on at the moment but my configuration at the time was the following:
Neovim 0.4.4, latest versions of coc.nvim, julia-vim. My config was exactly copy-pasted from their README at the time of testing.
If I remember correctly, coc.nvim was always making regular autocomplete suggestions, and greek unicode symbols were never suggested (though it's possible they were just so low priority I did not find them in the suggestions list).
In my set-up, I did not run :CocInstall coc-julia
as I was not aware I needed to (still getting my head around lots of new Vim information).
@carlobaldassi based on your post it sounds like things work properly when the system is set-up correctly. So if there is any issue at all, perhaps it is limited to a small documentation addition. Otherwise happy for the issue to be closed without any further discussion/changes as you think is best.
So after the latest commit things should have improved, at least the error message about completeopt
should be gone now.
@JinraeKim I have tried your configuration (but without any plugin apart from coc.nvim and julia-vim) and on the latest version of julia-vim everything seems ok.
When trying to use the LSP via CocInstall coc-julia
the issue is the one described above but it is this one: https://github.com/fannheyward/coc-julia/issues/62 and it happens even without using julia-vim at all, so it's unrelated.
@JinraeKim and @moustachio-belvedere could you confirm that the issue is solved?
@carlobaldassi Cool. The latest commit works perfectly (even with LaTeX-to-unicode via Tab) with keymap. Actually, there had been some errors even with LaTeX-to-unicode via keymap.
Unfortunately, it seems that tab completion for LaTeX-to-unicode has a minor bug; type \alpha
and tab sometimes does not transform it into α
in my case.
Anyhow, I'm satisfied with the keymap approach. Thank you very much!
Apologies if already raised elsewhere, I did try to search open and closed issues and could not find anything related.
I am using the latest version of Neovim (0.4.4), the latest version of coc.nvim language server autocompletion package, and the latest version of julia-vim.
I cannot seem to get LaTeX-to-Unicode substitutions working as described in the julia-vim documentation when coc.nvim is installed.
Someone else raised an issue about this in the coc.nvim repository:
https://github.com/neoclide/coc.nvim/issues/2120
in which it was suggested that it might be fixable if julia-vim added support for a
TextChanged
feature in coc.nvim.I'm relatively new to vim, but will try and contribute further if possible.
Many thanks for all your work so far.