[!TIP|label:references:]
startup scripts
[!TIP]
v9 logfile
$ vim -V9logfile.log
step debug
$ vim --noplugin -D
list startup files
:scriptnames
list all shortcut mapping
:verbose map
:map
:nmap
:vmap
:imap
- redirect all contents to a file
:redir > ~/Desktop/debug.txt :silent verbose map :redir END
check customized completion
:set completefunc?
completefunc=youcompleteme#CompleteFunc
show terminal type
:TERM_PROGRAM
iTerm.app
- prevent MacVim from inheriting .profile as if it was Bash itself?
$ defaults write org.vim.MacVim MMLoginShell 0
chars
[!NOTE|label:references:]
listchars
shows ▯
( unknown character )
[!NOTE|label:show printable non-ASCII characters:] reference:
reason
guifont
doesn't support.- i.e.:
debug
python
[!NOTE|label:referenes:]
- python arch version should be exact same with gvim arch version
- python x64 <-> gvim x64
- python x86 <-> gvim x86
:help feature-list
:help if_pyth
pythonthreedll
pythonthreehome
<->env.PYTHONHOME
- label to check:
+python3/dyn
+python/dyn
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
- xcode-select: error: tool 'xcodebuild' requires Xcode
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:]
- CMD opens Windows Store when I type 'python'
- The Python executable is not recognized on Windows 10
- app location:
%LocalAppData%\Microsoft\WindowsApps
- Typing “python” on Windows 10 (version 1903) command prompt opens Microsoft store
- 3. Using Python on Windows
solution
windows 10
- Settings -> Apps -> Apps & features -> App Execution alias
- disable both
python.exe
andpython3.exe
windows 11
- Settings -> Apps -> Advanced app settings -> App Execution alias
- disable both
python.exe
andpython3.exe
solution
- delete both
python.exe
andpython3.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 .
- delete both
-
[!NOTE]
- Currently, the
py.exe
launcher cannot be used to start Python when it has been installed from the Microsoft Store.
- Currently, the
vimrc
[!NOTE|label:references:]
verbose
[!NOTE|label:references:]
VALUE COMMENTS >= 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 has unexpected key presses on startup, what could be causing this?
$ vim --cmd 'set t_RV='
:echo v:termresponse
# result : ^[[>41;2500;0c
- more:
:help 'ttymouse' :help t_RV :help v:termresponse
Tmux is changing part of the background in vim
if &term =~ '256color'
" disable Background Color Erase (BCE)
set t_ut=
endif
set ttyfast