diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-23 13:31:11 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-23 13:33:40 +0200 |
commit | fd9b0ecef4142a62b45404700ba1cff488f84a73 (patch) | |
tree | ef6c1f74f05a2220a41ccff4b0890c39229f32f7 /modules/home/soispha/conf/nvim/plgs/femaco | |
parent | refactor(pkgs): Categorize into `by-name` shards (diff) | |
download | nixos-config-fd9b0ecef4142a62b45404700ba1cff488f84a73.zip |
refactor(modules/home): Setup as "normal" NixOS module
Diffstat (limited to 'modules/home/soispha/conf/nvim/plgs/femaco')
-rw-r--r-- | modules/home/soispha/conf/nvim/plgs/femaco/default.nix | 24 | ||||
-rw-r--r-- | modules/home/soispha/conf/nvim/plgs/femaco/lua/femaco.lua | 50 |
2 files changed, 0 insertions, 74 deletions
diff --git a/modules/home/soispha/conf/nvim/plgs/femaco/default.nix b/modules/home/soispha/conf/nvim/plgs/femaco/default.nix deleted file mode 100644 index 0b4f7937..00000000 --- a/modules/home/soispha/conf/nvim/plgs/femaco/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - pkgs, - lib, - ... -}: { - programs.nixvim = { - # TODO: package femaco through a module - extraConfigLuaPost = '' - ${lib.strings.fileContents ./lua/femaco.lua} - ''; - extraPlugins = [ - pkgs.vimPlugins.nvim-FeMaco-lua - ]; - keymaps = [ - { - key = "<leader>cc"; - mode = "n"; - action = "require('femaco.edit').edit_code_block"; - lua = true; - options.desc = "edit a [c]ode blo[c]k with femaco"; - } - ]; - }; -} diff --git a/modules/home/soispha/conf/nvim/plgs/femaco/lua/femaco.lua b/modules/home/soispha/conf/nvim/plgs/femaco/lua/femaco.lua deleted file mode 100644 index da3be8e1..00000000 --- a/modules/home/soispha/conf/nvim/plgs/femaco/lua/femaco.lua +++ /dev/null @@ -1,50 +0,0 @@ -local clip_val = require("femaco.utils").clip_val -require("femaco").setup({ - -- should prepare a new buffer and return the winid - -- by default opens a floating window - -- provide a different callback to change this behaviour - -- @param opts: the return value from float_opts - prepare_buffer = function(opts) - local buf = vim.api.nvim_create_buf(false, false) - return vim.api.nvim_open_win(buf, true, opts) - end, - -- should return options passed to nvim_open_win - -- @param code_block: data about the code-block with the keys - -- * range - -- * lines - -- * lang - float_opts = function(code_block) - return { - relative = "cursor", - width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10), -- TODO: how to offset sign column etc? - height = clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6), - anchor = "NW", - row = 0, - col = 0, - style = "minimal", - border = "rounded", - zindex = 1, - } - end, - -- return filetype to use for a given lang - -- lang can be nil - ft_from_lang = function(lang) - return lang - end, - -- what to do after opening the float - post_open_float = function(winnr) - vim.wo.signcolumn = "no" - end, - -- create the path to a temporary file - create_tmp_filepath = function(filetype) - return os.tmpname() - end, - -- if a newline should always be used, useful for multiline injections - -- which separators needs to be on separate lines such as markdown, neorg etc - -- @param base_filetype: The filetype which FeMaco is called from, not the - -- filetype of the injected language (this is the current buffer so you can - -- get it from vim.bo.filetyp). - ensure_newline = function(base_filetype) - return false - end, -}) |