mirror of
https://github.com/ksyasuda/rice.git
synced 2025-12-07 08:53:37 -08:00
update
This commit is contained in:
293
lvim/config.lua
293
lvim/config.lua
@@ -2,47 +2,22 @@
|
||||
lvim.log.level = "warn"
|
||||
lvim.format_on_save = true
|
||||
lvim.colorscheme = "onedarker"
|
||||
|
||||
lvim.leader = "space"
|
||||
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
|
||||
|
||||
-- custom settings
|
||||
local init_custom_options = function()
|
||||
local custom_options = {
|
||||
relativenumber = true,
|
||||
colorcolumn = "80",
|
||||
scrolloff = 10,
|
||||
ignorecase = true,
|
||||
smartcase = true,
|
||||
}
|
||||
|
||||
for k, v in pairs(custom_options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
end
|
||||
init_custom_options()
|
||||
|
||||
lvim.builtin.dashboard.active = true
|
||||
lvim.builtin.terminal.active = true
|
||||
|
||||
-- Nvimtree
|
||||
lvim.builtin.nvimtree.setup.view.side = "left"
|
||||
lvim.builtin.nvimtree.show_icons.git = 1
|
||||
lvim.builtin.nvimtree.hide_dotfiles = 0
|
||||
|
||||
-- Treesitter
|
||||
lvim.builtin.treesitter.highlight.enabled = true
|
||||
lvim.builtin.treesitter.matchup.enable = true
|
||||
lvim.builtin.treesitter.context_commentstring.enable = true
|
||||
|
||||
local components = require("lvim.core.lualine.components")
|
||||
|
||||
lvim.builtin.lualine.sections.lualine_a = { "mode" }
|
||||
lvim.builtin.lualine.sections.lualine_c = { components.python_env }
|
||||
lvim.builtin.lualine.sections.lualine_y = {
|
||||
components.location,
|
||||
}
|
||||
|
||||
lvim.builtin.lualine.sections.lualine_y = { components.location, }
|
||||
lvim.builtin.treesitter.ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
@@ -55,11 +30,14 @@ lvim.builtin.treesitter.ensure_installed = {
|
||||
"rust",
|
||||
"java",
|
||||
"yaml",
|
||||
"dockerfile",
|
||||
"markdown",
|
||||
"make"
|
||||
}
|
||||
|
||||
lvim.builtin.treesitter.ignore_install = { "haskell" }
|
||||
lvim.builtin.treesitter.highlight.enabled = true
|
||||
|
||||
-- formatters
|
||||
local formatters = require "lvim.lsp.null-ls.formatters"
|
||||
formatters.setup {
|
||||
{ exe = "black", filetypes = { "python" } },
|
||||
@@ -72,20 +50,21 @@ formatters.setup {
|
||||
{ exe = "shfmt", filetypes = { "shell", "sh" }, args = {'-i=0','-sr', '-ci'} },
|
||||
}
|
||||
|
||||
-- -- set additional linters
|
||||
-- linters
|
||||
local linters = require "lvim.lsp.null-ls.linters"
|
||||
linters.setup {
|
||||
{ exe = "flake8", filetypes = { "python" } },
|
||||
{
|
||||
exe = "shellcheck",
|
||||
fieltypes = { "shell" },
|
||||
args = { "--severity", "warning" },
|
||||
}
|
||||
filetypes = { "shell", "sh" },
|
||||
args = { "--severity", "warning", "--shell", "/bin/bash", "--enable", "check-unassigned-uppercase,add-default-case,deprecate-which" },
|
||||
},
|
||||
}
|
||||
|
||||
-- lsp signature cfg
|
||||
local lsp_signature_cfg = {
|
||||
debug = false, -- set to true to enable debug logging
|
||||
log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on
|
||||
-- log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on
|
||||
-- default is ~/.cache/nvim/lsp_signature.log
|
||||
verbose = false, -- show debug line number
|
||||
|
||||
@@ -109,7 +88,7 @@ local lsp_signature_cfg = {
|
||||
hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight
|
||||
max_height = 20, -- max height of signature floating_window, if content is more than max_height, you can scroll down
|
||||
-- to view the hiding contents
|
||||
max_width = 150, -- max_width of signature floating_window, line will be wrapped if exceed max_width
|
||||
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
|
||||
handler_opts = {
|
||||
border = "rounded" -- double, rounded, single, shadow, none
|
||||
},
|
||||
@@ -122,11 +101,11 @@ local lsp_signature_cfg = {
|
||||
|
||||
padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc
|
||||
|
||||
transparency = nil, -- disabled by default, allow floating win transparent value 1~100
|
||||
transparency = 85, -- disabled by default, allow floating win transparent value 1~100
|
||||
shadow_blend = 36, -- if you using shadow as border use this set the opacity
|
||||
shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315'
|
||||
timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency
|
||||
toggle_key = nil -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>'
|
||||
toggle_key = '<C-l>' -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>'
|
||||
}
|
||||
|
||||
-- Additional Plugins
|
||||
@@ -150,7 +129,7 @@ lvim.plugins = {
|
||||
"rmagatti/goto-preview",
|
||||
config = function()
|
||||
require('goto-preview').setup {
|
||||
width = 120; -- Width of the floating window
|
||||
width = 100; -- Width of the floating window
|
||||
height = 25; -- Height of the floating window
|
||||
default_mappings = false; -- Bind default mappings
|
||||
debug = false; -- Print debug information
|
||||
@@ -188,6 +167,8 @@ lvim.plugins = {
|
||||
'wakatime/vim-wakatime',
|
||||
'ap/vim-css-color',
|
||||
"p00f/nvim-ts-rainbow",
|
||||
"tzachar/cmp-tabnine",
|
||||
"onsails/lspkind-nvim"
|
||||
}
|
||||
|
||||
-- add jedi_language_server
|
||||
@@ -201,16 +182,96 @@ require'lspconfig'.sqlls.setup{}
|
||||
-- require('lspconfig').bashls.setup{}
|
||||
require'lspconfig'.bashls.setup{}
|
||||
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require'cmp'
|
||||
-- cmp.setup({
|
||||
-- snippet = {
|
||||
-- -- REQUIRED - you must specify a snippet engine
|
||||
-- expand = function(args)
|
||||
-- -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
-- end,
|
||||
-- },
|
||||
-- mapping = {
|
||||
-- ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
-- ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
-- ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
-- ['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
-- ['<C-e>'] = cmp.mapping({
|
||||
-- i = cmp.mapping.abort(),
|
||||
-- c = cmp.mapping.close(),
|
||||
-- }),
|
||||
-- ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
-- },
|
||||
-- sources = cmp.config.sources({
|
||||
-- { name = 'nvim_lsp' },
|
||||
-- }, {
|
||||
-- { name = 'buffer' },
|
||||
-- })
|
||||
-- })
|
||||
|
||||
-- -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
-- cmp.setup.cmdline('/', {
|
||||
-- sources = {
|
||||
-- { name = 'buffer' }
|
||||
-- }
|
||||
-- })
|
||||
|
||||
-- -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
-- cmp.setup.cmdline(':', {
|
||||
-- sources = cmp.config.sources({
|
||||
-- { name = 'path' }
|
||||
-- }, {
|
||||
-- { name = 'cmdline' }
|
||||
-- })
|
||||
-- })
|
||||
|
||||
-- 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')['jedi_language_server'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['bashls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['dockerls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['jsonls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['sumneko_lua'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['pyright'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['dotls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['yamlls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['html'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['eslint'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
-- lsp_signature
|
||||
require'lsp_signature'.setup()
|
||||
-- require'lsp_signature'.setup(lsp_signature_cfg)
|
||||
|
||||
require('goto-preview').setup {
|
||||
width = 220; -- Width of the floating window
|
||||
height = 55; -- Height of the floating window
|
||||
width = 150; -- Width of the floating window
|
||||
height = 45; -- Height of the floating window
|
||||
border = {"↖", "─" ,"┐", "│", "┘", "─", "└", "│"}; -- Border characters of the floating window
|
||||
default_mappings = true; -- Bind default mappings
|
||||
debug = false; -- Print debug information
|
||||
opacity = nil; -- 0-100 opacity level of the floating window where 100 is fully transparent.
|
||||
opacity = 55; -- 0-100 opacity level of the floating window where 100 is fully transparent.
|
||||
resizing_mappings = false; -- Binds arrow keys to resizing the floating window.
|
||||
post_open_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook.
|
||||
-- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality.
|
||||
@@ -227,7 +288,7 @@ vim.g.symbols_outline = {
|
||||
auto_preview = true,
|
||||
position = 'right',
|
||||
relative_width = true,
|
||||
width = 25,
|
||||
width = 30,
|
||||
show_numbers = false,
|
||||
show_relative_numbers = false,
|
||||
show_symbol_details = true,
|
||||
@@ -273,89 +334,81 @@ vim.g.symbols_outline = {
|
||||
}
|
||||
}
|
||||
|
||||
vim.api.nvim_set_keymap("n", "ss", "<cmd>SymbolsOutline<CR>", {noremap=true})
|
||||
-- lsp-kind
|
||||
local lspkind = require('lspkind')
|
||||
cmp.setup {
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
with_text = false, -- do not show text alongside icons
|
||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
-- The function below will be called before any actual modifications from lspkind
|
||||
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
|
||||
-- before = function (entry, vim_item)
|
||||
-- ...
|
||||
-- return vim_item
|
||||
-- end
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
-- 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')['jedi_language_server'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['bashls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['dockerls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['jsonls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['sumneko_lua'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['pyright'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['dotls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['yamlls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['html'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['eslint'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
-- tabnine
|
||||
require'cmp'.setup {
|
||||
sources = {
|
||||
{ name = 'cmp_tabnine' },
|
||||
},
|
||||
}
|
||||
|
||||
local source_mapping = {
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
cmp_tabnine = "[TN]",
|
||||
path = "[Path]",
|
||||
}
|
||||
|
||||
require'cmp'.setup {
|
||||
sources = {
|
||||
{ name = 'cmp_tabnine' },
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = lspkind.presets.default[vim_item.kind]
|
||||
local menu = source_mapping[entry.source.name]
|
||||
if entry.source.name == 'cmp_tabnine' then
|
||||
if entry.completion_item.data ~= nil and entry.completion_item.data.detail ~= nil then
|
||||
menu = entry.completion_item.data.detail .. ' ' .. menu
|
||||
end
|
||||
vim_item.kind = ''
|
||||
end
|
||||
vim_item.menu = menu
|
||||
return vim_item
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
-- custom settings
|
||||
local init_custom_options = function()
|
||||
local custom_options = {
|
||||
relativenumber = true,
|
||||
colorcolumn = "80",
|
||||
scrolloff = 10,
|
||||
ignorecase = true,
|
||||
smartcase = true,
|
||||
tabstop = 4,
|
||||
shiftwidth = 4,
|
||||
undofile = false,
|
||||
}
|
||||
|
||||
for k, v in pairs(custom_options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
end
|
||||
init_custom_options()
|
||||
|
||||
-- move windows to right side of screen
|
||||
vim.cmd("autocmd! BufEnter * if &ft ==# 'help' | wincmd L | endif")
|
||||
vim.cmd("autocmd! BufEnter * if &ft ==# 'man' | wincmd L | endif")
|
||||
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
|
||||
-- lvim.autocommands.custom_groups = {
|
||||
-- { "BufWinEnter", "*.lua", "setlocal ts=8 sw=8" },
|
||||
|
||||
Reference in New Issue
Block a user