fix lsp to and code completion
This commit is contained in:
@@ -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>')
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
13
.config/nvim/lua/plugins/colorscheme.lua
Normal file
13
.config/nvim/lua/plugins/colorscheme.lua
Normal 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,
|
||||
}
|
||||
12
.config/nvim/lua/plugins/copilot.lua
Normal file
12
.config/nvim/lua/plugins/copilot.lua
Normal 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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
10
.config/nvim/lua/plugins/lsp-config.lua
Normal file
10
.config/nvim/lua/plugins/lsp-config.lua
Normal 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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
11
.config/nvim/lua/plugins/zen-mode.lua
Normal file
11
.config/nvim/lua/plugins/zen-mode.lua
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user