updating nvim lsp setup, getting there

This commit is contained in:
Solomon Laing 2026-01-04 22:41:08 +10:30
parent 35dda4a37f
commit 1cefee76d8
8 changed files with 268 additions and 436 deletions

View File

@ -23,7 +23,7 @@ require("lazyvim.utils").setup()
require("lazy").setup({
spec = "lazyvim.plugins",
defaults = { lazy = true, version = false },
defaults = { lazy = false, version = false },
checker = { enabled = true },
})

View File

@ -3,35 +3,35 @@ local M = {}
M.autoformat = true
function M.toggle()
M.autoformat = not M.autoformat
vim.notify(M.autoformat and "Enabled format on save" or "Disabled format on save")
M.autoformat = not M.autoformat
vim.notify(M.autoformat and "Enabled format on save" or "Disabled format on save")
end
function M.format()
-- TODO: work out how to call conform if it has a formatter and default
-- to vim.lsp.buf.format()
-- TODO: work out how to call conform if it has a formatter and default
-- to vim.lsp.buf.format()
vim.lsp.buf.format()
vim.lsp.buf.format()
if require("lazy.core.config").plugins["conform.nvim"]._.loaded then
require("conform.nvim").format()
else
vim.lsp.buf.format()
end
if require("lazy.core.config").plugins["conform.nvim"]._.loaded then
require("conform").format()
else
vim.lsp.buf.format()
end
end
function M.on_attach(client, buf)
if client:supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("LspFormat." .. buf, {}),
buffer = buf,
callback = function()
if M.autoformat then
M.format()
end
end,
})
end
if client:supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("LspFormat." .. buf, {}),
buffer = buf,
callback = function()
if M.autoformat then
M.format()
end
end,
})
end
end
return M

View File

@ -1,242 +1,83 @@
return {
-- lspconfig
{
"neovim/nvim-lspconfig",
enabled = true,
event = "BufReadPre",
dependencies = {
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
"mason.nvim",
{
"mason-org/mason-lspconfig.nvim",
version = "^1.0.0",
},
-- "hrsh7th/cmp-nvim-lsp",
},
opts = {
-- options for vim.diagnostic.config()
diagnostics = {
underline = true,
update_in_insert = true,
virtual_text = { spacing = 4, prefix = "" },
severity_sort = true,
},
autoformat = true,
servers = {
lua_ls = {
mason = true,
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
callSnippet = "Replace",
},
},
},
},
ltex = {
mason = true,
settings = {
ltex = {
language = "en-AU",
},
},
},
omnisharp = {},
powershell_es = {
bundle_path = 'c:/Users/Solomon/scripts/PowerShellEditorServices',
shell = 'powershell.exe',
},
-- angularls = {
-- -- cmd = { "ngserver", "--stdio", "--tsProbeLocations", require("lazyvim.utils").get_root(), "--ngProbeLocations", require("lazyvim.utils").get_root(), },
-- -- on_new_config = function(new_config, new_root_dir)
-- -- new_config.cmd = cmd
-- -- end,
-- },
},
setup = {
-- additional setup can be added here.
omnisharp = function(_, _)
require("lazyvim.utils").on_attach(function(client, _)
if client.name == "omnisharp" then
---@type string[]
local tokenModifiers =
client.server_capabilities.semanticTokensProvider.legend.tokenModifiers
for i, v in ipairs(tokenModifiers) do
tokenModifiers[i] = v:gsub(" ", "_")
end
---@type string[]
local tokenTypes = client.server_capabilities.semanticTokensProvider.legend.tokenTypes
for i, v in ipairs(tokenTypes) do
tokenTypes[i] = v:gsub(" ", "_")
end
end
end)
return false
end,
},
},
config = function(_, opts)
local Util = require("lazyvim.utils")
-- setup autoformat
require("lazyvim.plugins.lsp.format").autoformat = opts.autoformat
-- lspconfig
{
"mason-org/mason-lspconfig.nvim",
enabled = true,
dependencies = {
{
"mason-org/mason.nvim",
opts = {},
},
"neovim/nvim-lspconfig",
},
opts = {
automatic_enable = true,
ensure_installed = {
"lua_ls",
},
},
config = function(_, opts)
require("mason-lspconfig").setup(opts)
require("lazyvim.plugins.lsp.config").setup()
end,
},
-- setup formatting and keymaps
Util.on_attach(function(client, buffer)
require("lazyvim.plugins.lsp.format").on_attach(client, buffer)
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
end)
{
"mason-org/mason.nvim",
cmd = "Mason",
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
opts = {
automatic_istallation = false,
},
},
-- diagnostics
for name, icon in pairs(require("lazyvim.config.icons").diagnostics) do
name = "DiagnosticSign" .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
-- formatting
{
"stevearc/conform.nvim",
enabled = true,
opts = {
formatters_by_ft = {
lua = { "stylua" },
-- Conform will run multiple formatters sequentially
python = { "isort", "black" },
-- Use a sub-list to run only the first available formatter
typescript = { { "prettierd", "prettier" } },
cs = { "csharpier" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
},
},
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and ""
or function(diagnostic)
local icons = require("lazyvim.config").icons.diagnostics
for d, icon in pairs(icons) do
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
return icon
end
end
end
end
-- cmdline tools and lsp servers
{
"mason-org/mason.nvim",
enabled = true,
cmd = "Mason",
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
opts = {
automatic_istallation = false,
},
},
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
local servers = opts.servers
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
-- require("cmp_nvim_lsp").default_capabilities(),
require("blink.cmp").get_lsp_capabilities(),
opts.capabilities or {}
)
local function setup(server)
local server_opts = vim.tbl_deep_extend("force", {
capabilities = vim.deepcopy(capabilities),
}, servers[server] or {})
if opts.setup[server] then
if opts.setup[server](server, server_opts) then
return
end
elseif opts.setup["*"] then
if opts.setup["*"](server, server_opts) then
return
end
end
vim.lsp.enable(server)
vim.lsp.config(server, server_opts)
end
-- get all the servers that are available thourgh mason-lspconfig
local have_mason, mlsp = pcall(require, "mason-lspconfig")
local all_mslp_servers = {}
if have_mason then
all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package)
end
local ensure_installed = {} ---@type string[]
for server, server_opts in pairs(servers) do
if server_opts then
server_opts = server_opts == true and {} or server_opts
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then
setup(server)
else
ensure_installed[#ensure_installed + 1] = server
end
end
end
if have_mason then
mlsp.setup({ ensure_installed = ensure_installed })
mlsp.setup_handlers({ setup })
end
end,
},
-- formatting
{
"stevearc/conform.nvim",
enabled = true,
opts = {
formatters_by_ft = {
lua = { "stylua" },
-- Conform will run multiple formatters sequentially
python = { "isort", "black" },
-- Use a sub-list to run only the first available formatter
typescript = { { "prettierd", "prettier" } },
cs = { "csharpier" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
},
},
-- cmdline tools and lsp servers
{
"williamboman/mason.nvim",
version = "^1.0.0",
enabled = true,
cmd = "Mason",
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
opts = {
automatic_istallation = false,
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
},
},
config = function(_, opts)
require("mason").setup()
local mr = require("mason-registry")
for _, tool in ipairs(opts.ensure_installed) do
local p = mr.get_package(tool)
if not p:is_installed() then
p:install()
end
end
end,
},
-- language specific tooling
{
"simrat39/rust-tools.nvim",
enabled = false,
opts = {
server = {
on_attach = function(_, bufnr)
local rt = require("rust-tools")
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
},
},
},
-- language specific tooling
{
"simrat39/rust-tools.nvim",
enabled = false,
opts = {
server = {
on_attach = function(_, bufnr)
local rt = require("rust-tools")
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
},
},
},
}

View File

@ -1,72 +1,72 @@
local M = {}
function M.on_attach(client, buffer)
local self = M.new(client, buffer)
local self = M.new(client, buffer)
self:map("<leader>ld", vim.diagnostic.open_float, { desc = "Line Diagnostics" })
self:map("<leader>lI", "LspInfo", { desc = "Lsp Info" })
self:map("<leader>ls", "Telescope diagnostics", { desc = "Telescope Diagnostics" })
self:map("gd", "Telescope lsp_definitions", { desc = "Goto Definition" })
self:map("gr", "Telescope lsp_references", { desc = "References" })
self:map("gD", "Telescope lsp_declarations", { desc = "Goto Declaration" })
self:map("gI", "Telescope lsp_implementations", { desc = "Goto Implementation" })
self:map("gt", "Telescope lsp_type_definitions", { desc = "Goto Type Definition" })
self:map("K", vim.lsp.buf.hover, { desc = "Hover" })
self:map("gK", vim.lsp.buf.signature_help, { desc = "Signature Help", has = "signatureHelp" })
self:map("[d", M.diagnostic_goto(true), { desc = "Next Diagnostic" })
self:map("]d", M.diagnostic_goto(false), { desc = "Prev Diagnostic" })
self:map("]e", M.diagnostic_goto(true, "ERROR"), { desc = "Next Error" })
self:map("[e", M.diagnostic_goto(false, "ERROR"), { desc = "Prev Error" })
self:map("]w", M.diagnostic_goto(true, "WARNING"), { desc = "Next Warning" })
self:map("[w", M.diagnostic_goto(false, "WARNING"), { desc = "Prev Warning" })
self:map("<leader>la", vim.lsp.buf.code_action, { desc = "Code Action", mode = { "n", "v" }, has = "codeAction" })
self:map("<leader>ld", vim.diagnostic.open_float, { desc = "Line Diagnostics" })
self:map("<leader>lI", [[checkhealth lsp]], { desc = "Lsp Info" })
self:map("<leader>ls", "Telescope diagnostics", { desc = "Telescope Diagnostics" })
self:map("gd", "Telescope lsp_definitions", { desc = "Goto Definition" })
self:map("gr", "Telescope lsp_references", { desc = "References" })
self:map("gD", "Telescope lsp_declarations", { desc = "Goto Declaration" })
self:map("gI", "Telescope lsp_implementations", { desc = "Goto Implementation" })
self:map("gt", "Telescope lsp_type_definitions", { desc = "Goto Type Definition" })
self:map("K", vim.lsp.buf.hover, { desc = "Hover" })
self:map("gK", vim.lsp.buf.signature_help, { desc = "Signature Help", has = "signatureHelp" })
self:map("[d", M.diagnostic_goto(true), { desc = "Next Diagnostic" })
self:map("]d", M.diagnostic_goto(false), { desc = "Prev Diagnostic" })
self:map("]e", M.diagnostic_goto(true, "ERROR"), { desc = "Next Error" })
self:map("[e", M.diagnostic_goto(false, "ERROR"), { desc = "Prev Error" })
self:map("]w", M.diagnostic_goto(true, "WARNING"), { desc = "Next Warning" })
self:map("[w", M.diagnostic_goto(false, "WARNING"), { desc = "Prev Warning" })
self:map("<leader>la", vim.lsp.buf.code_action, { desc = "Code Action", mode = { "n", "v" }, has = "codeAction" })
local format = require("lazyvim.plugins.lsp.format").format
self:map("<leader>lf", format, { desc = "Format Document", has = "documentFormatting" })
self:map("<leader>lr", M.rename, { expr = true, desc = "Rename", has = "rename" })
local format = require("lazyvim.plugins.lsp.format").format
self:map("<leader>lf", format, { desc = "Format Document", has = "documentFormatting" })
self:map("<leader>lr", M.rename, { expr = true, desc = "Rename", has = "rename" })
if client.name == "tsserver" and pcall(require, "typescript") then
self:map("<leader>lo", "TypescriptOrganizeImports", { desc = "Organize Imports" })
self:map("<leader>lR", "TypescriptRenameFile", { desc = "Rename File" })
end
if client.name == "tsserver" and pcall(require, "typescript") then
self:map("<leader>lo", "TypescriptOrganizeImports", { desc = "Organize Imports" })
self:map("<leader>lR", "TypescriptRenameFile", { desc = "Rename File" })
end
end
function M.new(client, buffer)
return setmetatable({ client = client, buffer = buffer }, { __index = M })
return setmetatable({ client = client, buffer = buffer }, { __index = M })
end
function M:has(cap)
return self.client.server_capabilities[cap .. "Provider"]
return self.client.server_capabilities[cap .. "Provider"]
end
function M:map(lhs, rhs, opts)
opts = opts or {}
if opts.has and not self:has(opts.has) then
return
end
vim.keymap.set(
opts.mode or "n",
lhs,
type(rhs) == "string" and ("<cmd>%s<cr>"):format(rhs) or rhs,
---@diagnostic disable-next-line: no-unknown
{ silent = true, buffer = self.buffer, expr = opts.expr, desc = opts.desc }
)
opts = opts or {}
if opts.has and not self:has(opts.has) then
return
end
vim.keymap.set(
opts.mode or "n",
lhs,
type(rhs) == "string" and ("<cmd>%s<cr>"):format(rhs) or rhs,
---@diagnostic disable-next-line: no-unknown
{ silent = true, buffer = self.buffer, expr = opts.expr, desc = opts.desc }
)
end
function M.rename()
if pcall(require, "inc_rename") then
return ":IncRename " .. vim.fn.expand("<cword>")
else
vim.lsp.buf.rename()
end
if pcall(require, "inc_rename") then
return ":IncRename " .. vim.fn.expand("<cword>")
else
vim.lsp.buf.rename()
end
end
function M.diagnostic_goto(next, severity)
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
severity = severity and vim.diagnostic.severity[severity] or nil
return function()
go({ severity = severity })
end
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
severity = severity and vim.diagnostic.severity[severity] or nil
return function()
go({ severity = severity })
end
end
return M

View File

@ -44,7 +44,7 @@ function M.disable_others_when_zk(client)
end
end
function M.on_attach(client, bufnr)
function M.on_attach(client, _)
-- M.disable_deno_formatting(client)
-- M.resolve_tsserver_deno(client)
M.disable_others_when_zk(client)

View File

@ -2,6 +2,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
enable = true,
lazy = false,
build = ":TSUpdate",
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
@ -81,18 +82,4 @@ return {
require("nvim-treesitter").setup(opts)
end,
},
{
"nvim-treesitter/nvim-treesitter-context",
name = "treesitter-context",
enabled = true,
lazy = true,
opts = {},
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
enabled = true,
dependencies = {
"nvim-treesitter/nvim-treesitter"
}
},
}

View File

@ -3,18 +3,19 @@ local M = {}
M.root_patterns = { ".git", "/lua" }
function M.setup()
require "lazyvim.utils.term"
require("lazyvim.utils.term")
end
---@param on_attach fun(client, buffer)
function M.on_attach(on_attach)
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local buffer = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
on_attach(client, buffer)
end,
})
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("my.lsp", {}),
callback = function(args)
local buffer = args.buf
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
on_attach(client, buffer)
end,
})
end
-- returns the root directory based on:
@ -24,146 +25,146 @@ end
-- * root pattern of cwd
---@return string
function M.get_root()
---@type string?
local path = vim.api.nvim_buf_get_name(0)
path = path ~= "" and vim.loop.fs_realpath(path) or nil
---@type string[]
local roots = {}
if path then
for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
local workspace = client.config.workspace_folders
local paths = workspace
and vim.tbl_map(function(ws)
return vim.uri_to_fname(ws.uri)
end, workspace)
or client.config.root_dir and { client.config.root_dir }
or {}
for _, p in ipairs(paths) do
local r = vim.loop.fs_realpath(p)
if path:find(r, 1, true) then
roots[#roots + 1] = r
end
end
end
end
table.sort(roots, function(a, b)
return #a > #b
end)
---@type string?
local root = roots[1]
if not root then
path = path and vim.fs.dirname(path) or vim.loop.cwd()
---@type string?
root = vim.fs.find(M.root_patterns, { path = path, upward = true })[1]
root = root and vim.fs.dirname(root) or vim.loop.cwd()
end
---@cast root string
return root
---@type string?
local path = vim.api.nvim_buf_get_name(0)
path = path ~= "" and vim.loop.fs_realpath(path) or nil
---@type string[]
local roots = {}
if path then
for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
local workspace = client.config.workspace_folders
local paths = workspace
and vim.tbl_map(function(ws)
return vim.uri_to_fname(ws.uri)
end, workspace)
or client.config.root_dir and { client.config.root_dir }
or {}
for _, p in ipairs(paths) do
local r = vim.loop.fs_realpath(p)
if path:find(r, 1, true) then
roots[#roots + 1] = r
end
end
end
end
table.sort(roots, function(a, b)
return #a > #b
end)
---@type string?
local root = roots[1]
if not root then
path = path and vim.fs.dirname(path) or vim.loop.cwd()
---@type string?
root = vim.fs.find(M.root_patterns, { path = path, upward = true })[1]
root = root and vim.fs.dirname(root) or vim.loop.cwd()
end
---@cast root string
return root
end
---@param silent boolean?
---@param values? {[1]:any, [2]:any}function
function M.toggle(option, silent, values)
if values then
if vim.opt_local[option]:get() == values[1] then
vim.opt_local[option] = values[2]
else
vim.opt_local[option] = values[1]
end
return vim.notify(
"Set " .. option .. " to " .. vim.opt_local[option]:get(),
vim.log.levels.INFO,
{ title = "Option" }
)
end
vim.opt_local[option] = not vim.opt_local[option]:get()
if not silent then
vim.notify(
(vim.opt_local[option]:get() and "Enabled" or "Disabled") .. " " .. option,
vim.log.levels.INFO,
{ title = "Option" }
)
end
if values then
if vim.opt_local[option]:get() == values[1] then
vim.opt_local[option] = values[2]
else
vim.opt_local[option] = values[1]
end
return vim.notify(
"Set " .. option .. " to " .. vim.opt_local[option]:get(),
vim.log.levels.INFO,
{ title = "Option" }
)
end
vim.opt_local[option] = not vim.opt_local[option]:get()
if not silent then
vim.notify(
(vim.opt_local[option]:get() and "Enabled" or "Disabled") .. " " .. option,
vim.log.levels.INFO,
{ title = "Option" }
)
end
end
local diagnostics_enabled = true
function M.toggle_diagnostics()
diagnostics_enabled = not diagnostics_enabled
if diagnostics_enabled then
vim.diagnostic.enable()
vim.notify("Enabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
else
vim.diagnostic.disable()
vim.notify("Disabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
end
diagnostics_enabled = not diagnostics_enabled
if diagnostics_enabled then
vim.diagnostic.enable()
vim.notify("Enabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
else
vim.diagnostic.disable()
vim.notify("Disabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
end
end
function M.smart_quit()
local bufnr = vim.api.nvim_get_current_buf()
local modified = vim.api.nvim_buf_get_option(bufnr, "modified")
if modified then
vim.ui.input({
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
}, function(input)
if input == "y" then
vim.cmd("q!")
end
end)
else
vim.cmd("q!")
end
local bufnr = vim.api.nvim_get_current_buf()
local modified = vim.api.nvim_buf_get_option(bufnr, "modified")
if modified then
vim.ui.input({
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
}, function(input)
if input == "y" then
vim.cmd("q!")
end
end)
else
vim.cmd("q!")
end
end
function M.isempty(s)
return s == nil or s == ""
return s == nil or s == ""
end
function M.get_buf_option(opt)
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_option, 0, opt)
if not status_ok then
return nil
else
return buf_option
end
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_option, 0, opt)
if not status_ok then
return nil
else
return buf_option
end
end
function M.telescope(builtin, opts)
opts = opts or {}
opts.dir = opts.dir or M.get_root()
return function()
require("telescope.builtin")[builtin](vim.tbl_deep_extend("force", { cwd = opts.dir }, opts))
end
opts = opts or {}
opts.dir = opts.dir or M.get_root()
return function()
require("telescope.builtin")[builtin](vim.tbl_deep_extend("force", { cwd = opts.dir }, opts))
end
end
-- This might not be best, but it allows for easy resetting
function M.setColorscheme(scheme)
local colorscheme = scheme or "gruvbox-material"
local colorscheme = scheme or "gruvbox-material"
local okay, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
local okay, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not okay then
vim.notify("Colorscheme " .. colorscheme .. " not found!")
vim.cmd("colorscheme habamax")
end
if not okay then
vim.notify("Colorscheme " .. colorscheme .. " not found!")
vim.cmd("colorscheme habamax")
end
end
function M.trim_whitespace()
pcall(vim.cmd, 'let currPos = getpos(".")')
pcall(vim.cmd, [[%s/\s\+$//e]])
pcall(vim.cmd, [[%s/\n\+\%$//e]])
pcall(vim.cmd, [[.[ch] %s/\%$/\r/e]])
pcall(vim.cmd, 'cal cursor(currPos[1], currPos[2])')
pcall(vim.cmd, 'let currPos = getpos(".")')
pcall(vim.cmd, [[%s/\s\+$//e]])
pcall(vim.cmd, [[%s/\n\+\%$//e]])
pcall(vim.cmd, [[.[ch] %s/\%$/\r/e]])
pcall(vim.cmd, "cal cursor(currPos[1], currPos[2])")
end
function M.exists(path)
local exists = vim.fn.filereadable(vim.fn.expand(path))
if exists == 1 then
-- vim.notify(path .. " exists", vim.log.levels.INFO)
return true
else
-- vim.notify(path .. " doesn't exist", vim.log.levels.INFO)
return false
end
local exists = vim.fn.filereadable(vim.fn.expand(path))
if exists == 1 then
-- vim.notify(path .. " exists", vim.log.levels.INFO)
return true
else
-- vim.notify(path .. " doesn't exist", vim.log.levels.INFO)
return false
end
end
return M

View File

@ -33,6 +33,9 @@ setw -g pane-base-index 1
# Enable full mouse support.
# set -g mouse on # gross gross gross
# focus events for neovim
set-option -g focus-events on
# vi mode for movement and copy/paste
set-window-option -g mode-keys vi
bind -T copy-mode-vi v send-keys -X begin-selection