Fraser Cormack 8c46413f34
[vim] Improve iskeyword for LLVM IR (#117905)
This patch sets the 'iskeyword' variable to characters found in LLVM IR
identifiers. Keywords are used in many places in vim, most notably being
treated as word boundaries for commands like 'w' and '*'. The aim with
this is to improve the navigability and editability of LLVM IR files as
now one is able to: skip over entire identifiers with motions (e.g.,
`w/e/b`); yank/delete whole identifiers (e.g., `diw`); highlight/search
for the identifier under the cursor (`*`), etc.

More complicated LLVM identifiers including quotation marks are not
supported. The 'iskeyword' variable is just a list of characters, not a
regex, and including quotation marks and all the characters permitted in
quoted identifiers would expand the scope to almost everything and
become less usable. These types of identifiers are rare by comparison.

Note that this does change how words are considered across the entire
LLVM IR file, so including strings, comments, names, etc. Given that the
majority of editing/navigating LLVM IR is working with and across
values, this is arguably a worthwhile trade-off.
2024-12-04 10:56:55 +00:00

22 lines
686 B
VimL

" Vim filetype plugin file
" Language: LLVM Assembly
" Maintainer: The LLVM team, http://llvm.org/
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
setlocal softtabstop=2 shiftwidth=2
setlocal expandtab
setlocal comments+=:;
setlocal commentstring=;\ %s
" We treat sequences of the following characters as forming 'keywords', with
" the aim of easing movement around LLVM identifiers:
" * identifier prefixes: '%' and '@' (@-@)
" * all characters where isalpha() returns TRUE (@)
" * the digits 0-9 (48-57)
" * other characters that may form identifiers: '_', '.', '-', '$'
" Comment this out to restore the default behaviour
setlocal iskeyword=%,@-@,@,48-57,_,.,-,$