Working on lsp
This commit is contained in:
parent
764b890c58
commit
2566fbbec4
18 changed files with 293 additions and 110 deletions
|
@ -12,4 +12,6 @@
|
|||
["<leader>,ck"] = { ":Kebab<CR>", desc = "To Kebab Case" },
|
||||
["<leader>,ce"] = { ":Screm<CR>", desc = "To Screm Case" },
|
||||
- https://github.com/tpope/vim-fugitive
|
||||
|
||||
- https://github.com/folke/noice.nvim
|
||||
- greg's: https://github.com/gblock0/dotfiles/blob/master/nvim/.config/nvim/lua/gb/plugins.lua
|
||||
- others: https://nvimluau.dev/
|
||||
|
|
|
@ -4,6 +4,6 @@ return {
|
|||
event = "BufEnter *.http",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
keys = {
|
||||
{ "<leader>r", function() require("rest-nvim").run() end, desc = "Send http request" }
|
||||
{ "<leader>r", function() require("rest-nvim").run() end, desc = "Send selected http request" }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,80 @@
|
|||
return {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v2.x',
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{'neovim/nvim-lspconfig'}, -- Required
|
||||
{ -- Optional
|
||||
'williamboman/mason.nvim',
|
||||
build = function()
|
||||
pcall(vim.cmd, 'MasonUpdate')
|
||||
end,
|
||||
},
|
||||
{'williamboman/mason-lspconfig.nvim'}, -- Optional
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v2.x',
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{'neovim/nvim-lspconfig'},
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
build = function()
|
||||
pcall(vim.cmd, 'MasonUpdate')
|
||||
end,
|
||||
},
|
||||
{'williamboman/mason-lspconfig.nvim'},
|
||||
-- Autocompletion
|
||||
{'hrsh7th/nvim-cmp'},
|
||||
{'hrsh7th/cmp-nvim-lsp'},
|
||||
{'hrsh7th/cmp-buffer'},
|
||||
{'hrsh7th/cmp-path'},
|
||||
{'hrsh7th/cmp-cmdline'},
|
||||
-- Snips
|
||||
{'L3MON4D3/LuaSnip'},
|
||||
},
|
||||
config = function()
|
||||
local lsp = require('lsp-zero').preset({})
|
||||
local config = require 'lspconfig'
|
||||
local util = require 'lspconfig/util'
|
||||
|
||||
-- Autocompletion
|
||||
{'hrsh7th/nvim-cmp'}, -- Required
|
||||
{'hrsh7th/cmp-nvim-lsp'}, -- Required
|
||||
{'L3MON4D3/LuaSnip'}, -- Required
|
||||
},
|
||||
lsp.on_attach(function(_, bufnr)
|
||||
lsp.default_keymaps({ buffer = bufnr })
|
||||
end)
|
||||
|
||||
lsp.ensure_installed({
|
||||
-- -- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
"tsserver",
|
||||
"eslint",
|
||||
"cssls",
|
||||
"cssmodules_ls",
|
||||
"pyright",
|
||||
})
|
||||
|
||||
config.lua_ls.setup(lsp.nvim_lua_ls())
|
||||
|
||||
config.rust_analyzer.setup {}
|
||||
|
||||
config.tsserver.setup {}
|
||||
config.eslint.setup {}
|
||||
config.cssls.setup {}
|
||||
config.cssmodules_ls.setup {}
|
||||
|
||||
config.pyright.setup {}
|
||||
|
||||
local cmp = require 'cmp'
|
||||
local cmp_action = require('lsp-zero').cmp_action()
|
||||
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = "path" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer", keyword_length = 3 },
|
||||
{ name = "luasnip", keyword_length= 2 },
|
||||
},
|
||||
mapping = {
|
||||
['<CR>'] = cmp.mapping.confirm({select = false}),
|
||||
['<Tab>'] = cmp_action.tab_complete(),
|
||||
['<S-Tab>'] = cmp_action.select_prev_or_fallback(),
|
||||
-- Ctrl+Space to trigger completion menu
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
|
||||
['<C-f>'] = cmp_action.luasnip_jump_forward(),
|
||||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
||||
}
|
||||
})
|
||||
lsp.setup()
|
||||
end,
|
||||
-- keys = {
|
||||
-- { "<leader>l", "<Nop>", desc = "LSP" },
|
||||
-- },
|
||||
}
|
||||
|
|
|
@ -1,18 +1,32 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = '0.1.1',
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable "make" == 1, build = "make" },
|
||||
},
|
||||
cmd = "Telescope",
|
||||
keys = {
|
||||
{ "<leader>f", "<Nop>", desc = "Find ..." },
|
||||
{ "<leader>ff", function() require('telescope.builtin').find_files() end, desc = "Find Files" },
|
||||
{ "<leader>fg", function() require('telescope.builtin').git_files() end, desc = "Find Git only Files" },
|
||||
{ "<leader>fw", function() require('telescope.builtin').live_grep() end, desc = "Find Words" },
|
||||
{ "<leader>fc", function() require('telescope.builtin').commands() end, desc = "Find Commands" },
|
||||
{ "<leader>fk", function() require('telescope.builtin').keymaps() end, desc = "Find Commands" },
|
||||
},
|
||||
opts = {},
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = '0.1.1',
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable "make" == 1, build = "make" },
|
||||
},
|
||||
cmd = "Telescope",
|
||||
keys = {
|
||||
{ "<leader>f", "<Nop>", desc = "Find ..." },
|
||||
{ "<leader>ff", function() require('telescope.builtin').find_files() end, desc = "Find Files" },
|
||||
{ "<leader>fg", function() require('telescope.builtin').git_files() end, desc = "Find Git only Files" },
|
||||
{ "<leader>fw", function() require('telescope.builtin').live_grep() end, desc = "Find Words" },
|
||||
{ "<leader>fc", function() require('telescope.builtin').commands() end, desc = "Find Commands" },
|
||||
{ "<leader>fk", function() require('telescope.builtin').keymaps() end, desc = "Find Commands" },
|
||||
{ "<leader>fb", function() require('telescope.builtin').buffers() end, desc = "Find Commands" },
|
||||
},
|
||||
opts = {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"-L",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ return {
|
|||
opts = {
|
||||
-- "all",
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
"http",
|
||||
"json",
|
||||
"bash",
|
||||
|
@ -43,16 +44,12 @@ return {
|
|||
"markdown",
|
||||
"markdown_inline",
|
||||
"nix",
|
||||
"passwd",
|
||||
"prisma",
|
||||
"proto",
|
||||
"python",
|
||||
"regex",
|
||||
"rst",
|
||||
"rust",
|
||||
"scss",
|
||||
"sql",
|
||||
"svelte",
|
||||
"terraform",
|
||||
"toml",
|
||||
"tsx",
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
commit = "e271c28118998c93a14d189af3395812a1aa646c", -- May 22, 2023
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = {
|
||||
icons = { group = vim.g.icons_enabled and "" or "+", separator = "" },
|
||||
disable = { filetypes = { "TelescopePrompt" } },
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
setup = function(_, opts)
|
||||
require("which-key").setup(opts)
|
||||
require("keymaps").which_key_register()
|
||||
end
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue