Giter Site home page Giter Site logo

lvim-linguistics's Introduction

LVIM LINGUISTICS

LVIM LINGUISTICS

License

DESCRIPTION

Lvim Linguistics is a plug-in for controlling spelling and keyboard language in insert mode (when writing a document in a different language).

This plug-in is support local config for projects (directories)

Current version - 1.0.30 (2022-11-10)

Requirements:

Init

use({
    "lvim-tech/lvim-linguistics",
    event = "VimEnter",
    requires = {
        {
            "MunifTanjim/nui.nvim",
        },
        {
            "rcarriga/nvim-notify",
        },
        {
            "lvim-tech/lvim-ui-config",
        },
    },
    config = function()
        require("lvim-linguistics").setup({
            -- your config
        })
    end,
})

Default config

plugin_config = {
    kbrd_cmd = "xkb-switch -s ",
    spell_files_folder = os.getenv("HOME") .. "/.config/nvim/spell/",
},
base_config = {
    mode_language = {
        active = false,
        file_types = {
            black_list = {
                "alpha",
                "ctrlspace",
                "ctrlspace_help",
                "packer",
                "undotree",
                "diff",
                "Outline",
                "NvimTree",
                "LvimHelper",
                "floaterm",
                "toggleterm",
                "Trouble",
                "dashboard",
                "vista",
                "spectre_panel",
                "DiffviewFiles",
                "flutterToolsOutline",
                "log",
                "qf",
                "dapui_scopes",
                "dapui_breakpoints",
                "dapui_stacks",
                "dapui_watches",
                "calendar",
                "octo",
                "neo-tree",
                "neo-tree-popup",
                "noice",
            },
            white_list = {},
        },
        normal_mode_language = nil,
        insert_mode_language = nil,
        insert_mode_languages = {},
    },
    spell = {
        active = false,
        file_types = {
            black_list = {
                "alpha",
                "ctrlspace",
                "ctrlspace_help",
                "packer",
                "undotree",
                "diff",
                "Outline",
                "NvimTree",
                "LvimHelper",
                "floaterm",
                "toggleterm",
                "Trouble",
                "dashboard",
                "vista",
                "spectre_panel",
                "DiffviewFiles",
                "flutterToolsOutline",
                "log",
                "qf",
                "dapui_scopes",
                "dapui_breakpoints",
                "dapui_stacks",
                "dapui_watches",
                "calendar",
                "octo",
                "neo-tree",
                "neo-tree-popup",
                "noice",
            },
            white_list = {},
        },
        language = nil,
        languages = {
            en = {
                spelllang = "en",
                spellfile = "en.add",
            },
        },
    },
}
  • kbrd_cmd - command for switch keyboard

  • spell_files_folder - folder to save spell files

  • base_config - config for mode language and spelling

  • base_config example:

base_config = {
    mode_language = {
        active = true, -- changing the keyboard language start automatically
        white_list = {
            "tex", -- active is true only for tex filetype
        },
        normal_mode_language = "us", -- keyboard language (normal mode)
        insert_mode_language = "fr", -- keyboard language (insert mode)
        insert_mode_languages = { "fr", "de" }, -- you can choice language for insert mode
    },
    spell = {
        active = true, -- spelling start automatically
        white_list = {
            "tex", -- active is true only for tex filetype
        },
        language = "ft", -- language for spellin
        languages = { -- you can choice language for spelling
            en = {
                spelllang = "en",
                spellfile = "en.add",
            }, -- config for en
            fr = {
                spelllang = "fr",
                spellfile = "fr.add",
            }, -- config for fr
            de = {
                spelllang = "de",
                spellfile = "de.add",
            }, -- config for de
            en_fr = {
                spelllang = "en,fr",
                spellfile = "en_fr.add",
            }, -- config for en + fr
        },
    },
}

Commands

Mode language

  • LvimLinguisticsMENUInsertModeStatus

Enable / Disable changing language in insert mode

LvimLinguisticsMENUInsertModeStatus

  • LvimLinguisticsMENUInsertModeLanguage

Language selection for insert mode

LvimLinguisticsMENUInsertModeLanguage

  • LvimLinguisticsTOGGLEInsertModeLanguage

You can set a keymap for this command to enable/disable

vim.keymap.set("n", "<C-c>l", function()
    vim.cmd("LvimLinguisticsTOGGLEInsertModeLanguage")
end, { noremap = true, silent = true, desc = "LvimLinguisticsTOGGLEInsertModeLanguage" })

LvimLinguisticsTOGGLEInsertModeLanguage

Spell

  • LvimLinguisticsMENUSpellingStatus

Enable / Disable spelling

LvimLinguisticsMENUSpellingStatus

  • LvimLinguisticsMENUSpellLanguages

Select spelling language

LvimLinguisticsMENUSpellLanguages

  • LvimLinguisticsTOGGLESpelling
vim.keymap.set("n", "<C-c>s", function()
    vim.cmd("LvimLinguisticsTOGGLESpelling")
end, { noremap = true, silent = true, desc = "LvimLinguisticsTOGGLESpelling" })

LvimLinguisticsTOGGLESpelling

Local config

  • LvimLinguisticsMENUSaveCurrentConfigAsLocal

Save the current configuration for the current project (folder)

LvimLinguisticsMENUSaveCurrentConfigAsLocal

LvimLinguisticsLocalConfigFile

  • LvimLinguisticsMENUUpdateLocalConfig

Update the current configuration for the current project (folder)

LvimLinguisticsMENUUpdateLocalConfig

  • LvimLinguisticsMENUDeleteLocalConfig

Delete a file for the current project (folder)

LvimLinguisticsMENUDeleteLocalConfig

Status

You can add custom statusline component for Spell status

  • Example for Heirline:
local spell = {
    condition = require("lvim-linguistics.status").spell_has,
    provider = function()
        local status = require("lvim-linguistics.status").spell_get()
        return status
    end,
    hl = { fg = "#YOUR_COLOR", bold = true },
}

lvim-linguistics's People

Contributors

lvim-tech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.