plugins.femaco.settings

Options provided to the require('femaco').setup function.

Type: attribute set of anything

Default: { }

Example:

{
  ensure_newline = {
    __raw = ''
      function(base_filetype)
        return true
      end
    '';
  };
  ft_from_lang = {
    __raw = ''
      function(lang)
        if mapped_filetype[lang] then
          return mapped_filetype[lang]
        end
        return lang
      end
    '';
  };
}

Declared by:

plugins.femaco.settings.create_tmp_filepath

Create the path to a temporary file.

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "function(filetype)\n return os.tmpname()\nend\n"

Declared by:

plugins.femaco.settings.ensure_newline

Whether a newline should always be used. This is 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).

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "function(base_filetype)\n return false\nend\n"

Declared by:

plugins.femaco.settings.float_opts

Should return options passed to nvim_open_win @param code_block: data about the code-block with the keys

  • range
  • lines
  • lang

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "function(code_block)\n return {\n relative = 'cursor',\n width = require('femaco.utils').clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10),\n height = require('femaco.utils').clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6),\n anchor = 'NW',\n row = 0,\n col = 0,\n style = 'minimal',\n border = 'rounded',\n zindex = 1,\n }\nend\n"

Declared by:

plugins.femaco.settings.ft_from_lang

Return filetype to use for a given lang. lang can be nil.

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "function(lang)\n return lang\nend\n"

Declared by:

plugins.femaco.settings.normalize_indent

Should return true if the indentation should be normalized.

Useful when the injected language inherits indentation from the construction scope (e.g. an inline multiline sql string).

If true, the leading indentation is detected, stripped, and restored before/after editing.

@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.filetype).

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "function (base_filetype)\n return false\nend\n"

Declared by:

plugins.femaco.settings.post_open_float

What to do after opening the float.

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "function(winnr)\n vim.wo.signcolumn = 'no'\nend\n"

Declared by:

plugins.femaco.settings.prepare_buffer

This function should prepare a new buffer and return the winid. By default, it opens a floating window. Provide a different callback to change this behaviour.

@param opts: the return value from float_opts

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "function(opts)\n local buf = vim.api.nvim_create_buf(false, false)\n return vim.api.nvim_open_win(buf, true, opts)\nend\n"

Declared by: