Skip to content

Commit

Permalink
✨feat: 自作buflistをやめてみる
Browse files Browse the repository at this point in the history
  • Loading branch information
utubo committed Dec 3, 2024
1 parent f147644 commit 078b17d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 114 deletions.
92 changes: 0 additions & 92 deletions .vim/autoload/vimrc/echobuflist.vim

This file was deleted.

39 changes: 22 additions & 17 deletions .vim/autoload/vimrc/lazyload.vim
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,15 @@ nn gp <Cmd>bprevious<CR>
g:recentBufnr = 0
au vimrc BufLeave * g:recentBufnr = bufnr()
nn <expr> gr $"\<Cmd>b{g:recentBufnr}\<CR>"
vimrc#echobuflist#Setup()
au vimrc User EchoBufListShow g:zenmode.preventEcho = true
au vimrc User EchoBufListHide g:zenmode.preventEcho = false|zenmode#RedrawNow()
def D(a: string = '')
def D()
ec execute('ls')
const n = input('bufnr: ')
if !!n
execute($"normal :\<C-u>b{n}\<CR>")
endif
enddef
nn B <ScriptCmd>D()<CR>
def E(a: string = '')
if &ft ==# 'qf'
return
endif
Expand Down Expand Up @@ -252,7 +257,7 @@ endfor
echoh Normal
echow expand('%:p:h')
enddef
nn <script> <C-g> <ScriptCmd>D()<CR>
nn <script> <C-g> <ScriptCmd>E()<CR>
set tabline=%!vimrc#tabline#MyTabline()
nn <Space>e G?\cErr\\|Exception<CR>
nn <expr> <Space>f $'{(getreg('"') =~ '^\d\+$' ? ':' : '/')}{getreg('"')}<CR>'
Expand All @@ -268,7 +273,7 @@ nn <Space>a A
nn <Space>h ^
nn <Space>l $
nn <Space>y yiw
def E()
def F()
if !!bufname()
update
return
Expand Down Expand Up @@ -303,7 +308,7 @@ if !!e
exe 'sav' e
endif
enddef
com! AutoNamingAndSave E()
com! AutoNamingAndSave F()
cno ;n <CR>
Each nnoremap,inoremap ;n <Esc><Cmd>AutoNamingAndSave<CR>
ino ;m <Esc>`^
Expand Down Expand Up @@ -447,31 +452,31 @@ nn <silent> <F10> <ESC>1<C-w>s:1<CR><C-w>w
xn <F10> <ESC>1<C-w>s<C-w>w
nn <F9> my
nn <Space><F9> 'y
def F()
def G()
for a in get(w:, 'my_syntax', [])
sil! matchdelete(a)
endfor
w:my_syntax = []
enddef
def G(a: string, b: string)
def H(a: string, b: string)
w:my_syntax->add(matchadd(a, b))
enddef
au vimrc Syntax * F()
au vimrc Syntax * G()
au vimrc Syntax javascript {
G('SpellRare', '\s[=!]=\s')
H('SpellRare', '\s[=!]=\s')
}
au vimrc Syntax vim {
G('SpellRare', '\s[=!]=\s')
G('SpellBad', '\s[=!]==\s')
G('SpellBad', '\s\~[=!][=#]\?\s')
G('SpellRare', '\<normal!\@!')
H('SpellRare', '\s[=!]=\s')
H('SpellBad', '\s[=!]==\s')
H('SpellBad', '\s\~[=!][=#]\?\s')
H('SpellRare', '\<normal!\@!')
}
set report=9999
def g:EchoYankText(t: number)
vimrc#echoyanktext#EchoYankText()
enddef
au vimrc TextYankPost * timer_start(1, g:EchoYankText)
def H()
def I()
normal! "vygv
var a = @v->substitute('\n', '', 'g')
popup_create($'{strlen(a)}chars', {
Expand All @@ -482,7 +487,7 @@ moved: 'any',
padding: [1, 1, 1, 1],
})
enddef
xn <C-g> <ScriptCmd>H()<CR>
xn <C-g> <ScriptCmd>I()<CR>
com! -nargs=1 Brep vimrc#myutil#Brep(<q-args>, <q-mods>)
Each f,b nmap <C-{0}> <C-{0}><SID>(hold-ctrl)
Each f,b nnoremap <script> <SID>(hold-ctrl){0} <C-{0}><SID>(hold-ctrl)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
vim9script

# 複数bufを開いている場合、一覧を画面下部に表示する
#
# vimrc等で以下のように設定する
# vimrc#echobuflist#Setup() # ←パスは配置場所に合わせて適宜
# # vim-zenmode用設定
# au vimrc User EchoBufListShow g:zenmode.preventEcho = true
# au vimrc User EchoBufListHide g:zenmode.preventEcho = false|zenmode#RedrawNow()

# `>_`みたいなアイコン
g:buflist_term_sign = get(g:, 'buflist_term_sign', "\uf489")
Expand Down
13 changes: 8 additions & 5 deletions src/.vim/autoload/vimrc/lazyload.src.vim
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,14 @@ nnoremap gp <Cmd>bprevious<CR>
g:recentBufnr = 0
au vimrc BufLeave * g:recentBufnr = bufnr()
nnoremap <expr> gr $"\<Cmd>b{g:recentBufnr}\<CR>"
# bufの一覧を画面下部に表示する
vimrc#echobuflist#Setup()
au vimrc User EchoBufListShow g:zenmode.preventEcho = true
au vimrc User EchoBufListHide g:zenmode.preventEcho = false|zenmode#RedrawNow()
def BufList()
echo execute('ls')
const n = input('bufnr: ')
if !!n
execute($"normal :\<C-u>b{n}\<CR>")
endif
enddef
nnoremap B <ScriptCmd>BufList()<CR>
#}}}

# ------------------------------------------------------
Expand Down

0 comments on commit 078b17d

Please sign in to comment.