Skip to content

Commit

Permalink
change colors
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenyangze committed Apr 15, 2023
1 parent 05eb0cf commit 2911c61
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 4 deletions.
2 changes: 0 additions & 2 deletions layers/language/bash.vim

This file was deleted.

80 changes: 80 additions & 0 deletions layers/user/demo.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
function! FFindAndReplaceToggle()
if !exists('g:FFAR_bufnrs')
" 创建窗口并存储buffer号
call FFindAndReplace()
else
" 关闭窗口并删除buffer
for bufnr in g:FFAR_bufnrs
let winnr = bufwinnr(bufnr)
if winnr > 0
execute winnr.'close'
endif
if bufnr != -1
silent execute 'bdelete '.bufnr
endif
endfor
silent! unlet g:FFAR_bufnrs
endif
endfunction

function! FFindAndReplace()
" 新建tab页
tabnew
" filetype ff_old
let bufnr1 = bufnr('%') " 获取buffer号
set filetype=ff_old
" filetype ff_new
vnew
let bufnr2 = bufnr('%')
set filetype=ff_new
" filetype ff_option
vnew
let bufnr3 = bufnr('%')
set filetype=ff_option
" move cursor to bottom
" filetype ff_list
vnew
wincmd J
let bufnr4 = bufnr('%')
set filetype=ff_list
let g:FFAR_bufnrs = [bufnr1, bufnr2, bufnr3, bufnr4]
endfunction

function FFindAndReplace_Find()
" 获取filetype为ff_old的buffer内容保存到变量findStr中
let findStr = ''
let bufList = filter(range(1, bufnr('$')), 'getbufvar(v:val, "&filetype") == "ff_old"')

if len(bufList) > 0
let findStr = join(getbufline(bufList[0], 1, '$'), "\n")
endif

" 从vim当前目录搜索所有文件
let fileList = split(system('find . -type f'), "\n")

" 遍历所有文件,将匹配到的文件的完整文件名输出到filetype为ff_list的buffer中

let buffers = filter(range(1, bufnr('$')), 'getbufvar(v:val, "&filetype") == "ff_list"')
if len(buffers) == 0
return
endif
let ffListBuf = buffers[0]
exe 'silent! b ' . ffListBuf
silent %d _

let matchCount = 0
for file in fileList
if filereadable(file)
let fileContent = join(readfile(file), "\n")
if stridx(fileContent, findStr) != -1
call append(line('$'), file)
let matchCount += 1
endif
endif
endfor

" 搜索完成后,在Vim底部显示提示信息
echo matchCount . ' files matched.'
endfunction


4 changes: 2 additions & 2 deletions layers/user/theme.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ if !exists('$TMUX')
let g:gruvbox_material_background = 'soft'
let g:gruvbox_material_better_performance = 1
"colorscheme gruvbox-material
colorscheme oceanic_material
"colorscheme onehalfdark
"colorscheme oceanic_material
colorscheme onehalfdark
hi SignColumn ctermbg=NONE guibg=NONE
hi StatusLineNC guifg=#444444 guibg=#3a3a3a
if has("nvim")
Expand Down

0 comments on commit 2911c61

Please sign in to comment.