mirror of
https://github.com/GRFreire/dotfiles.git
synced 2026-03-06 11:09:41 +00:00
upadte neovim config
This commit is contained in:
parent
b84e308a9e
commit
f6692c95f3
@ -1,10 +1,11 @@
|
|||||||
function SetColor(color)
|
function setTheme(theme)
|
||||||
color = color or "oxocarbon"
|
if theme == 'bamboo' then
|
||||||
vim.cmd.colorscheme(color)
|
require('bamboo').setup({});
|
||||||
|
require('bamboo').load();
|
||||||
-- Transparent background
|
elseif theme == 'sonokai' then
|
||||||
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
vim.cmd 'colorscheme sonokai';
|
||||||
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
vim.opt.termguicolors = false;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
SetColor()
|
setTheme('sonokai')
|
||||||
|
|||||||
@ -1,75 +1,35 @@
|
|||||||
local lsp = require("lsp-zero")
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup({})
|
||||||
lsp.preset("recommended")
|
|
||||||
|
|
||||||
require("mason").setup({})
|
|
||||||
require("mason-lspconfig").setup({
|
|
||||||
ensure_installed = {'lua_ls', 'clangd', 'eslint', 'tsserver'},
|
|
||||||
handlers = { lsp.default_setup }
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Fix Undefined global 'vim'
|
|
||||||
lsp.configure('lua_ls', {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { 'vim' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
local cmp_select = {behavior = cmp.SelectBehavior.Select}
|
|
||||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- disable completion with tab
|
|
||||||
-- this helps with copilot setup
|
|
||||||
cmp_mappings['<Tab>'] = nil
|
|
||||||
cmp_mappings['<S-Tab>'] = nil
|
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
mapping = cmp_mappings
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
},
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
-- You need Neovim v0.10 to use vim.snippet
|
||||||
|
vim.snippet.expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({}),
|
||||||
})
|
})
|
||||||
|
|
||||||
lsp.set_preferences({
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
suggest_lsp_servers = false,
|
desc = 'LSP actions',
|
||||||
sign_icons = {
|
callback = function(event)
|
||||||
error = 'E',
|
local opts = { buffer = event.buf }
|
||||||
warn = 'W',
|
|
||||||
hint = 'H',
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||||
info = 'I'
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
}
|
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)
|
||||||
})
|
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, opts)
|
||||||
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
|
||||||
lsp.on_attach(function(client, bufnr)
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
|
||||||
local opts = {buffer = bufnr, remap = false}
|
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, opts)
|
||||||
|
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
|
||||||
if client.name == "eslint" then
|
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)
|
||||||
vim.cmd.LspStop('eslint')
|
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
|
||||||
return
|
end,
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
|
||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, opts)
|
|
||||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
|
|
||||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)
|
|
||||||
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
|
|
||||||
end)
|
|
||||||
|
|
||||||
lsp.setup()
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
|
||||||
virtual_text = true,
|
|
||||||
})
|
})
|
||||||
|
|||||||
@ -6,64 +6,58 @@
|
|||||||
vim.cmd [[packadd packer.nvim]]
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
|
||||||
return require('packer').startup(function(use)
|
return require('packer').startup(function(use)
|
||||||
-- Packer package manager itself
|
-- Packer package manager itself
|
||||||
use 'wbthomason/packer.nvim'
|
use 'wbthomason/packer.nvim'
|
||||||
|
|
||||||
-- Telescope fuzzyfinder
|
-- Telescope fuzzyfinder
|
||||||
use {
|
use {
|
||||||
'nvim-telescope/telescope.nvim', tag = '0.1.5',
|
'nvim-telescope/telescope.nvim', tag = '0.1.5',
|
||||||
-- or , branch = '0.1.x',
|
-- or , branch = '0.1.x',
|
||||||
requires = { { 'nvim-lua/plenary.nvim' } }
|
requires = { { 'nvim-lua/plenary.nvim' } }
|
||||||
}
|
}
|
||||||
|
|
||||||
use({
|
use { 'ribru17/bamboo.nvim' }
|
||||||
"nyoom-engineering/oxocarbon.nvim",
|
use { 'sainnhe/sonokai' }
|
||||||
as = "oxocarbon",
|
|
||||||
config = function ()
|
|
||||||
vim.opt.background = "dark"
|
|
||||||
vim.cmd('colorscheme oxocarbon')
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Tree-sitter - AST capabilities for neovim
|
-- Tree-sitter - AST capabilities for neovim
|
||||||
use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
|
use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
|
||||||
use('nvim-treesitter/playground')
|
use('nvim-treesitter/playground')
|
||||||
|
|
||||||
-- Harpoon - easily go between files
|
-- Harpoon - easily go between files
|
||||||
use('theprimeagen/harpoon')
|
use('theprimeagen/harpoon')
|
||||||
|
|
||||||
-- Undotree - undo history visualizer
|
-- Undotree - undo history visualizer
|
||||||
use('mbbill/undotree')
|
use('mbbill/undotree')
|
||||||
|
|
||||||
-- Vim fugitive - git wrapper
|
-- Vim fugitive - git wrapper
|
||||||
use('tpope/vim-fugitive')
|
use('tpope/vim-fugitive')
|
||||||
|
|
||||||
-- Statusline
|
-- Statusline
|
||||||
use {
|
use {
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
|
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
use {
|
use {
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
requires = {
|
requires = {
|
||||||
-- LSP Support
|
-- LSP Support
|
||||||
{ 'neovim/nvim-lspconfig' },
|
{ 'neovim/nvim-lspconfig' },
|
||||||
{ 'williamboman/mason.nvim' },
|
{ 'williamboman/mason.nvim' },
|
||||||
{ 'williamboman/mason-lspconfig.nvim' },
|
{ 'williamboman/mason-lspconfig.nvim' },
|
||||||
|
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
{ 'hrsh7th/nvim-cmp' },
|
{ 'hrsh7th/nvim-cmp' },
|
||||||
{ 'hrsh7th/cmp-buffer' },
|
{ 'hrsh7th/cmp-buffer' },
|
||||||
{ 'hrsh7th/cmp-path' },
|
{ 'hrsh7th/cmp-path' },
|
||||||
{ 'saadparwaiz1/cmp_luasnip' },
|
{ 'saadparwaiz1/cmp_luasnip' },
|
||||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||||
{ 'hrsh7th/cmp-nvim-lua' },
|
{ 'hrsh7th/cmp-nvim-lua' },
|
||||||
|
|
||||||
-- Snippets
|
-- Snippets
|
||||||
{ 'L3MON4D3/LuaSnip' },
|
{ 'L3MON4D3/LuaSnip' },
|
||||||
{ 'rafamadriz/friendly-snippets' },
|
{ 'rafamadriz/friendly-snippets' },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user