fix lsp to and code completion

This commit is contained in:
2025-09-26 23:14:04 -05:00
parent 91fe229e59
commit 42b0e5c64d
13 changed files with 137 additions and 193 deletions

View File

@@ -11,16 +11,37 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)
-- coq used for completion
vim.g.coq_settings = {
auto_start = true,
xdg = true,
completion = {
always = false,
},
keymap = {
manual_complete = '<c-n>',
}
}
-- code completion
require('lazy').setup('plugins')
local coq = require 'coq'
require("mason").setup() -- used for automatically enabling lsp and coq
require("mason-lspconfig").setup()
-- Settings
vim.cmd('source ~/.config/nvim/settings.vim')
-- colorscheme
vim.o.termguicolors = true
vim.o.background = "dark" -- or "light" for light mode
--vim.o.background = "dark" -- or "light" for light mode
--vim.cmd("colorscheme gruvbox ")
vim.cmd("colorscheme retrobox")
--vim.cmd("colorscheme retrobox")
-- keymaps
vim.keymap.set('n', '<leader>/', ':nohlsearch<CR>')

View File

@@ -1,11 +1,19 @@
return{
"okuuva/auto-save.nvim",
version = '^1.0.0', -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release
--version = '*', -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release
cmd = "ASToggle", -- optional for lazy loading on command
execution_message = {
message = function() -- message to print on save
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
end,
dim = 0.18, -- dim the color of `message`
cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea
},
event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events
opts = {
-- your config goes here
-- or just leave it empty :)
enabled = false
enabled = false,
debug = true,
},
}

View File

@@ -0,0 +1,13 @@
return {
"metalelf0/black-metal-theme-neovim",
lazy = false,
priority = 1000,
config = function()
require("black-metal").setup({
-- optional configuration here
term_colors = true,
})
require("black-metal").load()
end,
}

View File

@@ -0,0 +1,12 @@
return {
'github/copilot.vim',
config = function()
vim.keymap.set('i', '<C-J>', 'copilot#Accept("\\<CR>")', {
expr = true,
replace_keycodes = false
})
vim.keymap.set('i', '<C-L>', '<Plug>(copilot-accept-word)')
vim.g.copilot_enabled = 'v:false'
end
}

View File

@@ -1,29 +0,0 @@
return {
"ellisonleao/gruvbox.nvim",
priority = 1000,
config = function ()
require("gruvbox").setup({
undercurl = true,
underline = true,
bold = true,
italic = {
strings = true,
comments = true,
operators = false,
folds = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "hard", -- can be "hard", "soft" or empty string
palette_overrides = {},
overrides = {},
dim_inactive = false,
transparent_mode = true,
})
end
}

View File

@@ -0,0 +1,10 @@
return {
"mason-org/mason-lspconfig.nvim",
dependencies = {
"mason-org/mason.nvim",
"neovim/nvim-lspconfig",
"ms-jpq/coq_nvim", -- Optional (auto complete)
},
condig = function()
end
}

View File

@@ -1,80 +0,0 @@
return {
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
dependencies = {
-- LSP Support
{ 'neovim/nvim-lspconfig' }, -- Required
{ 'williamboman/mason.nvim' }, -- Optional
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
-- Autocompletion
{ 'hrsh7th/nvim-cmp' }, -- Required
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
{ 'hrsh7th/cmp-buffer' }, -- Optional
{ 'hrsh7th/cmp-path' }, -- Optional
{ 'saadparwaiz1/cmp_luasnip' }, -- Optional
{ 'hrsh7th/cmp-nvim-lua' }, -- Optional
-- snippets
{ 'L3MON4D3/LuaSnip' }, -- Required
{ 'rafamadriz/friendly-snippets' }, -- Optional
},
config = function()
local lsp = require('lsp-zero')
lsp.preset('recommended')
lsp.on_attach(function(client, bufnr)
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>rr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
end)
local lspconfig = require('lspconfig')
local root_pattern = require('lspconfig.util').root_pattern
lspconfig['jedi_language_server'].setup {
root_dir = root_pattern('.git', 'setup.py')
}
lspconfig['lua_ls'].setup {
settings = {
Lua = {
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' },
},
},
},
}
local cmp = require('cmp')
local cmp_action = require('lsp-zero').cmp_action()
require('luasnip.loaders.from_vscode').lazy_load()
cmp.setup({
mapping = {
['<CR>'] = cmp.mapping.confirm({ select = false }),
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = cmp_action.luasnip_jump_backward(),
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
})
lsp.setup()
end
}

View File

@@ -1,46 +1,46 @@
return{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
config = function()
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 = {}
}
end
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
config = function()
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 = {}
}
end
}

View File

@@ -5,25 +5,22 @@ return {
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {},
config = function()
require('render-markdown').setup({
opts = {
completions = { lsp = { enabled = true } },
render_modes = true,
heading = {
width = 'block',
min_width = 81,
min_width = 80,
},
code = {
disable_background = { 'diff' },
},
indent = {
enabled = true,
skip_heading = true,
},
sign = {
enabled = true,
},
})
end
},
}

View File

@@ -1,11 +0,0 @@
return {
'github/copilot.vim',
config = function()
vim.keymap.set('i', '<C-J>', 'copilot#Accept("\\<CR>")', {
expr = true,
replace_keycodes = false
})
vim.g.copilot_no_tab_map = true
end
}

View File

@@ -0,0 +1,11 @@
return {
"folke/zen-mode.nvim",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
window = {
width = 90, -- width of the Zen window
}
}
}

View File

@@ -17,28 +17,26 @@ set showmatch
set ruler
set wrap
set showbreak=↳\ \
set textwidth=79
set hidden
set backspace=indent,eol,start
set hlsearch
set noswapfile
set mouse= "remove mouse
set clipboard=unnamedplus
"set clipboard=unnamedplus
" Rendering
set ttyfast
set laststatus=1
set t_Co=256
set background=dark
let &t_ut=''
set colorcolumn=81
hi ColorColumn ctermbg=lightgrey guibg=lightgrey
"hi ColorColumn ctermbg=lightgrey guibg=lightgrey
" Show bad whitespace in an obvious but not obnoxious color
highlight pythonSpaceError ctermbg=darkgreen guibg=darkgreen
highlight BadWhitespace ctermbg=darkgreen guibg=darkgreen
au BufNewFile,BufRead *.py,*.pyw,*.c,*.h,*.cc,*.hh,*.sh match BadWhitespace /\s\+$/
"highlight pythonSpaceError ctermbg=darkgreen guibg=darkgreen
"highlight BadWhitespace ctermbg=darkgreen guibg=darkgreen
"au BufNewFile,BufRead *.py,*.pyw,*.c,*.h,*.cc,*.hh,*.sh match BadWhitespace /\s\+$/
" File settings
au FileType *
@@ -52,14 +50,8 @@ au FileType *
"Python Specific Config
au FileType python
\ set fileformat=unix
\ tabstop=4
\ softtabstop=4
\ shiftwidth=4
\ encoding=utf-8
au FileType markdown,tex
\ set spell spelllang=en_us
\ tabstop=4
\ softtabstop=4
\ shiftwidth=4
\ set spell spelllang=en_us