It looks like define
and include
can't match on the same line.
Goal: set define
to a simple value and see if it works as intended.
-
Open
sample_a
with:$ vim -Nu NONE sample_a
// See https://www.oauth.com/oauth2-servers/pkce/ | |
function generateCodeVerifier(limit) { | |
const krypto = window.crypto || window.msCrypto; | |
const pool = new Uint8Array(1024); | |
const chars = []; | |
krypto.getRandomValues(pool); | |
pool | |
.filter((code) => { |
This document is written to help JavaScript developers to understand JavaScript's weird parts deeply and to prepare for interviews, the following resources was really helpful to write this document:
" jump to next non-empty line | |
nnoremap <key> :<C-u>call search('^.\+')<CR> | |
" jump to previous non-empty line | |
nnoremap <otherkey> :<C-u>call search('^.\+', 'b')<CR> | |
" extend visual selection to next non-empty line | |
xnoremap <key> :<C-u>k`\|call search('^.\+')\|normal! <C-r>=visualmode()<CR>``o<CR> | |
" extend visual selection to previous non-empty line |
" markdown : jump to next heading | |
function! s:JumpToNextHeading(direction, count) | |
let col = col(".") | |
silent execute a:direction == "up" ? '?^#' : '/^#' | |
if a:count > 1 | |
silent execute "normal! " . repeat("n", a:direction == "up" && col != 1 ? a:count : a:count - 1) | |
endif |
augroup TooLong | |
autocmd! | |
autocmd winEnter,BufEnter * call clearmatches() | call matchadd('ColorColumn', '\%>80v', 100) | |
augroup END |
You may want a linter plugin to lint your code in Vim but you probably don't need it. At least try the built-in way before jumping on the plugin bandwagon.
autocmd FileType <filetype> setlocal makeprg=<external command>
This autocommand tells Vim to use <external command>
when invoking :make %
in a <filetype>
buffer. You can add as many similar lines as needed for other languages.
autocmd BufNewFile,BufRead *.foo set filetype=html
BufNewFile,BufRead
is the list of events that trigger this autocommand.*.foo
is the pattern we want to match against the data returned by the event.set filetype=html
is the command we want to execute when the pattern matches the data returned by the event.