fix lsp to and code completion
This commit is contained in:
@@ -11,16 +11,37 @@ if not vim.loop.fs_stat(lazypath) then
|
|||||||
end
|
end
|
||||||
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
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')
|
require('lazy').setup('plugins')
|
||||||
|
|
||||||
|
local coq = require 'coq'
|
||||||
|
require("mason").setup() -- used for automatically enabling lsp and coq
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Settings
|
-- Settings
|
||||||
vim.cmd('source ~/.config/nvim/settings.vim')
|
vim.cmd('source ~/.config/nvim/settings.vim')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- colorscheme
|
-- colorscheme
|
||||||
vim.o.termguicolors = true
|
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 gruvbox ")
|
||||||
vim.cmd("colorscheme retrobox")
|
--vim.cmd("colorscheme retrobox")
|
||||||
|
|
||||||
-- keymaps
|
-- keymaps
|
||||||
vim.keymap.set('n', '<leader>/', ':nohlsearch<CR>')
|
vim.keymap.set('n', '<leader>/', ':nohlsearch<CR>')
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
return{
|
return{
|
||||||
"okuuva/auto-save.nvim",
|
"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
|
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
|
event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events
|
||||||
opts = {
|
opts = {
|
||||||
-- your config goes here
|
-- your config goes here
|
||||||
-- or just leave it empty :)
|
-- 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
|
|
||||||
}
|
|
||||||
@@ -1,46 +1,46 @@
|
|||||||
return{
|
return{
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
|
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
|
||||||
config = function()
|
config = function()
|
||||||
require('lualine').setup {
|
require('lualine').setup {
|
||||||
options = {
|
options = {
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
theme = 'auto',
|
theme = 'auto',
|
||||||
component_separators = { left = '', right = ''},
|
component_separators = { left = '', right = ''},
|
||||||
section_separators = { left = '', right = ''},
|
section_separators = { left = '', right = ''},
|
||||||
disabled_filetypes = {
|
disabled_filetypes = {
|
||||||
statusline = {},
|
statusline = {},
|
||||||
winbar = {},
|
winbar = {},
|
||||||
},
|
},
|
||||||
ignore_focus = {},
|
ignore_focus = {},
|
||||||
always_divide_middle = true,
|
always_divide_middle = true,
|
||||||
globalstatus = false,
|
globalstatus = false,
|
||||||
refresh = {
|
refresh = {
|
||||||
statusline = 1000,
|
statusline = 1000,
|
||||||
tabline = 1000,
|
tabline = 1000,
|
||||||
winbar = 1000,
|
winbar = 1000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
lualine_a = {'mode'},
|
lualine_a = {'mode'},
|
||||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||||
lualine_c = {'filename'},
|
lualine_c = {'filename'},
|
||||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||||
lualine_y = {'progress'},
|
lualine_y = {'progress'},
|
||||||
lualine_z = {'location'}
|
lualine_z = {'location'}
|
||||||
},
|
},
|
||||||
inactive_sections = {
|
inactive_sections = {
|
||||||
lualine_a = {},
|
lualine_a = {},
|
||||||
lualine_b = {},
|
lualine_b = {},
|
||||||
lualine_c = {'filename'},
|
lualine_c = {'filename'},
|
||||||
lualine_x = {'location'},
|
lualine_x = {'location'},
|
||||||
lualine_y = {},
|
lualine_y = {},
|
||||||
lualine_z = {}
|
lualine_z = {}
|
||||||
},
|
},
|
||||||
tabline = {},
|
tabline = {},
|
||||||
winbar = {},
|
winbar = {},
|
||||||
inactive_winbar = {},
|
inactive_winbar = {},
|
||||||
extensions = {}
|
extensions = {}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,25 +5,22 @@ return {
|
|||||||
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
|
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
|
||||||
---@module 'render-markdown'
|
---@module 'render-markdown'
|
||||||
---@type render.md.UserConfig
|
---@type render.md.UserConfig
|
||||||
opts = {},
|
opts = {
|
||||||
|
completions = { lsp = { enabled = true } },
|
||||||
config = function()
|
|
||||||
require('render-markdown').setup({
|
|
||||||
render_modes = true,
|
render_modes = true,
|
||||||
heading = {
|
heading = {
|
||||||
width = 'block',
|
width = 'block',
|
||||||
min_width = 81,
|
min_width = 80,
|
||||||
},
|
},
|
||||||
|
code = {
|
||||||
indent = {
|
disable_background = { 'diff' },
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
skip_heading = true,
|
skip_heading = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
sign = {
|
sign = {
|
||||||
enabled = true,
|
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 ruler
|
||||||
set wrap
|
set wrap
|
||||||
set showbreak=↳\ \
|
set showbreak=↳\ \
|
||||||
set textwidth=79
|
|
||||||
set hidden
|
set hidden
|
||||||
set backspace=indent,eol,start
|
set backspace=indent,eol,start
|
||||||
set hlsearch
|
set hlsearch
|
||||||
set noswapfile
|
set noswapfile
|
||||||
set mouse= "remove mouse
|
set mouse= "remove mouse
|
||||||
set clipboard=unnamedplus
|
"set clipboard=unnamedplus
|
||||||
|
|
||||||
" Rendering
|
" Rendering
|
||||||
set ttyfast
|
set ttyfast
|
||||||
set laststatus=1
|
set laststatus=1
|
||||||
set t_Co=256
|
set t_Co=256
|
||||||
set background=dark
|
|
||||||
let &t_ut=''
|
let &t_ut=''
|
||||||
|
|
||||||
set colorcolumn=81
|
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
|
" Show bad whitespace in an obvious but not obnoxious color
|
||||||
highlight pythonSpaceError ctermbg=darkgreen guibg=darkgreen
|
"highlight pythonSpaceError ctermbg=darkgreen guibg=darkgreen
|
||||||
highlight BadWhitespace ctermbg=darkgreen guibg=darkgreen
|
"highlight BadWhitespace ctermbg=darkgreen guibg=darkgreen
|
||||||
au BufNewFile,BufRead *.py,*.pyw,*.c,*.h,*.cc,*.hh,*.sh match BadWhitespace /\s\+$/
|
"au BufNewFile,BufRead *.py,*.pyw,*.c,*.h,*.cc,*.hh,*.sh match BadWhitespace /\s\+$/
|
||||||
|
|
||||||
" File settings
|
" File settings
|
||||||
au FileType *
|
au FileType *
|
||||||
@@ -52,14 +50,8 @@ au FileType *
|
|||||||
"Python Specific Config
|
"Python Specific Config
|
||||||
au FileType python
|
au FileType python
|
||||||
\ set fileformat=unix
|
\ set fileformat=unix
|
||||||
\ tabstop=4
|
|
||||||
\ softtabstop=4
|
|
||||||
\ shiftwidth=4
|
|
||||||
\ encoding=utf-8
|
\ encoding=utf-8
|
||||||
|
|
||||||
au FileType markdown,tex
|
au FileType markdown,tex
|
||||||
\ set spell spelllang=en_us
|
\ set spell spelllang=en_us
|
||||||
\ tabstop=4
|
|
||||||
\ softtabstop=4
|
|
||||||
\ shiftwidth=4
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user