kdheepak / blog Goto Github PK
View Code? Open in Web Editor NEWMy personal thoughts and notes
Home Page: https://blog.kdheepak.com
My personal thoughts and notes
Home Page: https://blog.kdheepak.com
I want to share a few neovim built-in features that can make you more productive.
https://blog.kdheepak.com/three-built-in-neovim-features.html
Hello! First off, I want to say that I love the blog post! It's such an exciting way to write plugins and I had no idea about the lua C abi bindings in such detail before. I have run into a bit of a snag though it's probably just due to my own ignorance.
I'm running MacOs 10.15.7, and after following the instructions I wasn't able to get the plugin to compile.
My steps were
cargo new --lib rust_plugin_test
[lib]
crate-type = ["cdylib"]
[dependencies]
mlua = {version = "*", features = ["luajit", "vendored", "module", "macros"]}
to my cargo.toml
3. Replace my src/lib.rs with
use mlua::chunk;
use mlua::prelude::*;
fn hello(lua: &Lua, name: String) -> LuaResult<LuaTable> {
let t = lua.create_table()?;
t.set("name", name.clone())?;
let _globals = lua.globals();
lua.load(chunk! {
print("hello, " .. $name)
})
.exec()?;
Ok(t)
}
#[mlua::lua_module]
fn moonshine(lua: &Lua) -> LuaResult<LuaTable> {
let exports = lua.create_table()?;
exports.set("hello", lua.create_function(hello)?)?;
Ok(exports)
}
~/.cargo/config
file by default I touch .cargo/config
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
into ~/.cargo/config
6. Finally I run cargo build --release && mv target/release/libmoonshine.dylib lua/moonshine.so
The output of which is
mv: rename target/release/libmoonshine.dylib to lua/moonshine.so: No such file or directory
I'm sure I'm missing something obvious, and if I am I'm very sorry.
Thanks again for your time!
Franklin.jl has lots of neat features. Instead of reinventing the wheel using lua filters and pandoc, using Frankin.jl might be the way to go.
undefined
What I wish I had known when I first started using vim
https://blog.kdheepak.com/fast-track-to-being-productive-in-vim.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.