Plugin is not working on Ubuntu Vi IMproved 8.0
tbrandysky opened this issue · 3 comments
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 20 2021 12:26:53)
I've tried to install plugin /.vim/pack/plugins/start/SimpylFold - this works great on Centos 8 and Python code folds nicely.
When I do the same on Ubuntu (tested on two different computers ) the folding doesn't work.
I've found people debugging the functionality with echo &foldexpr which gets me 0 on Ubuntu and SimpylFold#FoldExpr(v:lnum) on Centos but I could not find any other information on how to proceed in case of problems with plugin.
I've also tried to uninstall additional ditro vim packages in case these somehow influence the SimpylFold functionality but still without success.
Could you please help me out with this? I
Thank you
Without having an Ubuntu machine on hand, it's difficult to know what to suggest.
foldexpr
is set in the ftplugin scripts, which depend on Vim detecting your file type as python
or cython
. If your configuration on Ubuntu results in a different detected filetype, then it won't be set properly.
Try running :scriptnames
after opening a Python file and see whether SimpylFold scripts appear in the list.
If foldexpr
is being set correctly by SimpylFold but then is later overridden with a 0
by some other script, then :verbose set foldexpr?
should reveal the location where it was last set.
Finally, maybe it's obvious, but your Vim has to be compiled with folding support for folding to work at all. Check the output of :version
for +folding
to see if the feature is enabled.
Thank you for the hints.
:set filetype? returns:
filetype=python
:scriptnames returns:
1: /usr/share/vim/vimrc
2: /usr/share/vim/vim81/debian.vim
3: /usr/share/vim/vim81/syntax/syntax.vim
4: /usr/share/vim/vim81/syntax/synload.vim
5: /usr/share/vim/vim81/syntax/syncolor.vim
6: /usr/share/vim/vim81/filetype.vim
7: ~/.vim/vimrc
8: /usr/share/vim/vim81/syntax/nosyntax.vim
9: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
10: /usr/share/vim/vim81/plugin/gzip.vim
11: /usr/share/vim/vim81/plugin/logiPat.vim
12: /usr/share/vim/vim81/plugin/manpager.vim
13: /usr/share/vim/vim81/plugin/matchparen.vim
14: /usr/share/vim/vim81/plugin/netrwPlugin.vim
15: /usr/share/vim/vim81/plugin/rrhelper.vim
16: /usr/share/vim/vim81/plugin/spellfile.vim
17: /usr/share/vim/vim81/plugin/tarPlugin.vim
18: /usr/share/vim/vim81/plugin/tohtml.vim
19: /usr/share/vim/vim81/plugin/vimballPlugin.vim
20: /usr/share/vim/vim81/plugin/zipPlugin.vim
21: ~/.vim/pack/plugins/start/SimpylFold/plugin/SimpylFold.vim
22: /usr/share/vim/vim81/syntax/python.vim
SimpylFold is loaded on line 21
:verbose set foldexpr? returns:
foldexpr=0
My vim supports folding
But Simpylfold is still not working. Once I try to fold I get this error:
E490: No fold found
:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 20 2021 11:42:42)
Included patches: 1-2269
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version without GUI. Features included (+) or not (-):
+acl +cindent +cursorshape +file_in_path +jumplist +mksession +mouse_xterm +printer +sound +terminal +virtualedit -xim
+arabic -clientserver +dialog_con +find_in_path +keymap +modify_fname +multi_byte +profile +spell +terminfo +visual -xpm
+autocmd -clipboard +diff +float +lambda +mouse +multi_lang -python +startuptime +termresponse +visualextra -xsmp
+autochdir +cmdline_compl +digraphs +folding +langmap -mouseshape -mzscheme +python3 +statusline +textobjects +viminfo -xterm_clipboard
-autoservername +cmdline_hist -dnd -footer +libcall +mouse_dec +netbeans_intg +quickfix -sun_workshop +textprop +vreplace -xterm_save
-balloon_eval +cmdline_info -ebcdic +fork() +linebreak +mouse_gpm +num64 +reltime +syntax +timers +wildignore
+balloon_eval_term +comments +emacs_tags +gettext +lispindent -mouse_jsbterm +packages +rightleft +tag_binary +title +wildmenu
-browse +conceal +eval -hangul_input +listcmds +mouse_netterm +path_extra -ruby -tag_old_static -toolbar +windows
++builtin_terms +cryptv +ex_extra +iconv +localmap +mouse_sgr -perl +scrollbind -tag_any_white +user_commands +writebackup
+byte_offset +cscope +extra_search +insert_expand -lua -mouse_sysmouse +persistent_undo +signs -tcl +vartabs -X11
+channel +cursorbind -farsi +job +menu +mouse_urxvt +postscript +smartindent +termguicolors +vertsplit -xfontset
Your Vim doesn't seem to be loading the ftplugin script (ftplugin/python/SimpylFold.vim
), which is what sets foldexpr
to the correct value for SimpylFold. You may have turned ftplugins off, or maybe the default configuration on Ubuntu is doing so. Try :filetype plugin on
(or put that in your .vimrc
) and then load/reload a Python buffer.