I'm trying to get vim to do code folding with my python code and I could really use your help with the last bit here.
I have this in my
set number "set tabstop=2 "set expandtab "set sw=2 set nowrap syntax on set linebreak set textwidth=80 set background=dark " Enable folding set foldmethod=indent set foldlevel=99 filetype plugin indent on " Enable folding with the spacebar nnoremap <space> za
I've been testing with the following file
from filelock import FileLock import yaml def main() -> int: """ main control loop """ #Read config file read_config() #Lock
I've tried this file with double spaces, four spaces, single tabs, so far nothing has worked. Everything results in "E490 fold not found".
I've tried running
set foldmethod=indent after loading the file, I've confirmed that
:set syntax returns
syntax=python, I've tried a ruby file and code folding works there so it appears to be something about the python I've crafted that it doesn't like.
I've tried without the python type hinting (
-> int), no change.
I tried installing vim from brew, confirmed I'm using vim from the new path, no change.
I've tried replicating this on a Debian Buster vm so I don't think it's mac specific.
I even tried putting an 'end' which isn't syntactically correct at the end of the function definition just as an experiment, that didn't work either.
This is the output of
macOS version - x86_64 Included patches: 1-2900 Compiled by Homebrew Huge version without GUI. Features included (+) or not (-): +acl -farsi +mouse_sgr +tag_binary +arabic +file_in_path -mouse_sysmouse -tag_old_static +autocmd +find_in_path +mouse_urxvt -tag_any_white +autochdir +float +mouse_xterm -tcl -autoservername +folding +multi_byte +termguicolors -balloon_eval -footer +multi_lang +terminal +balloon_eval_term +fork() -mzscheme +terminfo -browse +gettext +netbeans_intg +termresponse ++builtin_terms -hangul_input +num64 +textobjects +byte_offset +iconv +packages +textprop +channel +insert_expand +path_extra +timers +cindent +ipv6 +perl +title -clientserver +job +persistent_undo -toolbar +clipboard +jumplist +popupwin +user_commands +cmdline_compl +keymap +postscript +vartabs +cmdline_hist +lambda +printer +vertsplit +cmdline_info +langmap +profile +virtualedit +comments +libcall -python +visual +conceal +linebreak +python3 +visualextra +cryptv +lispindent +quickfix +viminfo +cscope +listcmds +reltime +vreplace +cursorbind +localmap +rightleft +wildignore +cursorshape +lua +ruby +wildmenu +dialog_con +menu +scrollbind +windows +diff +mksession +signs +writebackup +digraphs +modify_fname +smartindent -X11 -dnd +mouse -sound -xfontset -ebcdic -mouseshape +spell -xim +emacs_tags +mouse_dec +startuptime -xpm +eval -mouse_gpm +statusline -xsmp +ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard +extra_search +mouse_netterm +syntax -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/local/share/vim" Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: clang -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lm -lncurses -liconv -lintl -framework AppKit -L/usr/local/opt/lua/lib -llua5.4 -mmacosx-version-min=11.3 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0/darwin-thread-multi-2level/CORE -lperl -L/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin -lpython3.9 -framework CoreFoundation -lruby.3.0 -L/usr/local/Cellar/ruby/3.0.1/lib
Any ideas how else to poke at or fix this? It's probably something small and silly so Ill apologize now, I just can't see it at the moment.. Thanks in advance!
filetype plugin indent on to vimrc, recommended in comments.