How do I register custom filetype detection rules in Neovim using Lua without editing filetype.vim?
vim.filetype.add()
vim.
vim.filetype.add()
vim.
vim.lsp.config('server', { cmd = {...}, root_markers = {...}, filetypes = {...} })
Neovim 0.
vim.uv.new_timer()
Neovim exposes vim.
:noautocmd e {file}
When you have heavy autocmds registered for BufRead, BufEnter, or FileType events — such as LSP clients, formatters, or syntax processors — opening a large
command-line #command-line #ex-commands #buffers-windows #config
:match {group} /pattern/
:match, :2match, and :3match give you three independent highlight slots that overlay patterns on the buffer using any highlight group — without touching the s
:set scroll=10
The scroll option determines how many lines (scroll up) and (scroll down) move the viewport.
:set digraph
With :set digraph enabled, you can enter special characters in insert mode by typing the two-character digraph code followed by (backspace).
config #insert-mode #digraphs #unicode #special-characters #config
vim --startuptime /tmp/vim-startup.log +qall && sort -k2 -rn /tmp/vim-startup.log | head -20
When Vim starts slowly, the --startuptime flag writes a timestamped log of every script and plugin loaded during initialization.
ftdetect/{filetype}.vim
Vim automatically sources every file in ftdetect/ directories on the runtimepath when filetype detection runs.
:command -range {Name} ...
Custom Ex commands defined with :command -range can be called with a line range (e.
:mkview 2 and :loadview 2
Vim supports up to 9 numbered view slots per file.
buffers-windows #folding #buffers-windows #navigation #config
json_encode()
Vim 8.
glob()
The glob() built-in function expands a wildcard pattern into a list of matching filesystem paths, entirely within Vimscript.
<SID>
(Script ID) is a Vimscript token that expands to a unique, per-script prefix at runtime.
:<C-u>MyCommand<CR>
When writing nnoremap or vnoremap mappings that call Ex commands, Vim may silently prepend a count or a visual range (') to your command before it runs.
matchadd('Group', 'pattern', priority)
matchadd() accepts an optional third argument: a priority integer that controls which match wins when two patterns cover the same text.
:echo synIDattr(synID(line('.'),col('.'),1),'name')
When customizing a colorscheme or debugging unexpected colors, you need to know exactly which highlight group is coloring the text under your cursor.
vim.opt
Neovim's vim.
:set verbosefile=/tmp/vim.log verbose=9
Vim's verbosefile option redirects all verbose tracing output to a file on disk instead of printing it to the screen.
:set signcolumn=number
Setting signcolumn=number tells Neovim to display signs (diagnostics, git hunks, breakpoints) inside the line number column instead of adding a dedicated extra