Added cmp stuff and drag binds
This commit is contained in:
parent
4b8c565254
commit
fd24df3d2c
1 changed files with 65 additions and 10 deletions
|
@ -20,8 +20,11 @@ Plug 'powerman/vim-plugin-AnsiEsc'
|
|||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'williamboman/mason.nvim'
|
||||
Plug 'williamboman/mason-lspconfig.nvim'
|
||||
Plug 'hrsh7th/nvim-cmp'
|
||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||
Plug 'hrsh7th/cmp-buffer'
|
||||
Plug 'hrsh7th/cmp-path'
|
||||
Plug 'hrsh7th/cmp-cmdline'
|
||||
Plug 'hrsh7th/nvim-cmp'
|
||||
Plug 'L3MON4D3/LuaSnip'
|
||||
Plug 'VonHeikemen/lsp-zero.nvim', {'branch': 'v3.x'}
|
||||
|
||||
|
@ -31,6 +34,7 @@ Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.6' }
|
|||
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
Plug 'nvim-treesitter/nvim-treesitter-context'
|
||||
Plug 'nvim-treesitter/playground'
|
||||
Plug 'mbbill/undotree'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
|
||||
|
@ -44,7 +48,7 @@ call plug#end()
|
|||
" ----[NVim LSPConfig]----
|
||||
lua << EOF
|
||||
local lsp = require 'lspconfig'
|
||||
local qt_uic = require 'qt_uic'
|
||||
-- local qt_uic = require 'qt_uic'
|
||||
-- local coq = require 'coq'
|
||||
|
||||
-- lsp.cmake.setup{}
|
||||
|
@ -54,38 +58,85 @@ local qt_uic = require 'qt_uic'
|
|||
-- lsp.cmake.setup{coq.lsp_ensure_capabilities{}}
|
||||
-- lsp.pyright.setup{coq.lsp_ensure_capabilities{}}
|
||||
|
||||
|
||||
local lsp_zero = require('lsp-zero')
|
||||
|
||||
|
||||
lsp_zero.on_attach(function(client, bufnr)
|
||||
-- see :help lsp-zero-keybindings
|
||||
-- to learn the available actions
|
||||
lsp_zero.default_keymaps({buffer = bufnr})
|
||||
end)
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false
|
||||
})
|
||||
local cmp = require('cmp')
|
||||
local cmp_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
cmp_lsp.default_capabilities())
|
||||
|
||||
-- to learn how to use mason.nvim with lsp-zero
|
||||
-- read this: https://github.com/VonHeikemen/lsp-zero.nvim/blob/v3.x/doc/md/guides/integrate-with-mason-nvim.md
|
||||
local lspconfig = require('lspconfig')
|
||||
require('mason').setup({})
|
||||
require('mason-lspconfig').setup({
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup({})
|
||||
lspconfig[server_name].setup({capabilities=capabilities})
|
||||
end,
|
||||
['lua_ls'] = function()
|
||||
lspconfig.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = 'Lua 5.1' },
|
||||
diagnostics = {
|
||||
globals = { 'vim', 'it', 'describe', 'before_each', 'after_each' },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
||||
lsp.clangd.setup{}
|
||||
lsp.cmake.setup{}
|
||||
lsp.pyright.setup{}
|
||||
-- memes = vim.lsp.start_client({
|
||||
-- name='qt_uic',
|
||||
-- cmd={'python', 'lsptest.py'},
|
||||
-- root_dir='/home/devnull'
|
||||
-- })
|
||||
|
||||
-- qt_uic.setup{}
|
||||
|
||||
cmp.setup({
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<tab>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
}),
|
||||
sources = cmp.config.sources(
|
||||
{
|
||||
{ name = 'nvim_lsp' },
|
||||
-- { name = 'qt_uic' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
-- lsp.clangd.setup{}
|
||||
-- lsp.cmake.setup{}
|
||||
-- lsp.pyright.setup{}
|
||||
|
||||
-- lsp.clangd.setup{coq.lsp_ensure_capabilities{}}
|
||||
-- lsp.cmake.setup{coq.lsp_ensure_capabilities{}}
|
||||
-- lsp.pyright.setup{coq.lsp_ensure_capabilities{}}
|
||||
|
||||
lsp.pyright.setup{qt_uic.extend_lsp_completion{}}
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = {
|
||||
|
@ -136,6 +187,10 @@ vim.keymap.set('n', '<leader>gs', vim.cmd.Git)
|
|||
vim.opt.scrolloff = 8
|
||||
vim.opt.signcolumn = 'yes'
|
||||
vim.opt.isfname:append('@-@')
|
||||
|
||||
-- Dragging
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
EOF
|
||||
|
||||
" ----[Look and Feel]----
|
||||
|
|
Loading…
Reference in a new issue