troubleshooting

[!TIP|label:references:]

startup scripts

[!TIP]

$ vim -V9logfile.log

$ vim --noplugin -D

:scriptnames

list all shortcut mapping

:verbose map
:map
:nmap
:vmap
:imap

:set completefunc?
completefunc=youcompleteme#CompleteFunc

show terminal type

:TERM_PROGRAM
iTerm.app

chars

[!NOTE|label:references:]

listchars shows ( unknown character )

[!NOTE|label:show printable non-ASCII characters:] reference:

python

[!NOTE|label:referenes:]

  • debug

    • :echo has(python3)

    • :py3 print('hello')

    • :set pythonthreedll?

    • full commands:

      :echo has('python3')          " expected: 1
      :echo has('python3')
      :echo has('python3_dynamic')
      :echo has('python3_compiled')
      
      " others
      :echo has('python')
      :echo has('python_dynamic')
      :echo has('python_compiled')
      
      " or
      :python3 print('hello')       " expected: hello
      :py3 print('hello')           " expected: hello
  • specific settings

    set pythonthreedll=c:\path\to\python\python37.dll
    set pythonthreehome=c:\path\to\python

MatchTagAlways unavaiable: requries python

[!TIP]

  • the python issue might caused by 32bit vim not match with 64bit python, in this case, install macvim via

    # if necessary
    $ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
    
    $ brew intall --HEAD macvim
    $ sudo ln -sf /opt/homebrew/Cellar/macvim/HEAD-45c5509/MacVim.app /Application/MacVim.app
  • issue

    $ vim
    MatchTagAlways unavaiable: requires python
    
    :py3 print('hello')
    the Python library could not be load
  • generic solution

    let g:python3_host_prog = '/path/to/python3'
    
    # in linux/osx
    let g:python3_host_prog = expand(trim( system('comamnd -v python3') ))
  • environment

    • os: ubuntu 22.04.3 LTS

    • python

      • installed from apt ppa sources

      • environment

        • /usr/local/bin/python3 -> /usr/local/bin/python -> /usr/bin/python3.12

        • /usr/local/bin/python3-config -> /usr/local/bin/python-config -> /usr/bin/python3.12

  • solution

    [!NOTE]

    $ sudo ldconfig
    # and re-build

vim: error while loading shared libraries: libpython3.11.so.1.0

  • issue

    $ vim
    vim: error while loading shared libraries: libpython3.11.so.1.0: cannot open shared object file: No such file or directory
  • env

    • os: CentOS 8.3

    • python: build from source, in /opt/python/Python3.11.6

  • solution

    $ export LD_LIBRARY_PATH=/opt/python/Python3.11.6:$LD_LIBRARY_PATH

E370: Could not load library "msys-python3.11.dll"

  • solution

    > cd c:\iMarslo\myprograms\Python3.11
    > cp python3.11.dll to msys-python3.11.dll
    
    # check $PATH contains `C:\iMarslo\myprograms\Python3.11`

windows app settings

[!NOTE|label:references:]

  • solution

    • windows 10

      • Settings -> Apps -> Apps & features -> App Execution alias

      • disable both python.exe and python3.exe

    • windows 11

      • Settings -> Apps -> Advanced app settings -> App Execution alias

      • disable both python.exe and python3.exe

  • solution

    • delete both python.exe and python3.exe from %LocalAppData%\Microsoft\WindowsApps

    • setup environment variable for manual-installation ( %LocalAppData\Programs\Python\Python311 by default )

    > cd %LocalAppData%\Microsoft\WindowsApps
    > del python.exe
    > del python3.exe
    • install via nuget.exe

      > nuget.exe install python -ExcludeVersion -OutputDirectory .
      > nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory .
  • know issues

    [!NOTE]

    • Currently, the py.exe launcher cannot be used to start Python when it has been installed from the Microsoft Store.

vimrc

[!NOTE|label:references:]

verbose

[!NOTE|label:references:]

VALUECOMMENTS

>= 1

When the viminfo file is read or written.

>= 2

When a file is ":source"'ed.

>= 5

Every searched tags file and include file.

>= 8

Files for which a group of autocommands is executed.

>= 9

Every executed autocommand.

>= 12

Every executed function.

>= 13

When an exception is thrown, caught, finished, or discarded.

>= 14

Anything pending in a ":finally" clause.

>= 15

Every executed Ex command (truncated at 200 characters).

:verbose set fileencodings?
  • general debugging with verbose

    set verbose=9
    # or
    set verbosefile=filename.txt
    
    " set verbose on startup
    vim -V9 file.text

echo

:echo has('multi_byte')
:echo has('multi_lang')

start time

[!NOTE|label:references:]

$ vim --startuptime vim.log

# compare with non-profile loaded
$ vim +q -u NONE -U NONE -N --startuptime startup-no-config.txt

# verify with specific ft
$ vim --startuptime python-startup.txt -c ":set ft=python" python-startup.txt

profile

[!NOTE|label:references:]

:profile start profile.log
:profile func *
:profile file *

{SLOW ACTIONS}

:profile pause
:qa!

messages

:messages

$ vim --cmd 'set t_RV='
:echo v:termresponse
# result :  ^[[>41;2500;0c
  • more:

    :help 'ttymouse'
    :help t_RV
    :help v:termresponse

if &term =~ '256color'
  " disable Background Color Erase (BCE)
  set t_ut=
endif
set ttyfast

Last updated