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 = { |
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 get_max_index = function(t) | |
local max = 0 | |
for k, v in pairs(t) do | |
max = math.max(k, max) | |
end | |
return max | |
end |
scores = { | |
"!hate": -2, | |
"!dislike": -1, | |
"!like": 1, | |
"!love": 2, | |
} | |
from collections import defaultdict | |
counts = defaultdict(int) |
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, | |
}) |
local properties = { | |
showing = { | |
get = function(t) | |
print("Yoooo we're showing.") | |
return 5 | |
end, | |
set = function(t, v) | |
error("This can't be ser.") |
function s:PerlSubstitute(line1, line2, sstring) | |
let l:lines = getline(a:line1, a:line2) | |
" Perl command with 'utf8' enabled | |
" '#line 1' makes error messages prettier, displayed below: | |
" Substitution replacement not terminated at PerlSubstitute line 1. | |
let l:sysresult = systemlist("perl -e 'use utf8;' -e '#line 1 \"PerlSubstitute\"' -pe ". shellescape("s".escape(a:sstring,"%!").";"), l:lines) | |
if v:shell_error | |
echo l:sysresult | |
return |
use mlua::Lua; | |
use mlua::Result; | |
fn main() -> Result<()> { | |
println!("Hello, world!"); | |
let lua = Lua::new(); | |
{ | |
let mut rust_val = Vec::<i32>::new(); |
function RenameWithQuickfix() | |
local position_params = vim.lsp.util.make_position_params() | |
local new_name = vim.fn.input "New Name > " | |
position_params.newName = new_name | |
vim.lsp.buf_request(0, "textDocument/rename", position_params, function(err, method, result, ...) | |
-- You can uncomment this to see what the result looks like. | |
if false then | |
print(vim.inspect(result)) |
local pickers = require "telescope.pickers" | |
local finders = require "telescope.finders" | |
local previewers = require "telescope.previewers" | |
local actions = require "telescope.actions" | |
local action_state = require "telescope.actions.state" | |
local conf = require("telescope.config").values | |
local primeagen_execute = function(opts) |