Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.118.252.215
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/3/cwd/proc/3/root/usr/share/vim/vim90/pack/dist/opt/cfilter/plugin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/3/cwd/proc/3/root/usr/share/vim/vim90/pack/dist/opt/cfilter/plugin/cfilter.vim
vim9script

# cfilter.vim: Plugin to filter entries from a quickfix/location list
# Last Change: Jun 30, 2022
# Maintainer: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
# Version: 2.0
#
# Commands to filter the quickfix list:
#   :Cfilter[!] /{pat}/
#       Create a new quickfix list from entries matching {pat} in the current
#       quickfix list. Both the file name and the text of the entries are
#       matched against {pat}. If ! is supplied, then entries not matching
#       {pat} are used. The pattern can be optionally enclosed using one of
#       the following characters: ', ", /. If the pattern is empty, then the
#       last used search pattern is used.
#   :Lfilter[!] /{pat}/
#       Same as :Cfilter but operates on the current location list.
#

def Qf_filter(qf: bool, searchpat: string, bang: string)
  var Xgetlist: func
  var Xsetlist: func
  var cmd: string
  var firstchar: string
  var lastchar: string
  var pat: string
  var title: string
  var Cond: func
  var items: list<any>

  if qf
    Xgetlist = function('getqflist')
    Xsetlist = function('setqflist')
    cmd = ':Cfilter' .. bang
  else
    Xgetlist = function('getloclist', [0])
    Xsetlist = function('setloclist', [0])
    cmd = ':Lfilter' .. bang
  endif

  firstchar = searchpat[0]
  lastchar = searchpat[-1 :]
  if firstchar == lastchar &&
              (firstchar == '/' || firstchar == '"' || firstchar == "'")
    pat = searchpat[1 : -2]
    if pat == ''
      # Use the last search pattern
      pat = @/
    endif
  else
    pat = searchpat
  endif

  if pat == ''
    return
  endif

  if bang == '!'
    Cond = (_, val) => val.text !~# pat && bufname(val.bufnr) !~# pat
  else
    Cond = (_, val) => val.text =~# pat || bufname(val.bufnr) =~# pat
  endif

  items = filter(Xgetlist(), Cond)
  title = cmd .. ' /' .. pat .. '/'
  Xsetlist([], ' ', {title: title, items: items})
enddef

command! -nargs=+ -bang Cfilter Qf_filter(true, <q-args>, <q-bang>)
command! -nargs=+ -bang Lfilter Qf_filter(false, <q-args>, <q-bang>)

# vim: shiftwidth=2 sts=2 expandtab

Anon7 - 2022
AnonSec Team