⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.144
Server IP:
157.245.143.252
Server:
Linux www 6.11.0-9-generic #9-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 14 13:19:59 UTC 2024 x86_64
Server Software:
nginx/1.26.0
PHP Version:
8.3.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
vim
/
vim91
/
View File Name :
optwin.vim
" These commands create the option window. " " Maintainer: The Vim Project
" Last Change: 2024 Jun 05 " Former Maintainer: Bram Moolenaar
" If there already is an option window, jump to that one. let buf = bufnr('option-window') if buf >= 0 let winids = win_findbuf(buf) if len(winids) > 0 if win_gotoid(winids[0]) == 1 finish endif endif endif " Make sure the '<' flag is not included in 'cpoptions', otherwise
would " not be recognized. See ":help 'cpoptions'". let s:cpo_save = &cpo set cpo&vim " function to be called when
is hit in the option-window func
CR() " If on a continued comment line, go back to the first comment line let lnum = search("^[^\t]", 'bWcn') let line = getline(lnum) "
on a "set" line executes the option line if match(line, "^ \tset ") >= 0 " For a local option: go to the previous window " If this is a help window, go to the window below it let thiswin = winnr() let local =
Find(lnum) if local >= 0 exe line call
Update(lnum, line, local, thiswin) endif "
on a "option" line shows help for that option elseif match(line, "^[a-z]") >= 0 let name = substitute(line, '\([^\t]*\).*', '\1', "") exe "help '" . name . "'" "
on an index line jumps to the group elseif match(line, '^ \=[0-9]') >= 0 exe "norm! /" . line . "\
zt" endif endfunc " function to be called when
is hit in the option-window func
Space() let lnum = line(".") let line = getline(lnum) "
on a "set" line refreshes the option line if match(line, "^ \tset ") >= 0 " For a local option: go to the previous window " If this is a help window, go to the window below it let thiswin = winnr() let local =
Find(lnum) if local >= 0 call
Update(lnum, line, local, thiswin) endif endif endfunc let s:local_to_window = gettext('(local to window)') let s:local_to_buffer = gettext('(local to buffer)') let s:global_or_local = gettext('(global or local to buffer)') " find the window in which the option applies " returns 0 for global option, 1 for local option, -1 for error func
Find(lnum) let line = getline(a:lnum - 1) if line =~ s:local_to_window || line =~ s:local_to_buffer let local = 1 let thiswin = winnr() wincmd p if exists("b:current_syntax") && b:current_syntax == "help" wincmd j if winnr() == thiswin wincmd j endif endif else let local = 0 endif if local && (winnr() == thiswin || (exists("b:current_syntax") \ && b:current_syntax == "help")) echo "Don't know in which window" let local = -1 endif return local endfunc " Update a "set" line in the option window func
Update(lnum, line, local, thiswin) " get the new value of the option and update the option window line if match(a:line, "=") >= 0 let name = substitute(a:line, '^ \tset \([^=]*\)=.*', '\1', "") else let name = substitute(a:line, '^ \tset \(no\)\=\([a-z]*\).*', '\2', "") endif if name == "pt" && &pt =~ "\x80" let val =
PTvalue() else let val = escape(eval('&' . name), " \t\\\"|") endif if a:local exe a:thiswin . "wincmd w" endif if match(a:line, "=") >= 0 || (val != "0" && val != "1") call setline(a:lnum, " \tset " . name . "=" . val) else if val call setline(a:lnum, " \tset " . name . "\tno" . name) else call setline(a:lnum, " \tset no" . name . "\t" . name) endif endif set nomodified endfunc " Reset 'title' and 'icon' to make it work faster. " Reset 'undolevels' to avoid undo'ing until the buffer is empty. let s:old_title = &title let s:old_icon = &icon let s:old_sc = &sc let s:old_ru = &ru let s:old_ul = &ul set notitle noicon nosc noru ul=-1 " If the current window is a help window, try finding a non-help window. " Relies on syntax highlighting to be switched on. let s:thiswin = winnr() while exists("b:current_syntax") && b:current_syntax == "help" wincmd w if s:thiswin == winnr() break endif endwhile " Open the window. $OPTWIN_CMD is set to "tab" for ":tab options". exe $OPTWIN_CMD . ' new option-window' setlocal ts=15 tw=0 noro buftype=nofile " Insert help and a "set" command for each option. call append(0, gettext('" Each "set" line shows the current value of an option (on the left).')) call append(1, gettext('" Hit
on a "set" line to execute it.')) call append(2, gettext('" A boolean option will be toggled.')) call append(3, gettext('" For other options you can edit the value before hitting
.')) call append(4, gettext('" Hit
on a help line to open a help window on this option.')) call append(5, gettext('" Hit
on an index line to jump there.')) call append(6, gettext('" Hit
on a "set" line to refresh it.')) " These functions are called often below. Keep them fast! " Add an option name and explanation. The text can contain "\n" characters " where a line break is to be inserted. func
AddOption(name, text) let lines = split(a:text, "\n") call append("$", a:name .. "\t" .. lines[0]) for line in lines[1:] call append("$", "\t" .. line) endfor endfunc " Init a local binary option func
BinOptionL(name) let val = getwinvar(winnr('#'), '&' . a:name) call append("$", substitute(substitute(" \tset " . val . a:name . "\t" . \!val . a:name, "0", "no", ""), "1", "", "")) endfunc " Init a global binary option func
BinOptionG(name, val) call append("$", substitute(substitute(" \tset " . a:val . a:name . "\t" . \!a:val . a:name, "0", "no", ""), "1", "", "")) endfunc " Init a local string option func
OptionL(name) let val = escape(getwinvar(winnr('#'), '&' . a:name), " \t\\\"|") call append("$", " \tset " . a:name . "=" . val) endfunc " Init a global string option func
OptionG(name, val) call append("$", " \tset " . a:name . "=" . escape(a:val, " \t\\\"|")) endfunc let s:idx = 1 let s:lnum = line("$") call append("$", "") func
Header(text) let line = s:idx . " " . a:text if s:idx < 10 let line = " " . line endif call append("$", "") call append("$", line) call append("$", "") call append(s:lnum, line) let s:idx = s:idx + 1 let s:lnum = s:lnum + 1 endfunc " Get the value of 'pastetoggle'. It could be a special key. func
PTvalue() redir @a silent set pt redir END return substitute(@a, '[^=]*=\(.*\)', '\1', "") endfunc " Restore the previous value of 'cpoptions' here, it's used below. let &cpo = s:cpo_save " List of all options, organized by function. " The text should be sufficient to know what the option is used for. call
Header(gettext("important")) call
AddOption("compatible", gettext("behave very Vi compatible (not advisable)")) call
BinOptionG("cp", &cp) call
AddOption("cpoptions", gettext("list of flags to specify Vi compatibility")) call
OptionG("cpo", &cpo) call
AddOption("insertmode", gettext("use Insert mode as the default mode")) call
BinOptionG("im", &im) call
AddOption("paste", gettext("paste mode, insert typed text literally")) call
BinOptionG("paste", &paste) call
AddOption("pastetoggle", gettext("key sequence to toggle paste mode")) if &pt =~ "\x80" call append("$", " \tset pt=" .
PTvalue()) else call
OptionG("pt", &pt) endif call
AddOption("runtimepath", gettext("list of directories used for runtime files and plugins")) call
OptionG("rtp", &rtp) call
AddOption("packpath", gettext("list of directories used for plugin packages")) call
OptionG("pp", &pp) call
AddOption("helpfile", gettext("name of the main help file")) call
OptionG("hf", &hf) call
Header(gettext("moving around, searching and patterns")) call
AddOption("whichwrap", gettext("list of flags specifying which commands wrap to another line")) call
OptionG("ww", &ww) call
AddOption("startofline", gettext("many jump commands move the cursor to the first non-blank\ncharacter of a line")) call
BinOptionG("sol", &sol) call
AddOption("paragraphs", gettext("nroff macro names that separate paragraphs")) call
OptionG("para", ¶) call
AddOption("sections", gettext("nroff macro names that separate sections")) call
OptionG("sect", §) call
AddOption("path", gettext("list of directory names used for file searching")) call append("$", "\t" .. s:global_or_local) call
OptionG("pa", &pa) call
AddOption("cdhome", gettext(":cd without argument goes to the home directory")) call
BinOptionG("cdh", &cdh) call
AddOption("cdpath", gettext("list of directory names used for :cd")) call
OptionG("cd", &cd) if exists("+autochdir") call
AddOption("autochdir", gettext("change to directory of file in buffer")) call
BinOptionG("acd", &acd) endif call
AddOption("autoshelldir", gettext("change to pwd of shell in terminal buffer")) call
BinOptionG("asd", &asd) call
AddOption("wrapscan", gettext("search commands wrap around the end of the buffer")) call
BinOptionG("ws", &ws) call
AddOption("incsearch", gettext("show match for partly typed search command")) call
BinOptionG("is", &is) call
AddOption("magic", gettext("change the way backslashes are used in search patterns")) call
BinOptionG("magic", &magic) call
AddOption("regexpengine", gettext("select the default regexp engine used")) call
OptionG("re", &re) call
AddOption("ignorecase", gettext("ignore case when using a search pattern")) call
BinOptionG("ic", &ic) call
AddOption("smartcase", gettext("override 'ignorecase' when pattern has upper case characters")) call
BinOptionG("scs", &scs) call
AddOption("casemap", gettext("what method to use for changing case of letters")) call
OptionG("cmp", &cmp) call
AddOption("maxmempattern", gettext("maximum amount of memory in Kbyte used for pattern matching")) call append("$", " \tset mmp=" . &mmp) call
AddOption("define", gettext("pattern for a macro definition line")) call append("$", "\t" .. s:global_or_local) call
OptionG("def", &def) if has("find_in_path") call
AddOption("include", gettext("pattern for an include-file line")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("inc") call
AddOption("includeexpr", gettext("expression used to transform an include line to a file name")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("inex") endif call
Header(gettext("tags")) call
AddOption("tagbsearch", gettext("use binary searching in tags files")) call
BinOptionG("tbs", &tbs) call
AddOption("taglength", gettext("number of significant characters in a tag name or zero")) call append("$", " \tset tl=" . &tl) call
AddOption("tags", gettext("list of file names to search for tags")) call append("$", "\t" .. s:global_or_local) call
OptionG("tag", &tag) call
AddOption("tagcase", gettext("how to handle case when searching in tags files:\n\"followic\" to follow 'ignorecase', \"ignore\" or \"match\"")) call append("$", "\t" .. s:global_or_local) call
OptionG("tc", &tc) call
AddOption("tagrelative", gettext("file names in a tags file are relative to the tags file")) call
BinOptionG("tr", &tr) call
AddOption("tagstack", gettext("a :tag command will use the tagstack")) call
BinOptionG("tgst", &tgst) call
AddOption("showfulltag", gettext("when completing tags in Insert mode show more info")) call
BinOptionG("sft", &sft) if has("eval") call
AddOption("tagfunc", gettext("a function to be used to perform tag searches")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("tfu") endif if has("cscope") call
AddOption("cscopeprg", gettext("command for executing cscope")) call
OptionG("csprg", &csprg) call
AddOption("cscopetag", gettext("use cscope for tag commands")) call
BinOptionG("cst", &cst) call
AddOption("cscopetagorder", gettext("0 or 1; the order in which \":cstag\" performs a search")) call append("$", " \tset csto=" . &csto) call
AddOption("cscopeverbose", gettext("give messages when adding a cscope database")) call
BinOptionG("csverb", &csverb) call
AddOption("cscopepathcomp", gettext("how many components of the path to show")) call append("$", " \tset cspc=" . &cspc) call
AddOption("cscopequickfix", gettext("when to open a quickfix window for cscope")) call
OptionG("csqf", &csqf) call
AddOption("cscoperelative", gettext("file names in a cscope file are relative to that file")) call
BinOptionG("csre", &csre) endif call
Header(gettext("displaying text")) call
AddOption("scroll", gettext("number of lines to scroll for CTRL-U and CTRL-D")) call append("$", "\t" .. s:local_to_window) call
OptionL("scr") call
AddOption("smoothscroll", gettext("scroll by screen line")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("sms") call
AddOption("scrolloff", gettext("number of screen lines to show around the cursor")) call append("$", " \tset so=" . &so) call
AddOption("wrap", gettext("long lines wrap")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("wrap") call
AddOption("linebreak", gettext("wrap long lines at a character in 'breakat'")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("lbr") call
AddOption("breakindent", gettext("preserve indentation in wrapped text")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("bri") call
AddOption("breakindentopt", gettext("adjust breakindent behaviour")) call append("$", "\t" .. s:local_to_window) call
OptionL("briopt") call
AddOption("breakat", gettext("which characters might cause a line break")) call
OptionG("brk", &brk) call
AddOption("showbreak", gettext("string to put before wrapped screen lines")) call
OptionG("sbr", &sbr) call
AddOption("sidescroll", gettext("minimal number of columns to scroll horizontally")) call append("$", " \tset ss=" . &ss) call
AddOption("sidescrolloff", gettext("minimal number of columns to keep left and right of the cursor")) call append("$", " \tset siso=" . &siso) call
AddOption("display", gettext("include \"lastline\" to show the last line even if it doesn't fit\ninclude \"uhex\" to show unprintable characters as a hex number")) call
OptionG("dy", &dy) call
AddOption("fillchars", gettext("characters to use for the status line, folds and filler lines")) call
OptionG("fcs", &fcs) call
AddOption("cmdheight", gettext("number of lines used for the command-line")) call append("$", " \tset ch=" . &ch) call
AddOption("columns", gettext("width of the display")) call append("$", " \tset co=" . &co) call
AddOption("lines", gettext("number of lines in the display")) call append("$", " \tset lines=" . &lines) call
AddOption("window", gettext("number of lines to scroll for CTRL-F and CTRL-B")) call append("$", " \tset window=" . &window) call
AddOption("lazyredraw", gettext("don't redraw while executing macros")) call
BinOptionG("lz", &lz) if has("reltime") call
AddOption("redrawtime", gettext("timeout for 'hlsearch' and :match highlighting in msec")) call append("$", " \tset rdt=" . &rdt) endif call
AddOption("writedelay", gettext("delay in msec for each char written to the display\n(for debugging)")) call append("$", " \tset wd=" . &wd) call
AddOption("list", gettext("show
as ^I and end-of-line as $")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("list") call
AddOption("listchars", gettext("list of strings used for list mode")) call
OptionG("lcs", &lcs) call
AddOption("number", gettext("show the line number for each line")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("nu") call
AddOption("relativenumber", gettext("show the relative line number for each line")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("rnu") if has("linebreak") call
AddOption("numberwidth", gettext("number of columns to use for the line number")) call append("$", "\t" .. s:local_to_window) call
OptionL("nuw") endif if has("conceal") call
AddOption("conceallevel", gettext("controls whether concealable text is hidden")) call append("$", "\t" .. s:local_to_window) call
OptionL("cole") call
AddOption("concealcursor", gettext("modes in which text in the cursor line can be concealed")) call append("$", "\t" .. s:local_to_window) call
OptionL("cocu") endif call
Header(gettext("syntax, highlighting and spelling")) call
AddOption("background", gettext("\"dark\" or \"light\"; the background color brightness")) call
OptionG("bg", &bg) call
AddOption("filetype", gettext("type of file; triggers the FileType event when set")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("ft") if has("syntax") call
AddOption("syntax", gettext("name of syntax highlighting used")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("syn") call
AddOption("synmaxcol", gettext("maximum column to look for syntax items")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("smc") endif call
AddOption("highlight", gettext("which highlighting to use for various occasions")) call
OptionG("hl", &hl) call
AddOption("hlsearch", gettext("highlight all matches for the last used search pattern")) call
BinOptionG("hls", &hls) call
AddOption("wincolor", gettext("highlight group to use for the window")) call append("$", "\t" .. s:local_to_window) call
OptionL("wcr") if has("termguicolors") call
AddOption("termguicolors", gettext("use GUI colors for the terminal")) call
BinOptionG("tgc", &tgc) endif if has("syntax") call
AddOption("cursorcolumn", gettext("highlight the screen column of the cursor")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("cuc") call
AddOption("cursorline", gettext("highlight the screen line of the cursor")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("cul") call
AddOption("cursorlineopt", gettext("specifies which area 'cursorline' highlights")) call append("$", "\t" .. s:local_to_window) call
OptionL("culopt") call
AddOption("colorcolumn", gettext("columns to highlight")) call append("$", "\t" .. s:local_to_window) call
OptionL("cc") call
AddOption("spell", gettext("highlight spelling mistakes")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("spell") call
AddOption("spelllang", gettext("list of accepted languages")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("spl") call
AddOption("spellfile", gettext("file that \"zg\" adds good words to")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("spf") call
AddOption("spellcapcheck", gettext("pattern to locate the end of a sentence")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("spc") call
AddOption("spelloptions", gettext("flags to change how spell checking works")) call append("$", "\t" .. s:local_to_buffer) call
OptionL("spo") call
AddOption("spellsuggest", gettext("methods used to suggest corrections")) call
OptionG("sps", &sps) call
AddOption("mkspellmem", gettext("amount of memory used by :mkspell before compressing")) call
OptionG("msm", &msm) endif call
Header(gettext("multiple windows")) call
AddOption("laststatus", gettext("0, 1 or 2; when to use a status line for the last window")) call append("$", " \tset ls=" . &ls) if has("statusline") call
AddOption("statusline", gettext("alternate format to be used for a status line")) call
OptionG("stl", &stl) endif call append("$", "\t" .. s:local_to_window) call
AddOption("equalalways", gettext("make all windows the same size when adding/removing windows")) call
BinOptionG("ea", &ea) call
AddOption("eadirection", gettext("in which direction 'equalalways' works: \"ver\", \"hor\" or \"both\"")) call
OptionG("ead", &ead) call
AddOption("winheight", gettext("minimal number of lines used for the current window")) call append("$", " \tset wh=" . &wh) call
AddOption("winminheight", gettext("minimal number of lines used for any window")) call append("$", " \tset wmh=" . &wmh) call
AddOption("winfixbuf", gettext("keep window focused on a single buffer")) call
OptionG("wfb", &wfb) call
AddOption("winfixheight", gettext("keep the height of the window")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("wfh") call
AddOption("winfixwidth", gettext("keep the width of the window")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("wfw") call
AddOption("winwidth", gettext("minimal number of columns used for the current window")) call append("$", " \tset wiw=" . &wiw) call
AddOption("winminwidth", gettext("minimal number of columns used for any window")) call append("$", " \tset wmw=" . &wmw) call
AddOption("helpheight", gettext("initial height of the help window")) call append("$", " \tset hh=" . &hh) if has("quickfix") call
AddOption("previewpopup", gettext("use a popup window for preview")) call append("$", " \tset pvp=" . &pvp) call
AddOption("previewheight", gettext("default height for the preview window")) call append("$", " \tset pvh=" . &pvh) call
AddOption("previewwindow", gettext("identifies the preview window")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("pvw") endif call
AddOption("hidden", gettext("don't unload a buffer when no longer shown in a window")) call
BinOptionG("hid", &hid) call
AddOption("switchbuf", gettext("\"useopen\" and/or \"split\"; which window to use when jumping\nto a buffer")) call
OptionG("swb", &swb) call
AddOption("splitbelow", gettext("a new window is put below the current one")) call
BinOptionG("sb", &sb) call
AddOption("splitkeep", gettext("determines scroll behavior for split windows")) call
OptionG("spk", &spk) call
AddOption("splitright", gettext("a new window is put right of the current one")) call
BinOptionG("spr", &spr) call
AddOption("scrollbind", gettext("this window scrolls together with other bound windows")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("scb") call
AddOption("scrollopt", gettext("\"ver\", \"hor\" and/or \"jump\"; list of options for 'scrollbind'")) call
OptionG("sbo", &sbo) call
AddOption("cursorbind", gettext("this window's cursor moves together with other bound windows")) call append("$", "\t" .. s:local_to_window) call
BinOptionL("crb") if has("terminal") call
AddOption("termwinsize", gettext("size of a terminal window")) call append("$", "\t" .. s:local_to_window) call
OptionL("tws") call
AddOption("termwinkey", gettext("key that precedes Vim commands in a terminal window")) call append("$", "\t" .. s:local_to_window) call
OptionL("twk") call
AddOption("termwinscroll", gettext("max number of lines to keep for scrollback in a terminal window")) call append("$", "\t" .. s:local_to_window) call
OptionL("twsl") if has('win32') call
AddOption("termwintype", gettext("type of pty to use for a terminal window")) call
OptionG("twt", &twt) endif if exists("&winptydll") call
AddOption("winptydll", gettext("name of the winpty dynamic library")) call
OptionG("winptydll", &winptydll) endif endif call