mirror of
https://github.com/ksyasuda/rice.git
synced 2024-11-22 03:19:58 -08:00
update nvim
This commit is contained in:
parent
997cd34645
commit
9b80bee1d5
@ -1,7 +1,7 @@
|
||||
syntax enable
|
||||
filetype plugin on
|
||||
set noshowmode "disable default vim insert text at bottom
|
||||
set laststatus=2
|
||||
set laststatus=3
|
||||
set number
|
||||
set colorcolumn=80
|
||||
set tw=80
|
||||
@ -79,6 +79,8 @@ if has('nvim')
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'nvim-lua/popup.nvim'
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
" Plug 'zbirenbaum/copilot.lua'
|
||||
" Plug 'zbirenbaum/copilot-cmp'
|
||||
" Plug 'nvim-telescope/telescope.nvim'
|
||||
|
||||
" Plug 'TimUntersberger/neogit'
|
||||
@ -153,6 +155,7 @@ if has('nvim')
|
||||
source ~/.config/nvim/plugin-confs/whichkey.lua
|
||||
|
||||
source ~/.config/nvim/plugin-confs/code_actions.lua
|
||||
" source ~/.config/nvim/plugin-confs/copilot.lua
|
||||
source ~/.config/nvim/plugin-confs/goto-preview.lua
|
||||
source ~/.config/nvim/plugin-confs/lsp-kind.lua
|
||||
source ~/.config/nvim/plugin-confs/lsp-signature.lua
|
||||
|
@ -5,10 +5,10 @@ nmap <F5> :!
|
||||
vnoremap < <gv
|
||||
vnoremap > >gv
|
||||
|
||||
" for toggling/hiding the vsplit-term
|
||||
" for toggling/hiding the split-term
|
||||
tnoremap <C-T> <C-\><C-n>:FloatermToggle floatingterm<CR>
|
||||
tnoremap <Esc> <C-\><C-n>
|
||||
tnoremap <leader>tt <C-\><C-N>:FloatermToggle vsplit-term<CR>
|
||||
tnoremap <leader>tt <C-\><C-N>:FloatermToggle split-term<CR>
|
||||
|
||||
nmap <C-J> :bnext<CR>
|
||||
nmap <C-K> :bprev<CR>
|
||||
@ -91,9 +91,10 @@ nmap <leader>n :NvimTreeToggle<CR>
|
||||
|
||||
nmap <leader>ob :FloatermNew --title=bpytop --opener=vsplit bpytop<CR>
|
||||
nmap <leader>od :FloatermNew --title=lazydocker --opener=vsplit lazydocker<CR>
|
||||
nmap <leader>oh :FloatermNew --title=floaterm --name=split-term --opener=edit --wintype=split --position=botright --height=0.45<CR>
|
||||
nmap <leader>on :FloatermNew --title=ncmpcpp --opener=vsplit ncmpcpp<CR>
|
||||
nmap <leader>or :FloatermNew --title=ranger --opener=vsplit ranger --cmd="cd $PWD"<CR>
|
||||
nmap <leader>ot :FloatermNew --title=floaterm --name=vsplit-term --opener=edit --wintype=vsplit --position=botright --width=0.5<CR>
|
||||
nmap <leader>ot :FloatermNew --title=floaterm --name=split-term --opener=edit --wintype=vsplit --position=botright --width=0.5<CR>
|
||||
|
||||
nmap <leader>r :NvimTreeRefresh<CR>
|
||||
|
||||
@ -107,7 +108,7 @@ nmap <leader>s/ :History/<CR>
|
||||
|
||||
nnoremap <silent> <Leader>tc :DashboardChangeColorscheme<CR>
|
||||
nmap <leader>to :SymbolsOutline<CR>
|
||||
nmap <leader>tt :FloatermToggle vsplit-term<CR>
|
||||
nmap <leader>tt :FloatermToggle split-term<CR>
|
||||
|
||||
nmap <leader>wa :lua vim.lsp.buf.add_workspace_folder()<CR>
|
||||
nmap <leader>wl :lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>
|
||||
|
@ -1,4 +1,4 @@
|
||||
local opts = { noremap=true, silent=true }
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.api.nvim_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||
@ -60,19 +60,19 @@ vim.cmd [[autocmd! ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335
|
||||
-- rounded
|
||||
|
||||
local border = {
|
||||
{"╭", "FloatBorder"},
|
||||
{"─", "FloatBorder"},
|
||||
{"╮", "FloatBorder"},
|
||||
{"│", "FloatBorder"},
|
||||
{"╯", "FloatBorder"},
|
||||
{"─", "FloatBorder"},
|
||||
{"╰", "FloatBorder"},
|
||||
{"│", "FloatBorder"},
|
||||
{ "╭", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╮", "FloatBorder" },
|
||||
{ "│", "FloatBorder" },
|
||||
{ "╯", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╰", "FloatBorder" },
|
||||
{ "│", "FloatBorder" },
|
||||
}
|
||||
|
||||
local handlers = {
|
||||
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {border = border}),
|
||||
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {border = border }),
|
||||
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }),
|
||||
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border }),
|
||||
}
|
||||
|
||||
local DEFAULT_SETTINGS = {
|
||||
@ -110,7 +110,7 @@ local DEFAULT_SETTINGS = {
|
||||
install_args = {},
|
||||
},
|
||||
on_attach = on_attach,
|
||||
handlers=handlers,
|
||||
handlers = handlers,
|
||||
|
||||
-- Controls to which degree logs are written to the log file. It's useful to set this to vim.log.levels.DEBUG when
|
||||
-- debugging issues with server installations.
|
||||
@ -138,7 +138,7 @@ end
|
||||
function PrintDiagnostics(opts, bufnr, line_nr, client_id)
|
||||
bufnr = bufnr or 0
|
||||
line_nr = line_nr or (vim.api.nvim_win_get_cursor(0)[1] - 1)
|
||||
opts = opts or {['lnum'] = line_nr}
|
||||
opts = opts or { ['lnum'] = line_nr }
|
||||
|
||||
local line_diagnostics = vim.diagnostic.get(bufnr, opts)
|
||||
if vim.tbl_isempty(line_diagnostics) then return end
|
||||
@ -151,7 +151,7 @@ function PrintDiagnostics(opts, bufnr, line_nr, client_id)
|
||||
diagnostic_message = diagnostic_message .. "\n"
|
||||
end
|
||||
end
|
||||
vim.api.nvim_echo({{diagnostic_message, "Normal"}}, false, {})
|
||||
vim.api.nvim_echo({ { diagnostic_message, "Normal" } }, false, {})
|
||||
end
|
||||
|
||||
-- vim.cmd [[ autocmd! CursorHold * lua PrintDiagnostics() ]]
|
||||
@ -176,7 +176,7 @@ end)
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local servers = { 'pyright', 'bashls', 'vimls', 'yamlls', 'dockerls', 'html', 'sumneko_lua', 'dotls', 'rust_analyzer', 'clangd' }
|
||||
local servers = { 'pyright', 'bashls', 'vimls', 'yamlls', 'dockerls', 'html', 'sumneko_lua', 'dotls', 'rust_analyzer', 'clangd', 'ansiblels' }
|
||||
for _, lsp in pairs(servers) do
|
||||
require('lspconfig')[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
|
@ -13,35 +13,36 @@ require("null-ls").setup({
|
||||
end
|
||||
end,
|
||||
sources = {
|
||||
require("null-ls").builtins.completion.spell,
|
||||
require("null-ls").builtins.completion.luasnip,
|
||||
require("null-ls").builtins.code_actions.gitsigns,
|
||||
require("null-ls").builtins.code_actions.shellcheck,
|
||||
require("null-ls").builtins.diagnostics.cppcheck,
|
||||
require("null-ls").builtins.diagnostics.gitlint,
|
||||
require("null-ls").builtins.diagnostics.jsonlint,
|
||||
null_ls.builtins.completion.spell,
|
||||
null_ls.builtins.completion.luasnip,
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
null_ls.builtins.code_actions.shellcheck,
|
||||
null_ls.builtins.diagnostics.cppcheck,
|
||||
null_ls.builtins.diagnostics.gitlint,
|
||||
null_ls.builtins.diagnostics.jsonlint,
|
||||
-- require("null-ls").builtins.diagnostics.luacheck,
|
||||
require("null-ls").builtins.diagnostics.markdownlint,
|
||||
require("null-ls").builtins.diagnostics.pylint,
|
||||
require("null-ls").builtins.diagnostics.pydocstyle.with({
|
||||
null_ls.builtins.diagnostics.markdownlint,
|
||||
null_ls.builtins.diagnostics.pylint,
|
||||
null_ls.builtins.diagnostics.pydocstyle.with({
|
||||
extra_args = { "--config=$ROOT/setup.cfg" }
|
||||
}),
|
||||
require("null-ls").builtins.diagnostics.vint,
|
||||
require("null-ls").builtins.formatting.json_tool,
|
||||
null_ls.builtins.diagnostics.vint,
|
||||
null_ls.builtins.diagnostics.shellcheck.with({
|
||||
extra_args = { "-s", "bash", "-o", "add-default-case, check-set-e-suppressed, check-unassigned-uppercase, deprecate-which, quote-safe-variables" }
|
||||
}),
|
||||
null_ls.builtins.diagnostics.ansiblelint,
|
||||
null_ls.builtins.formatting.json_tool,
|
||||
-- require("null-ls").builtins.formatting.lua_format,
|
||||
require("null-ls").builtins.formatting.markdownlint,
|
||||
require("null-ls").builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.markdownlint,
|
||||
null_ls.builtins.formatting.prettier,
|
||||
-- handled by lsp server
|
||||
-- require("null-ls").builtins.formatting.rustfmt,
|
||||
require("null-ls").builtins.formatting.shfmt.with({
|
||||
filetypes = {"sh", "bash"},
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
filetypes = { "sh", "bash" },
|
||||
extra_args = { "-i", "0", "-ci", "-sr" }
|
||||
}),
|
||||
require("null-ls").builtins.diagnostics.shellcheck.with({
|
||||
extra_args = { "-s", "bash", "-o", "check-extra-masked-returns, check-set-e-suppressed, check-unassigned-uppercase, deprecate-which, quote-safe-variables" }
|
||||
}),
|
||||
require("null-ls").builtins.formatting.black,
|
||||
require("null-ls").builtins.formatting.isort,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.isort,
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require'cmp'
|
||||
local cmp = require 'cmp'
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
@ -73,29 +73,31 @@ cmp.setup({
|
||||
})
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = "copilot", group_index = 2 },
|
||||
{ name = 'nvim_lsp', group_index = 2 },
|
||||
-- { name = 'vsnip' }, -- For vsnip users.
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
{ name = "path", group_index = 2 },
|
||||
{ name = 'luasnip', group_index = 2 }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
-- Setup lspconfig.
|
||||
-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||
-- require('lspconfig')['bashls'].setup {
|
||||
-- capabilities = capabilities
|
||||
-- }
|
||||
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
|
||||
local lspconfig = require('lspconfig')
|
||||
local servers = { 'bashls', 'pyright', 'sqlls', 'jsonls', 'yamlls', 'vimls', 'dotls', 'dockerls' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
-- Setup lspconfig.
|
||||
-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||
-- require('lspconfig')['bashls'].setup {
|
||||
-- capabilities = capabilities
|
||||
-- }
|
||||
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
|
||||
local lspconfig = require('lspconfig')
|
||||
local servers = { 'bashls', 'pyright', 'sqlls', 'jsonls', 'yamlls', 'vimls', 'dotls', 'dockerls' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
-- on_attach = my_custom_on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user