Comparisons taken from bram's reasoning for vim9
let start = reltime()
function VimNew()
let sum = 0
for i in range(1, 2999999)
let sum = sum + i
endfor
local properties = { | |
showing = { | |
get = function(t) | |
print("Yoooo we're showing.") | |
return 5 | |
end, | |
set = function(t, v) | |
error("This can't be ser.") |
local Enum = function(tbl) | |
return setmetatable(tbl, { | |
__index = function(_, key) | |
error(string.format("%s does not exist for this enum.", key)) | |
end, | |
__newindex = function(t, key, value) | |
error("Enums are immutable. You are not able to set new values") | |
end, | |
}) |
scores = { | |
"!hate": -2, | |
"!dislike": -1, | |
"!like": 1, | |
"!love": 2, | |
} | |
from collections import defaultdict | |
counts = defaultdict(int) |
local get_max_index = function(t) | |
local max = 0 | |
for k, v in pairs(t) do | |
max = math.max(k, max) | |
end | |
return max | |
end |
Comparisons taken from bram's reasoning for vim9
let start = reltime()
function VimNew()
let sum = 0
for i in range(1, 2999999)
let sum = sum + i
endfor
{ | |
_callbacks = { | |
bytes = { <function 1> }, | |
changedtree = { <function 2> }, | |
child_added = {}, | |
child_removed = {} | |
}, | |
_children = { | |
lua = { | |
_callbacks = { |
( | |
(plain_value) @string | |
(#eq? @string "background-color") | |
) @matched |
vim.lsp.diagnostic.get_virtual_text_chunks_for_line = function(bufnr, line, line_diagnostics) | |
if #line_diagnostics == 0 then | |
return nil | |
end | |
local line_length = #(vim.api.nvim_buf_get_lines(bufnr, line, line + 1, false)[1] or '') | |
local get_highlight = vim.lsp.diagnostic._get_severity_highlight_name | |
-- Create a little more space between virtual text and contents | |
local virt_texts = {{string.rep(" ", 80 - line_length)}} |
function x() | |
return 1, 2 | |
end | |
function y() | |
local foo = {{x()}, {x()}} | |
return vim.tbl_flatten(foo) | |
end |
let g:highlight_overlength = v:true | |
let g:highlight_overlength_length = 72 | |
let g:load_overlength = v:true | |
" Use :call ToggleOverlength() | |
" to toggle whether or not you show highlights | |
function! ToggleOverlength() abort | |
let g:highlight_overlength = !g:highlight_overlength | |
if g:highlight_overlength |