Compare commits

...

6 commits

Author SHA1 Message Date
6eedc63abb
Merge remote-tracking branch 'origin/main' 2024-10-11 12:52:39 -07:00
ff8bdc0eb8
feat: use lsp_lines 2024-10-11 12:51:01 -07:00
d962ad3d0b
feat: add wakatime 2024-10-11 12:28:29 -07:00
9ca2706431
feat: remove intellitab
use builtin `cc` for same functionality
2024-10-11 12:28:10 -07:00
287395d593
chore: better lazy trigger for crates.nvim 2024-10-11 12:27:35 -07:00
e4ba4be689
refactor: return function from lspconfig 2024-10-11 12:14:12 -07:00
5 changed files with 51 additions and 105 deletions

View file

@ -139,7 +139,6 @@
general = with pkgs.vimPlugins; [ general = with pkgs.vimPlugins; [
nvim-autopairs nvim-autopairs
nvim-lspconfig nvim-lspconfig
intellitab-nvim
which-key-nvim which-key-nvim
telescope-nvim telescope-nvim
markdown-preview-nvim markdown-preview-nvim
@ -171,6 +170,8 @@
rustaceanvim rustaceanvim
crates-nvim crates-nvim
haskell-tools-nvim haskell-tools-nvim
vim-wakatime
lsp_lines-nvim
vim-sleuth vim-sleuth
]; ];
}; };

View file

@ -1,5 +1,5 @@
-- Non-exhaustive collection of keymaps. I've decided it's more sane to place -- Mostly remaps of existing keys. New keybinds are generally defined directly
-- plugin specific maps in their respective setup scripts -- in their plugin specs for `lz.n`
vim.g.mapleader = " " vim.g.mapleader = " "
vim.keymap.set("n", "<leader>", "<nop>") vim.keymap.set("n", "<leader>", "<nop>")
@ -22,8 +22,6 @@ vim.keymap.set({ "n", "v" }, "<leader>Y", '"+Y', { desc = "yank rest of line to
vim.keymap.set({ "n", "v" }, "<leader>p", '"+p', { desc = "put after cursor from clipboard" }) vim.keymap.set({ "n", "v" }, "<leader>p", '"+p', { desc = "put after cursor from clipboard" })
vim.keymap.set({ "n", "v" }, "<leader>P", '"+P', { desc = "put before cursor from clipboard" }) vim.keymap.set({ "n", "v" }, "<leader>P", '"+P', { desc = "put before cursor from clipboard" })
vim.keymap.set("i", "<Tab>", require("scripts.intellitab").indent)
-- Allow increment/decrement repeatedly in visual -- Allow increment/decrement repeatedly in visual
vim.keymap.set("v", "<C-a>", "<C-a>gv") vim.keymap.set("v", "<C-a>", "<C-a>gv")
vim.keymap.set("v", "<C-x>", "<C-x>gv") vim.keymap.set("v", "<C-x>", "<C-x>gv")

View file

@ -1,28 +1,37 @@
local lspconfig = require("lspconfig") return function()
local symbols = { Error = "󰅙", Info = "󰋼", Hint = "󰌵", Warn = "" }
lspconfig.lua_ls.setup({ for name, icon in pairs(symbols) do
settings = { local hl = "DiagnosticSign" .. name
Lua = { vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
runtime = { end
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT", local lspconfig = require("lspconfig")
},
diagnostics = { lspconfig.lua_ls.setup({
-- Get the language server to recognize the `vim` global settings = {
globals = { "vim", "nixCats", "MiniBufremove" }, Lua = {
}, runtime = {
workspace = { -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
-- Make the server aware of Neovim runtime files version = "LuaJIT",
library = vim.api.nvim_get_runtime_file("", true), },
}, diagnostics = {
-- Do not send telemetry data containing a randomized but unique identifier -- Get the language server to recognize the `vim` global
telemetry = { globals = { "vim", "nixCats", "MiniBufremove" },
enable = false, },
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
}, },
}, },
}, })
})
lspconfig.nixd.setup({}) lspconfig.nixd.setup({})
lspconfig.marksman.setup({}) lspconfig.marksman.setup({})
lspconfig.tinymist.setup({}) lspconfig.tinymist.setup({})
end

View file

@ -12,13 +12,12 @@ return {
require("plugins.render-markdown"), require("plugins.render-markdown"),
require("plugins.toggleterm"), require("plugins.toggleterm"),
{ "telescope-ui-select.nvim" }, { "telescope-ui-select.nvim" },
{ "vim-wakatime" },
{ "vim-sleuth" }, { "vim-sleuth" },
{ {
"nvim-lspconfig", "nvim-lspconfig",
event = "BufEnter", event = "BufEnter",
after = function() after = require("lsp"),
require("lsp")
end,
}, },
{ {
"which-key.nvim", "which-key.nvim",
@ -232,11 +231,22 @@ return {
}, },
{ {
"crates.nvim", "crates.nvim",
filetypes = "*.toml", event = "BufRead Cargo.toml",
after = function() after = function()
require("crates").setup() require("crates").setup()
end, end,
}, },
{ "rustaceanvim" }, { "rustaceanvim" },
{ "haskell-tools.nvim" }, { "haskell-tools.nvim" },
{
"lsp_lines.nvim",
event = "LspAttach",
after = function()
require("lsp_lines").setup()
vim.diagnostic.config({
virtual_text = false,
virtual_lines = { only_current_line = true },
})
end,
},
} }

View file

@ -1,72 +0,0 @@
-- `intellitab.nvim` by Pedro Alves (https://github.com/pta2002)
-- URL: https://github.com/pta2002/intellitab.nvim?tab=MIT-1-ov-file
-- Copyright 2021 Pedro Alves. Licensed under MIT.
local v = vim.api
local treesitter = require("nvim-treesitter")
local function get_line_indent(line, sw)
local indent = 0
for c in line:gmatch("%s") do
if c == "\t" then
indent = indent + sw
else
indent = indent + 1
end
end
return indent
end
local function indent()
local cursor = v.nvim_win_get_cursor(0)
local line = v.nvim_buf_get_lines(0, cursor[1] - 1, cursor[1], false)[1]
local indentexpr = v.nvim_get_option_value("indentexpr", { buf = 0 })
local expand = v.nvim_get_option_value("expandtab", { buf = 0 })
local shiftwidth = v.nvim_eval("shiftwidth()")
local tab_char = v.nvim_replace_termcodes("<Tab>", true, true, true)
local indent_goal
if treesitter ~= nil and treesitter.get_indent ~= nil then
indent_goal = treesitter.get_indent(line)
end
if indent_goal == nil or indent_goal < 0 then
if indentexpr ~= "" then
indent_goal = v.nvim_eval(indentexpr)
elseif v.nvim_get_option_value("cindent", { buf = 0 }) then
indent_goal = v.nvim_call_function("cindent", { cursor[1] })
else
indent_goal = v.nvim_call_function("indent", { cursor[1] })
end
end
if indent_goal == -1 and cursor[1] ~= 1 then
local prev_line = v.nvim_buf_get_lines(0, cursor[1] - 2, cursor[1] - 1, false)[1]
indent_goal = get_line_indent(prev_line, shiftwidth)
end
-- Reset the cursor, since the functions are free to move it
v.nvim_win_set_cursor(0, cursor)
if cursor[2] == 0 and line == "" and indent_goal ~= nil and indent_goal > 0 then
local i = 0
while i < indent_goal do
if expand then
v.nvim_feedkeys(" ", "n", true)
i = i + 1
else
v.nvim_feedkeys(tab_char, "n", true)
i = i + shiftwidth
end
end
print(i, indent_goal)
else
v.nvim_feedkeys(tab_char, "n", true)
end
end
return { indent = indent }