Skip to content

Commit

Permalink
Update release new version of lsp/mason, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
ismayeelisme committed Apr 3, 2024
1 parent 778d940 commit d2cfe1f
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 47 deletions.
1 change: 1 addition & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require("config.init")
require("keymap.key")
vim.cmd('set number')
vim.keymap.set('v', '<Leader>1f', vim.lsp.buf.format, bufopts)
30 changes: 30 additions & 0 deletions lua/config/cmp_config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
{ name = 'codeium' },
}),
formatting = {
format = require('lspkind').cmp_format({
mode = "symbol",
maxwidth = 50,
ellipsis_char = '...',
symbol_map = { Codeium = "", },
}),
}
})
27 changes: 27 additions & 0 deletions lua/config/lsp_config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require("mason").setup({})
require("mason-lspconfig").setup({
ensured_install = {
"lua_ls", "pyright",
"vimls",
},
})
local on_attach = function(_, _)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, {})
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, {})

vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, {})
vim.keymap.set('n', 'gr', vim.lsp.buf.references, {})
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
end

local capabilities = require("cmp_nvim_lsp").default_capabilities()

require("lspconfig").lua_ls.setup({
on_attach = on_attach,
capabilities = capabilities,
})
require("lspconfig").pyright.setup({
on_attach = on_attach,
capabilities = capabilities,
})
40 changes: 40 additions & 0 deletions lua/config/lualine.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require('lualine').setup({
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
})
2 changes: 2 additions & 0 deletions lua/config/nvim_tree.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require("nvim-tree").setup()

3 changes: 3 additions & 0 deletions lua/config/snippets.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
33 changes: 33 additions & 0 deletions lua/config/treesitter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require('nvim-treesitter.configs').setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "python" },

-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,

-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,

-- List of parsers to ignore installing (or "all")
ignore_install = { "javascript" },

---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!

highlight = {
enable = true,

-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
4 changes: 2 additions & 2 deletions lua/keymap/key.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local map = vim.keymap.set
map("n", "<leader>ff", "<cmd>Telescope fd<CR>")
map("n", "<leader>th", "<cmd>Telescope colorscheme<CR>")
map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "Nvimtree Toggle window" })
map("n", "<C-h>", "<cmd>NvimTreeFocus<CR>", { desc = "Nvimtree Focus window" })
map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "NvimTreeToggle window" })
map("n", "<C-h>", "<cmd>NvimTreeFocus<CR>", { desc = "NvimTreeFocus window" })

2 changes: 0 additions & 2 deletions lua/plugins/custom.lua

This file was deleted.

85 changes: 42 additions & 43 deletions lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ return {
{
"folke/which-key.nvim",
},
{
{
"folke/neoconf.nvim",
cmd = "Neoconf",
},
Expand All @@ -13,67 +13,49 @@ return {
},
-- lsp config, nvim cmp
{
"neovim/nvim-lspconfig",
lazy = false,
config = function()
end,
opts = {
ensure_install = {
"python", "html",
"bash", "css",
},
},

"neovim/nvim-lspconfig",
},
{
"hrsh7th/cmp-nvim-lsp",
opts = {
ensure_install = {
"pyright"
},
},
"hrsh7th/nvim-cmp",
config = function()
return require("config.cmp_config")
end
},
{
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-nvim-lsp",
},
-- and snippet
{
"hrsh7th/cmp-path",
"williamboman/mason-lspconfig.nvim",
config = function()
return require("config.lsp_config")
end
},
{
"hrsh7th/nvim-cmp",
"williamboman/mason.nvim",
},
-- mason nvim
-- completion ie snippet
{
"williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
opts = {
ensured_install = {
"lua-language-server", "pyright",
},
},
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
"saadparwaiz1/cmp_luasnip",
},
--treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"lua", "vim",
"vimdoc", "pymanifest",
"python", "bash"
},
},
config = function()
return require("config.treesitter")
end
},
-- telescope
{
"nvim-telescope/telescope.nvim",
},
{
"nvim-tree/nvim-tree.lua",
lazy = false,
config = function()
require("nvim-tree").setup({
})
end,
return require("config.nvim_tree")
end
},
{
"catppuccin/nvim",
Expand All @@ -84,9 +66,26 @@ return {
end
},
{
"vim-airline/vim-airline",
"nvim-lualine/lualine.nvim",
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
vim.cmd('AirlineTheme catppuccin')
end
return require("config.lualine")
end,
},
{
"Exafunction/codeium.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"hrsh7th/nvim-cmp",
},
config = function()
require("codeium").setup({
})
end
},
{
"onsails/lspkind.nvim",
},
{
},
}

0 comments on commit d2cfe1f

Please sign in to comment.