fix lsp + conform + sleuth

scratch
Gabe Farrell 2 years ago
parent 91ba5541a3
commit cc4abb76ee

@ -3,27 +3,27 @@ vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true vim.opt.termguicolors = true
-- nvchad ui stuff -- nvchad ui stuff
vim.g.base46_cache = vim.fn.stdpath('data') .. '/base46_cache/' vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46_cache/"
vim.g.mapleader = " " vim.g.mapleader = " "
vim.keymap.set({'n', 'v'}, "<Left>", "") vim.keymap.set({ "n", "v" }, "<Left>", "")
vim.keymap.set({'n', 'v'}, "<Down>", "") vim.keymap.set({ "n", "v" }, "<Down>", "")
vim.keymap.set({'n', 'v'}, "<Up>", "") vim.keymap.set({ "n", "v" }, "<Up>", "")
vim.keymap.set({'n', 'v'}, "<Right>", "") vim.keymap.set({ "n", "v" }, "<Right>", "")
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({ vim.fn.system {
"git", "git",
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable", -- latest stable release
lazypath, lazypath,
}) }
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require("lazy").setup({ import = "plugins" }) require("lazy").setup { import = "plugins" }
-- more nvchad ui stuff -- more nvchad ui stuff
-- dofile(vim.g.base46_cache .. "defaults") -- dofile(vim.g.base46_cache .. "defaults")

@ -1,23 +0,0 @@
local lsp_zero = require('lsp-zero')
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr})
end)
-- here you can setup the language servers
require('mason').setup({})
require('mason-lspconfig').setup({
ensure_installed = {
'tsserver',
'rust_analyzer',
'gopls',
'clangd',
}
handlers = {
function(server_name)
require('lspconfig')[server_name].setup({})
end,
}
})

@ -1,27 +1,27 @@
local function on_attach(bufnr) local function on_attach(bufnr)
local api = require "nvim-tree.api" local api = require "nvim-tree.api"
api.config.mappings.default_on_attach(bufnr) api.config.mappings.default_on_attach(bufnr)
end end
local M = { local M = {
disable_netrw = true, disable_netrw = true,
on_attach = on_attach, on_attach = on_attach,
git = { ignore = false }, git = { ignore = false },
renderer = { renderer = {
icons = { icons = {
glyphs = { glyphs = {
git = { -- this is so stupid lmao git = { -- this is so stupid lmao
unstaged = "😴", unstaged = "😴",
staged = "😎", staged = "😎",
unmerged = "😈", unmerged = "😈",
untracked = "😭", untracked = "😭",
renamed = "😶", renamed = "😶",
deleted = "😵", deleted = "😵",
},
}, },
}, },
}, },
},
} }
return M return M

@ -1,12 +1,18 @@
return { return {
ensure_installed = { ensure_installed = {
"lua", "luadoc", "printf", "lua",
"vim", "vimdoc", "go", "luadoc",
"ruby", "rust", "cpp", "printf",
}, "vim",
highlight = { "vimdoc",
enable = true, "go",
use_languagetree = true, "ruby",
}, "rust",
indent = { { enable = true } }, "cpp",
},
highlight = {
enable = true,
use_languagetree = true,
},
indent = { { enable = true } },
} }

@ -5,8 +5,8 @@ M.ui = {
-- hl = highlights -- hl = highlights
hl_add = {}, hl_add = {},
hl_override = { hl_override = {
Comment = { italic = true }, Comment = { italic = true },
['@comment'] = { italic = true }, ["@comment"] = { italic = true },
}, },
changed_themes = {}, changed_themes = {},
theme_toggle = { "onedark", "one_light" }, theme_toggle = { "onedark", "one_light" },
@ -48,7 +48,8 @@ M.ui = {
[[ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ]], [[ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ]],
[[ ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ]], [[ ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ]],
[[ ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ]], [[ ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ]],
[[ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], }, [[ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]],
},
buttons = { buttons = {
{ " Find File", "Spc f f", "Telescope find_files" }, { " Find File", "Spc f f", "Telescope find_files" },
@ -80,19 +81,19 @@ M.ui = {
M.base46 = { M.base46 = {
integrations = { integrations = {
"nvimtree", "nvimtree",
"treesitter", "treesitter",
"blankline", "blankline",
"git", "git",
"lsp", "lsp",
"nvdash", "nvdash",
"syntax", "syntax",
"statusline", "statusline",
"tbline", "tbline",
"telescope", "telescope",
"devicons", "devicons",
"mason", "mason",
"defaults", "defaults",
}, },
} }

@ -1,8 +1,8 @@
return { return {
"NvChad/base46", "NvChad/base46",
branch = "v2.5", branch = "v2.5",
lazy = true, lazy = true,
build = function() build = function()
require("base46").load_all_highlights() require("base46").load_all_highlights()
end, end,
} }

@ -1,14 +1,14 @@
return { return {
"numToStr/Comment.nvim", "numToStr/Comment.nvim",
keys = { keys = {
{ "gcc", mode = "n", desc = "Comment toggle current line" }, { "gcc", mode = "n", desc = "Comment toggle current line" },
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" }, { "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" }, { "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
{ "gbc", mode = "n", desc = "Comment toggle current block" }, { "gbc", mode = "n", desc = "Comment toggle current block" },
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" }, { "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" }, { "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
}, },
config = function(_, opts) config = function(_, opts)
require("Comment").setup(opts) require("Comment").setup(opts)
end, end,
} }

@ -1,11 +1,37 @@
return { return {
"stevearc/conform.nvim", "stevearc/conform.nvim",
opts = { event = { "BufWritePre" },
formatters_by_ft = { cmd = { "ConformInfo" },
lua = { "stylua" }, opts = {
}, format_on_save = function(bufnr)
}, if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
config = function(_, opts) return
require("conform").setup(opts) end
return { timeout_ms = 3000, lsp_fallback = true }
end, end,
} formatters_by_ft = {
bash = { "shfmt" },
sh = { "shfmt" },
fish = { "fish_indent" },
lua = { "stylua" },
go = { "goimports", "gofumpt", "goimports-reviser" },
javascript = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
vue = { { "prettierd", "prettier" } },
css = { { "prettierd", "prettier" } },
scss = { { "prettierd", "prettier" } },
less = { { "prettierd", "prettier" } },
html = { { "prettierd", "prettier" } },
json = { { "prettierd", "prettier" } },
jsonc = { { "prettierd", "prettier" } },
yaml = { { "prettierd", "prettier" } },
markdown = { { "prettierd", "prettier" } },
["markdown.mdx"] = { { "prettierd", "prettier" } },
},
},
config = function(_, opts)
require("conform").setup(opts)
end,
}

@ -1,11 +1,11 @@
return { return {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
event = "User FilePost", event = "User FilePost",
opts = function() opts = function()
return require("configs.gitsigns") return require "configs.gitsigns"
end, end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "git") dofile(vim.g.base46_cache .. "git")
require("gitsigns").setup(opts) require("gitsigns").setup(opts)
end, end,
} }

@ -1,18 +1,17 @@
return { return {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
event = "User FilePost", event = "User FilePost",
opts = { opts = {
indent = { char = "", highlight = "IblChar" }, indent = { char = "", highlight = "IblChar" },
scope = { char = "", highlight = "IblScopeChar" }, scope = { char = "", highlight = "IblScopeChar" },
}, },
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "blankline") dofile(vim.g.base46_cache .. "blankline")
local hooks = require "ibl.hooks" local hooks = require "ibl.hooks"
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level) hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level)
require("ibl").setup(opts) require("ibl").setup(opts)
dofile(vim.g.base46_cache .. "blankline")
end,
}
dofile(vim.g.base46_cache .. "blankline")
end,
}

@ -1,16 +1,44 @@
return { return {
{ {
'williamboman/mason.nvim', "williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonUpdate" }, cmd = { "Mason", "MasonInstall", "MasonUpdate" },
config = function(_, opts_) config = function(_, opts)
dofile(vim.g.base46_cache .. "mason") dofile(vim.g.base46_cache .. "mason")
require('mason').setup(opts) require("mason").setup(opts)
end, end,
}, },
{'williamboman/mason-lspconfig.nvim'}, { "williamboman/mason-lspconfig.nvim" },
{'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'}, {
{'neovim/nvim-lspconfig'}, "VonHeikemen/lsp-zero.nvim",
{'hrsh7th/cmp-nvim-lsp'}, branch = "v3.x",
{'hrsh7th/nvim-cmp'}, config = function()
{'L3MON4D3/LuaSnip'}, local lsp_zero = require "lsp-zero"
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps { buffer = bufnr }
end)
-- here you can setup the language servers
require("mason").setup {}
require("mason-lspconfig").setup {
ensure_installed = {
"tsserver",
"rust_analyzer",
"gopls",
"clangd",
"lua_ls",
"pyright",
},
handlers = {
function(server_name)
require("lspconfig")[server_name].setup {}
end,
},
}
end,
},
{ "neovim/nvim-lspconfig" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/nvim-cmp" },
{ "L3MON4D3/LuaSnip" },
} }

@ -1,12 +1,12 @@
return { return {
"NvChad/nvim-colorizer.lua", "NvChad/nvim-colorizer.lua",
-- event = "User FilePost", event = "User FilePost",
-- opts = { user_default_options = { names = false } }, opts = { user_default_options = { names = false } },
-- config = function(_, opts) config = function(_, opts)
-- require('colorizer').setup(opts) require("colorizer").setup(opts)
--
-- vim.defer_fn(function() vim.defer_fn(function()
-- require('colorizer').attach_to_buffer(0) require("colorizer").attach_to_buffer(0)
-- end, 0) end, 0)
-- end, end,
} }

@ -1,23 +1,23 @@
return { return {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
version = "*", version = "*",
lazy = false, lazy = false,
dependencies = { dependencies = {
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
lazy = true, lazy = true,
opts = function() opts = function()
return { override = require "nvchad.icons.devicons" } return { override = require "nvchad.icons.devicons" }
end, end,
-- opts = {}, -- opts = {},
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "devicons") dofile(vim.g.base46_cache .. "devicons")
require("nvim-web-devicons").setup(opts) require("nvim-web-devicons").setup(opts)
end end,
}, },
opts = function() opts = function()
return require "configs.nvim-tree" return require "configs.nvim-tree"
end, end,
config = function(_, opts) config = function(_, opts)
require("nvim-tree").setup(opts) require("nvim-tree").setup(opts)
end, end,
} }

@ -1,5 +1,5 @@
local map = vim.keymap.set local map = vim.keymap.set
return { return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { "nvim-lua/plenary.nvim" },
} }

@ -1,15 +1,14 @@
return { return {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate", build = ":TSUpdate",
opts = function() opts = function()
return require "configs.treesitter" return require "configs.treesitter"
end, end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "syntax") dofile(vim.g.base46_cache .. "syntax")
dofile(vim.g.base46_cache .. "treesitter") dofile(vim.g.base46_cache .. "treesitter")
require("nvim-treesitter.configs").setup(opts) require("nvim-treesitter.configs").setup(opts)
end, end,
} }

@ -1,8 +1,8 @@
return { return {
"NvChad/ui", "NvChad/ui",
lazy = false, lazy = false,
branch = "v2.5", branch = "v2.5",
config = function() config = function()
require "nvchad" require "nvchad"
end, end,
} }

@ -0,0 +1,3 @@
return {
"timpope/vim-sleuth",
}

@ -1,27 +1,27 @@
local map = vim.keymap.set local map = vim.keymap.set
-- general mappings -- general mappings
map('n', ';', ':') map("n", ";", ":")
map("n", "<leader>rn", "<cmd>set rnu!<CR>", { desc = "Toggle Relative number" }) map("n", "<leader>rn", "<cmd>set rnu!<CR>", { desc = "Toggle Relative number" })
map("n", "<C-s>", "<cmd>w<CR>", { desc = "File Save" }) map("n", "<C-s>", "<cmd>w<CR>", { desc = "File Save" })
map("n", "<C-h>", "<C-w>h", { desc = "Switch Window left" }) map("n", "<C-h>", "<C-w>h", { desc = "Switch Window left" })
map("n", "<C-l>", "<C-w>l", { desc = "Switch Window right" }) map("n", "<C-l>", "<C-w>l", { desc = "Switch Window right" })
map("n", "<C-j>", "<C-w>j", { desc = "Switch Window down" }) map("n", "<C-j>", "<C-w>j", { desc = "Switch Window down" })
map("n", "<C-k>", "<C-w>k", { desc = "Switch Window up" }) map("n", "<C-k>", "<C-w>k", { desc = "Switch Window up" })
map("n", "<leader>qq", ":wa<CR>:qa<CR>" ) map("n", "<leader>qq", ":wa<CR>:qa<CR>")
-- telescope keybinds -- telescope keybinds
local builtin = require('telescope.builtin') local builtin = require "telescope.builtin"
map('n', '<leader>ff', builtin.find_files, { desc = '[f]ind [f]ile' }) map("n", "<leader>ff", builtin.find_files, { desc = "[f]ind [f]ile" })
map('n', '<leader>pg', builtin.live_grep, { desc = '[p]roject [g]rep' }) map("n", "<leader>pg", builtin.live_grep, { desc = "[p]roject [g]rep" })
map('n', '<leader>fb', builtin.buffers, { desc = '[f]ind [b]uffer' }) map("n", "<leader>fb", builtin.buffers, { desc = "[f]ind [b]uffer" })
map('n', '<leader>fh', builtin.help_tags, { desc = '[f]ind [h]elp' }) map("n", "<leader>fh", builtin.help_tags, { desc = "[f]ind [h]elp" })
map("n", "<leader>fg", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc = "[f]ile [g]rep" }) map("n", "<leader>fg", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc = "[f]ile [g]rep" })
-- base46 maps -- base46 maps
map('n', '<leader>th', '<cmd>Telescope themes<CR>', { desc = '[th]emes' }) map("n", "<leader>th", "<cmd>Telescope themes<CR>", { desc = "[th]emes" })
-- nvim-tree mapping -- nvim-tree mapping
map('n', '<leader>e', '<cmd>NvimTreeOpen<CR>') map("n", "<leader>e", "<cmd>NvimTreeOpen<CR>")
-- comment -- comment
map("n", "<leader>/", function() map("n", "<leader>/", function()

Loading…
Cancel
Save