You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
" for vim-matchup plugin
let g:loaded_matchit = 1
" 去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
set nocompatible
" 开启256色支持
set t_Co=256
" 不少插件的信息更新都会需要这个时间
set updatetime=33
" 打开文件时进行解码的猜测列表
set fileencodings=utf-8,utf-16,utf-32,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936,big5,latin1
" 把当前文件转换为当前系统编码进行处理,这里为utf-8
set encoding=utf-8
scriptencoding utf-8
" 禁止生成临时文件
set nobackup
set nowritebackup
set noswapfile
let g:plug_url_format = 'https://githubfast.com/%s.git'
call plug#begin('~/.vim/plugged')
Plug 'andymass/vim-matchup'
call plug#end()
My vim version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 04 2023 10:24:44)
Included patches: 1-1378, 1499
Steps
gvim a cpp file
execute MatchupWhereAmI??
the screen blinks
Maybe my previous code can be a reference?
function! ShowCurrentModule()
let l:module_line = search('module', 'bnWz')
let l:module_name = getline(l:module_line)
let l:module_end_poisition = strridx(l:module_name, '(')
if(l:module_end_poisition > 0)
let l:module_name = strpart(l:module_name, 0, l:module_end_poisition)
endif
let l:module_name = strpart(l:module_name, stridx(l:module_name, 'module')+7)
while(strpart(l:module_name, 0 , 1) ==? ' ')
let l:module_name = strpart(l:module_name, 1)
endwhile
echo 'module -->' l:module_name
endfunction
function! ShowNearestClassOrStruct()
let l:class_line = search('\n'.'class', 'bnWz')
let l:struct_line = search('\n'.'struct', 'bnWz')
if(l:class_line > l:struct_line)
let l:nearest_name = getline(l:class_line+1)
elseif(l:class_line < l:struct_line)
let l:nearest_name = getline(l:struct_line+1)
else
let l:nearest_name = 'No class/struct can be find.'
endif
let l:nearest_end_poisition = strridx(l:nearest_name, '{')
if(l:nearest_end_poisition > 0)
let l:nearest_name = strpart(l:nearest_name, 0, l:nearest_end_poisition)
endif
echo l:nearest_name
endfunction
The text was updated successfully, but these errors were encountered:
Explain the issue
My .vimrc
" for vim-matchup plugin
let g:loaded_matchit = 1
" 去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
set nocompatible
" 开启256色支持
set t_Co=256
" 不少插件的信息更新都会需要这个时间
set updatetime=33
" 打开文件时进行解码的猜测列表
set fileencodings=utf-8,utf-16,utf-32,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936,big5,latin1
" 把当前文件转换为当前系统编码进行处理,这里为utf-8
set encoding=utf-8
scriptencoding utf-8
" 禁止生成临时文件
set nobackup
set nowritebackup
set noswapfile
let g:plug_url_format = 'https://githubfast.com/%s.git'
call plug#begin('~/.vim/plugged')
Plug 'andymass/vim-matchup'
call plug#end()
My vim version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 04 2023 10:24:44)
Included patches: 1-1378, 1499
Steps
gvim a cpp file
execute MatchupWhereAmI??
the screen blinks
Maybe my previous code can be a reference?
function! ShowCurrentModule()
let l:module_line = search('module', 'bnWz')
let l:module_name = getline(l:module_line)
let l:module_end_poisition = strridx(l:module_name, '(')
if(l:module_end_poisition > 0)
let l:module_name = strpart(l:module_name, 0, l:module_end_poisition)
endif
let l:module_name = strpart(l:module_name, stridx(l:module_name, 'module')+7)
while(strpart(l:module_name, 0 , 1) ==? ' ')
let l:module_name = strpart(l:module_name, 1)
endwhile
echo 'module -->' l:module_name
endfunction
function! ShowNearestClassOrStruct()
let l:class_line = search('\n'.'class', 'bnWz')
let l:struct_line = search('\n'.'struct', 'bnWz')
if(l:class_line > l:struct_line)
let l:nearest_name = getline(l:class_line+1)
elseif(l:class_line < l:struct_line)
let l:nearest_name = getline(l:struct_line+1)
else
let l:nearest_name = 'No class/struct can be find.'
endif
let l:nearest_end_poisition = strridx(l:nearest_name, '{')
if(l:nearest_end_poisition > 0)
let l:nearest_name = strpart(l:nearest_name, 0, l:nearest_end_poisition)
endif
echo l:nearest_name
endfunction
The text was updated successfully, but these errors were encountered: