local utils_func = require('utils.funcs') local map = utils_func.map local M = {} M.setup = function() -- set mapleader to space vim.g.mapleader = ' ' -- Get rid of highlight after search map('n', '', ':noh') -- Spell Checking map('n', 'st', ':set spell!') -- Better split movement map('n', '', 'l') map('n', '', 'h') map('n', '', 'k') map('n', '', 'j') -- Better split closing map('n', '', 'c') -- Set current focused file as cwd map('n', 'cd', ':cd %:p:h') local diagnostics_active = true map('n', 'lt', '', { callback = function() diagnostics_active = not diagnostics_active local set_namespace_settings = function( lsp_config --[[table]] ) local namespaces = vim.diagnostic.get_namespaces() local diagnostic = vim.diagnostic.get() for namespace_number, _ in pairs(namespaces) do vim.diagnostic.set(namespace_number, 0, diagnostic, lsp_config) end end if diagnostics_active then vim.notify('Enabling diagnostics') set_namespace_settings({ virtual_lines = true }) else vim.notify('Disabling diagnostics') set_namespace_settings({ virtual_lines = false }) end end, }) end return M