Compare commits
2 Commits
b177e9a731
...
1aedb8a474
Author | SHA1 | Date | |
---|---|---|---|
1aedb8a474 | |||
0050526934 |
@ -1,53 +0,0 @@
|
||||
local cmp_nvim_lsp = require 'cmp_nvim_lsp'
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities = cmp_nvim_lsp.default_capabilities(capabilities)
|
||||
|
||||
local function has_formatter(ft)
|
||||
local sources = require 'null-ls.sources'
|
||||
local available = sources.get_available(ft, 'NULL_LS_FORMATTING')
|
||||
return #available > 0
|
||||
end
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opt = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gI', '<cmd>lua vim.lsp.buf.implementation()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gr', '<cmd>TroubleToggle lsp_references<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gl', '<cmd>lua vim.diagnostic.open_float()<CR>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lf', '<cmd>lua vim.lsp.buf.format { async = true }<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>li', '<cmd>LspInfo<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lI', '<cmd>LspInstallInfo<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lj', '<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lk', '<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>ls', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lq', '<cmd>lua vim.diagnostic.setloclist()<CR>', opt)
|
||||
keymap(bufnr, 'n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opt)
|
||||
end
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
--[[ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ]]
|
||||
lsp_keymaps(bufnr)
|
||||
local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype')
|
||||
local nls = require 'plugins.null-ls'
|
||||
|
||||
local enable = false
|
||||
if has_formatter(ft) then
|
||||
enable = client.name == 'null-ls'
|
||||
else
|
||||
enable = not (client.name == 'null-ls')
|
||||
end
|
||||
|
||||
client.server_capabilities.documentFormattingProvider = enable
|
||||
end
|
||||
require('rust-tools').setup {
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
standalone = false,
|
||||
},
|
||||
}
|
2
init.lua
2
init.lua
@ -22,7 +22,7 @@ vim.api.nvim_create_autocmd('User', {
|
||||
require 'config.mappings'
|
||||
require 'config.autocmd'
|
||||
require 'nvim-treesitter'
|
||||
require 'noice'
|
||||
require 'dressing'
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -35,10 +35,10 @@ keymap('v', '<leader>r', ':s///gI<Left><Left><Left><Left>', { noremap = true })
|
||||
keymap('n', 'D', '"_d', { noremap = true })
|
||||
|
||||
keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opt)
|
||||
keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opt)
|
||||
keymap('n', 'gd', '<cmd>TroubleToggle lsp_definitions<CR>', opt)
|
||||
keymap('n', 'gr', '<cmd>TroubleToggle lsp_references<CR>', opt)
|
||||
keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.hover()<CR>', opt)
|
||||
keymap('n', 'gI', '<cmd>lua vim.lsp.buf.implementation()<CR>', opt)
|
||||
keymap('n', 'gI', '<cmd>TroubleToggle lsp_implementations<CR>', opt)
|
||||
keymap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<CR>', opt)
|
||||
keymap('n', '<leader>lf', '<cmd>lua vim.lsp.buf.format { async = true }<cr>', opt)
|
||||
keymap('n', '<leader>li', '<cmd>LspInfo<cr>', opt)
|
||||
|
@ -18,6 +18,7 @@ opt.clipboard:prepend { 'unnamedplus' }
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.sessionoptions = 'folds'
|
||||
opt.foldlevelstart = 1
|
||||
opt.number = true
|
||||
opt.shortmess:append('I', 'W', 's')
|
||||
opt.iskeyword:prepend { '-' }
|
||||
|
@ -93,6 +93,7 @@ return {
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'neorg' },
|
||||
{ name = 'snippy' },
|
||||
{ name = 'path' },
|
||||
{ name = 'buffer' },
|
||||
|
@ -1,8 +1,14 @@
|
||||
return {
|
||||
{
|
||||
'stevearc/dressing.nvim',
|
||||
opts = {},
|
||||
-- lazy = false,
|
||||
},
|
||||
'MunifTanjim/nui.nvim',
|
||||
'folke/which-key.nvim',
|
||||
'nvim-lua/plenary.nvim',
|
||||
-- 'mfussenegger/nvim-jdtls',
|
||||
-- 'simrat39/rust-tools.nvim',
|
||||
'simrat39/rust-tools.nvim',
|
||||
{ 'rush-rs/tree-sitter-asm', ft = 'asm' },
|
||||
{ 'jghauser/mkdir.nvim', lazy = false },
|
||||
{
|
||||
@ -345,13 +351,18 @@ return {
|
||||
config = function()
|
||||
require("neorg").setup {
|
||||
load = {
|
||||
["core.integrations.treesitter"] = {},
|
||||
["core.defaults"] = {}, -- Loads default behaviour
|
||||
["core.concealer"] = {}, -- Adds pretty icons to your documents
|
||||
["core.export"] = {},
|
||||
["core.ui"] = {},
|
||||
["core.completion"] = { config = { engine = "nvim-cmp" } },
|
||||
["core.dirman"] = { -- Manages Neorg workspaces
|
||||
config = {
|
||||
workspaces = {
|
||||
notes = "~/notes",
|
||||
},
|
||||
default_workspace = "notes",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -104,6 +104,15 @@ function M.config()
|
||||
-- vim.cmd "command! -buffer JdtJshell lua require('jdtls').jshell()"
|
||||
goto continue
|
||||
end
|
||||
if server == 'rust_analyzer' then
|
||||
require('rust-tools').setup {
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
standalone = false,
|
||||
},
|
||||
}
|
||||
goto continue
|
||||
end
|
||||
lspconfig[server].setup(opts)
|
||||
::continue::
|
||||
end
|
||||
|
@ -1,31 +0,0 @@
|
||||
return {
|
||||
"folke/noice.nvim",
|
||||
-- event = "VeryLazy",
|
||||
opts = {
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
-- signature = {
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- hover = {
|
||||
-- enabled = false,
|
||||
-- },
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
}
|
||||
}
|
@ -37,10 +37,10 @@ return {
|
||||
},
|
||||
indent_lines = true, -- add an indent guide below the fold icons
|
||||
auto_open = false, -- automatically open the list when you have diagnostics
|
||||
auto_close = false, -- automatically close the list when you have no diagnostics
|
||||
auto_close = true, -- automatically close the list when you have no diagnostics
|
||||
auto_preview = false, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
||||
auto_fold = false, -- automatically fold a file trouble list at creation
|
||||
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
|
||||
auto_jump = {}, -- for the given modes, automatically jump if there is only a single result
|
||||
signs = {
|
||||
-- icons / text used for a diagnostic
|
||||
error = "",
|
||||
|
Loading…
Reference in New Issue
Block a user