Use null-ls and mason
This commit is contained in:
parent
a4f9ba5719
commit
f94ba6234b
@ -1,11 +1,11 @@
|
||||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
-- generic mappings
|
||||
map('v', '<', '<gv', {noremap = true})
|
||||
map('v', '>', '>gv', {noremap = true})
|
||||
map('n', 'Y', 'y$', {noremap = true})
|
||||
map('n', 'n', 'nzzzv', {noremap = true})
|
||||
map('n', 'N', 'Nzzzv', {noremap = true})
|
||||
map('v', '<', '<gv', { noremap = true })
|
||||
map('v', '>', '>gv', { noremap = true })
|
||||
map('n', 'Y', 'y$', { noremap = true })
|
||||
map('n', 'n', 'nzzzv', { noremap = true })
|
||||
map('n', 'N', 'Nzzzv', { noremap = true })
|
||||
|
||||
-- Shortcutting split navigation
|
||||
map('', '<A-h>', '<C-w>h', {})
|
||||
@ -23,38 +23,41 @@ map('', '<M-->', '<C-w>-', {})
|
||||
map('', '<A-T>', '<C-w>T', {})
|
||||
|
||||
-- undo to the last , . or !
|
||||
map('i', ',', ',<c-g>u', {noremap = true})
|
||||
map('i', '.', '.<c-g>u', {noremap = true})
|
||||
map('i', '!', '!<c-g>u', {noremap = true})
|
||||
map('i', '?', '?<c-g>u', {noremap = true})
|
||||
map('i', ',', ',<c-g>u', { noremap = true })
|
||||
map('i', '.', '.<c-g>u', { noremap = true })
|
||||
map('i', '!', '!<c-g>u', { noremap = true })
|
||||
map('i', '?', '?<c-g>u', { noremap = true })
|
||||
|
||||
-- plugin mappings
|
||||
-- gitsigns
|
||||
map('', '<leader>gs', ':Gitsigns toggle_signs<cr>', {silent = true})
|
||||
map('', '<leader>gs', ':Gitsigns toggle_signs<cr>', { silent = true })
|
||||
-- lsp stuff
|
||||
map('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>',
|
||||
{silent = false, noremap = true})
|
||||
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', {noremap = true})
|
||||
{ silent = false, noremap = true })
|
||||
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', { noremap = true })
|
||||
map('', '<leader>K', '<cmd>lua vim.diagnostic.open_float()<CR>',
|
||||
{noremap = true})
|
||||
{ noremap = true })
|
||||
map('', '<leader>qf',
|
||||
'<cmd>lua vim.diagnostic.setqflist({open = false})<cr><cmd>Telescope quickfix<cr>',
|
||||
{silent = true})
|
||||
{ silent = true })
|
||||
|
||||
-- toggle tagbar
|
||||
map('', '<leader>tt', ':TagbarToggle<cr>', {silent = true})
|
||||
map('', '<leader>tt', ':TagbarToggle<cr>', { silent = true })
|
||||
|
||||
-- toggle NvimTree
|
||||
map('', '<C-n>', ':NvimTreeToggle<cr>', {silent = true})
|
||||
map('', '<C-n>', ':NvimTreeToggle<cr>', { silent = true })
|
||||
|
||||
-- toggle formatter
|
||||
map('', '<leader>fm', ':Neoformat<cr>', {silent = true})
|
||||
map('', '<leader>fm', ':lua vim.lsp.buf.formatting()<cr>', { silent = true })
|
||||
|
||||
-- toggle Hop
|
||||
map('', '<leader>b', ':HopWordBC<cr>', {silent = true})
|
||||
map('', '<leader>w', ':HopWordAC<cr>', {silent = true})
|
||||
map('', '<leader>l', ':HopWordCurrentLine<cr>', {silent = true})
|
||||
map('', '<leader>b', ':HopWordBC<cr>', { silent = true })
|
||||
map('', '<leader>w', ':HopWordAC<cr>', { silent = true })
|
||||
map('', '<leader>l', ':HopWordCurrentLine<cr>', { silent = true })
|
||||
|
||||
-- telescope stuff
|
||||
map('', '<leader>fd', ':Telescope fd<cr>', {silent = true})
|
||||
map('', '<leader>tb', ':Telescope buffers<cr>', {silent = true})
|
||||
map('', '<leader>fd', ':Telescope fd<cr>',
|
||||
|
||||
|
||||
{ silent = true })
|
||||
map('', '<leader>tb', ':Telescope buffers<cr>', { silent = true })
|
||||
|
@ -1,5 +1,5 @@
|
||||
return require('packer').startup(function(use)
|
||||
use {'wbthomason/packer.nvim'}
|
||||
use { 'wbthomason/packer.nvim' }
|
||||
|
||||
-- core UI
|
||||
use({
|
||||
@ -11,10 +11,10 @@ return require('packer').startup(function(use)
|
||||
vim.cmd('colorscheme everforest')
|
||||
end
|
||||
})
|
||||
use {'kyazdani42/nvim-web-devicons'}
|
||||
use { 'kyazdani42/nvim-web-devicons' }
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
after = {'nvim-web-devicons'},
|
||||
after = { 'nvim-web-devicons' },
|
||||
config = function() require 'plugins.statusline' end
|
||||
}
|
||||
-- use {
|
||||
@ -26,16 +26,16 @@ return require('packer').startup(function(use)
|
||||
-- }
|
||||
|
||||
-- lsp stuff
|
||||
use {'neovim/nvim-lspconfig', event = 'UIEnter'}
|
||||
use {
|
||||
'williamboman/nvim-lsp-installer',
|
||||
after = 'nvim-lspconfig',
|
||||
config = function() require 'plugins.lspinstall' end
|
||||
'neovim/nvim-lspconfig',
|
||||
after = "mason-lspconfig.nvim",
|
||||
config = function() require 'plugins.lsp' end
|
||||
}
|
||||
use {'hrsh7th/cmp-nvim-lsp', after = 'nvim-lsp-installer'}
|
||||
use { 'williamboman/mason-lspconfig.nvim', after = 'mason.nvim' }
|
||||
use { 'hrsh7th/cmp-nvim-lsp', after = 'nvim-lspconfig' }
|
||||
use {
|
||||
'ray-x/lsp_signature.nvim',
|
||||
after = 'nvim-lsp-installer',
|
||||
after = 'nvim-lspconfig',
|
||||
config = function() require 'plugins.lsp-signature' end
|
||||
}
|
||||
|
||||
@ -48,42 +48,50 @@ return require('packer').startup(function(use)
|
||||
}
|
||||
|
||||
-- completer
|
||||
use {'L3MON4D3/LuaSnip', event = 'UIEnter'}
|
||||
use { 'L3MON4D3/LuaSnip', event = 'UIEnter' }
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
after = {'LuaSnip', 'cmp-nvim-lsp', 'nvim-treesitter'},
|
||||
after = { 'LuaSnip', 'cmp-nvim-lsp', 'nvim-treesitter' },
|
||||
config = function() require 'plugins.cmp' end,
|
||||
requires = {
|
||||
-- local
|
||||
{'hrsh7th/cmp-cmdline', after = 'nvim-cmp'},
|
||||
{'hrsh7th/cmp-buffer', after = 'nvim-cmp'},
|
||||
{'hrsh7th/cmp-path', after = 'nvim-cmp'}, {
|
||||
{ 'hrsh7th/cmp-cmdline', after = 'nvim-cmp' },
|
||||
{ 'hrsh7th/cmp-buffer', after = 'nvim-cmp' },
|
||||
{ 'hrsh7th/cmp-path', after = 'nvim-cmp' }, {
|
||||
'petertriho/cmp-git',
|
||||
after = 'nvim-cmp',
|
||||
config = function() require("cmp_git").setup() end
|
||||
}, {'delphinus/cmp-ctags', after = 'nvim-cmp'}, -- end
|
||||
}, { 'delphinus/cmp-ctags', after = 'nvim-cmp' }, -- end
|
||||
-- lsp
|
||||
{'hrsh7th/cmp-nvim-lsp-document-symbol', after = 'nvim-cmp'}, -- TS
|
||||
{'ray-x/cmp-treesitter', after = 'nvim-cmp'}, -- end
|
||||
{ 'hrsh7th/cmp-nvim-lsp-document-symbol', after = 'nvim-cmp' }, -- TS
|
||||
{ 'ray-x/cmp-treesitter', after = 'nvim-cmp' }, -- end
|
||||
-- Snip
|
||||
{'saadparwaiz1/cmp_luasnip', after = {'nvim-cmp', 'LuaSnip'}}
|
||||
{ 'saadparwaiz1/cmp_luasnip', after = { 'nvim-cmp', 'LuaSnip' } }
|
||||
}
|
||||
}
|
||||
|
||||
-- formating and editing
|
||||
use { "williamboman/mason.nvim", event = "UIEnter" }
|
||||
use {
|
||||
'windwp/nvim-autopairs',
|
||||
after = 'nvim-cmp',
|
||||
config = function() require('plugins.nvim-autopairs') end
|
||||
}
|
||||
use {'sbdchd/neoformat', cmd = 'Neoformat'}
|
||||
use {
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
config = function()
|
||||
require('plugins.null-ls')
|
||||
end,
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
event = "CmdlineEnter"
|
||||
}
|
||||
use {
|
||||
'mattn/emmet-vim',
|
||||
ft = {'html', 'htmldjango', 'css', 'markdown'},
|
||||
ft = { 'html', 'htmldjango', 'css', 'markdown' },
|
||||
setup = function() require 'plugins.emmet' end
|
||||
}
|
||||
use {'machakann/vim-sandwich', event = 'UIEnter'}
|
||||
use { 'machakann/vim-sandwich', event = 'UIEnter' }
|
||||
|
||||
use {
|
||||
'numToStr/Comment.nvim',
|
||||
@ -106,34 +114,34 @@ return require('packer').startup(function(use)
|
||||
use {
|
||||
'abecodes/tabout.nvim',
|
||||
config = function() require('tabout').setup {} end,
|
||||
after = {'nvim-treesitter', 'nvim-autopairs', 'nvim-cmp'} -- if a completion plugin is using tabs load it before
|
||||
after = { 'nvim-treesitter', 'nvim-autopairs', 'nvim-cmp' } -- if a completion plugin is using tabs load it before
|
||||
}
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
event = 'UIEnter',
|
||||
requires = {'nvim-lua/plenary.nvim'},
|
||||
requires = { 'nvim-lua/plenary.nvim' },
|
||||
config = function() require 'plugins.telescope' end
|
||||
}
|
||||
use {'preservim/tagbar', cmd = 'TagbarToggle'}
|
||||
use { 'preservim/tagbar', cmd = 'TagbarToggle' }
|
||||
use {
|
||||
'phaazon/hop.nvim',
|
||||
event = 'UIEnter',
|
||||
as = 'hop',
|
||||
config = function()
|
||||
require'hop'.setup {keys = 'etovxqpdygfblzhckisuran'}
|
||||
require 'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
|
||||
end
|
||||
}
|
||||
|
||||
-- eye-candy
|
||||
use {
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
after = {'nvim-treesitter'},
|
||||
after = { 'nvim-treesitter' },
|
||||
config = function() require 'plugins.indent-blankline' end
|
||||
}
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
event = 'UIEnter',
|
||||
requires = {'nvim-lua/plenary.nvim'},
|
||||
requires = { 'nvim-lua/plenary.nvim' },
|
||||
config = function() require 'plugins.gitsigns' end
|
||||
}
|
||||
use {
|
||||
@ -145,7 +153,7 @@ return require('packer').startup(function(use)
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
after = 'nvim-treesitter',
|
||||
config = function()
|
||||
require'treesitter-context'.setup {
|
||||
require 'treesitter-context'.setup {
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
|
||||
@ -174,9 +182,9 @@ return require('packer').startup(function(use)
|
||||
}
|
||||
|
||||
-- integrations
|
||||
use {'tpope/vim-fugitive', cmd = 'G'}
|
||||
use { 'tpope/vim-fugitive', cmd = 'G' }
|
||||
|
||||
-- fixes and misc. stuff
|
||||
use {'antoinemadec/FixCursorHold.nvim', event = 'UIEnter'}
|
||||
use { 'antoinemadec/FixCursorHold.nvim', event = 'UIEnter' }
|
||||
end)
|
||||
-- vim:set shiftwidth=4 tabstop=4:
|
||||
|
15
lua/plugins/lsp.lua
Normal file
15
lua/plugins/lsp.lua
Normal file
@ -0,0 +1,15 @@
|
||||
require("mason").setup {ui = {icons = {package_installed = "✓"}}}
|
||||
require("mason-lspconfig").setup {ensure_installed = {"sumneko_lua"}}
|
||||
-- Dynamic loading of lsp servers
|
||||
require("mason-lspconfig").setup_handlers {
|
||||
-- The first entry (without a key) will be the default handler
|
||||
-- and will be called for each installed server that doesn't have
|
||||
-- a dedicated handler.
|
||||
function(server_name) -- default handler (optional)
|
||||
require("lspconfig")[server_name].setup {}
|
||||
end,
|
||||
-- Next, you can provide targeted overrides for specific servers.
|
||||
-- For example, a handler override for the `rust_analyzer`:
|
||||
["rust_analyzer"] = function() require("rust-tools").setup {} end
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
local lsp_installer = require("nvim-lsp-installer")
|
||||
|
||||
-- Register a handler that will be called for all installed servers.
|
||||
-- Alternatively, you may also register handlers on specific server instances instead (see example below).
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {}
|
||||
|
||||
-- (optional) Customize the options passed to the server
|
||||
-- if server.name == "tsserver" then
|
||||
-- opts.root_dir = function() ... end
|
||||
-- end
|
||||
|
||||
-- This setup() function is exactly the same as lspconfig's setup function.
|
||||
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||
server:setup(opts)
|
||||
end)
|
||||
|
18
lua/plugins/null-ls.lua
Normal file
18
lua/plugins/null-ls.lua
Normal file
@ -0,0 +1,18 @@
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
-- builtins
|
||||
-- local code_actions = null_ls.builtins.code_actions
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local hover = null_ls.builtins.hover
|
||||
local completion = null_ls.builtins.completion
|
||||
|
||||
local sources = {
|
||||
code_actions,
|
||||
diagnostics,
|
||||
formatting,
|
||||
hover,
|
||||
completion
|
||||
}
|
||||
|
||||
null_ls.setup({ sources = sources })
|
Loading…
Reference in New Issue
Block a user