Skip to content

Instantly share code, notes, and snippets.

@sravan-s
Last active April 2, 2024 05:58
Show Gist options
  • Save sravan-s/dc359481182e636c588ad30f50a22dfe to your computer and use it in GitHub Desktop.
Save sravan-s/dc359481182e636c588ad30f50a22dfe to your computer and use it in GitHub Desktop.
nvim ~
/home/sravan/.config/nvim/lua/core/mappings.lua
n = {
["<C-e>"] = {
function()
vim.diagnostic.open_float(0, {scope="line"})
end,
"LSP error message expand",
},
/home/sravan/.config/nvim/lua/custom/plugins.lua
local overrides = require("custom.configs.overrides")
---@type NvPluginSpec[]
local plugins = {
-- Override plugin definition options
{
"neovim/nvim-lspconfig",
dependencies = {
-- format & linting
{
"jose-elias-alvarez/null-ls.nvim",
config = function()
require "custom.configs.null-ls"
end,
},
},
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end, -- Override to setup mason-lspconfig
},
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
},
-- Install a plugi:n
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"rust-lang/rust.vim",
ft = "rust",
init = function()
vim.g.rustfmt_autosave = 1
end
},
{
'mrcjkb/haskell-tools.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
},
branch = '2.x.x', -- Recommended
ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' },
},
{
"ocaml/ocaml-lsp",
ft = "ocaml",
dependencies = "neovim/nvim-lspconfig"
},
{
'mrcjkb/rustaceanvim',
version = '^4', -- Recommended
ft = { 'rust' },
event = "BufReadPost",
config = function()
vim.g.rustaceanvim = {
-- Plugin configuration
-- tools = {},
-- LSP configuration
server = {
on_attach = function(client, bufnr)
-- you can also put keymaps in here
vim.lsp.inlay_hint(bufnr, true)
end,
-- settings = {
-- -- rust-analyzer language server configuration
-- ["rust-analyzer"] = {},
-- },
-- },
-- -- DAP configuration
-- dap = {},
},
}
end,
},
{
"mfussenegger/nvim-dap",
}
-- To make a plugin not be loaded
-- {
-- "NvChad/nvim-colorizer.lua",
-- enabled = false
-- },
-- All NvChad plugins are lazy-loaded by default
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
-- {
-- "mg979/vim-visual-multi",
-- lazy = false,
-- }
}
return plugins
/home/sravan/.config/nvim/lua/custom/configs/lspconfig.lua
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require("lspconfig")
-- if you just want default config for the servers then put them in a table
local servers = { "html", "cssls", "tsserver", "clangd", "ocamllsp" }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
--
-- lspconfig.pyright.setup { blabla}
/home/sravan/.config/nvim/lua/plugins/init.lua
{
"folke/which-key.nvim",
keys = { "<leader>", '"', "'", "`", "c", "v" },
init = function()
require("core.utils").load_mappings "whichkey"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "whichkey")
require("which-key").setup(opts)
end,
},
{
"github/copilot.vim",
}
/home/sravan/.config/nvim/lua/plugins/configs/cmp.lua
["<C-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment