nvim: better lua conf
This commit is contained in:
parent
c0352a7c85
commit
6c91dbbe63
3 changed files with 46 additions and 47 deletions
|
@ -48,7 +48,10 @@ local efm_prettier = {
|
||||||
|
|
||||||
|
|
||||||
lspconfig.sumneko_lua.setup {
|
lspconfig.sumneko_lua.setup {
|
||||||
cmd = {"lua-language-server", "-E", "/usr/share/lua-language-server/main.lua"},
|
on_attach = function()
|
||||||
|
on_attach()
|
||||||
|
vim.cmd([[autocmd BufWritePre <buffer> lua require'stylua-nvim'.format_file()]])
|
||||||
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
completion = {kewordSnippet = "Disable"},
|
completion = {kewordSnippet = "Disable"},
|
||||||
|
@ -61,14 +64,10 @@ lspconfig.sumneko_lua.setup {
|
||||||
path = {"?.lua", "?/init.lua", "?/?.lua"}
|
path = {"?.lua", "?/init.lua", "?/?.lua"}
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
library = {
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
|
||||||
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
|
|
||||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
|
||||||
[vim.fn.stdpath("data") .. "/site/pack"] = true
|
|
||||||
},
|
|
||||||
maxPreload = 2000,
|
maxPreload = 2000,
|
||||||
preloadFileSize = 1000
|
preloadFileSize = 1000,
|
||||||
|
checkThirdParty = false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ return require('packer').startup(function()
|
||||||
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
|
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
|
||||||
use {'ray-x/guihua.lua', run = 'cd lua/fzy && make'}
|
use {'ray-x/guihua.lua', run = 'cd lua/fzy && make'}
|
||||||
use 'jjo/vim-cue'
|
use 'jjo/vim-cue'
|
||||||
|
use("ckipp01/stylua-nvim")
|
||||||
|
|
||||||
use {
|
use {
|
||||||
'theHamsta/nvim-dap-virtual-text',
|
'theHamsta/nvim-dap-virtual-text',
|
||||||
|
@ -216,15 +217,6 @@ return require('packer').startup(function()
|
||||||
config = function() require("plugins/nvim-dap-go") end,
|
config = function() require("plugins/nvim-dap-go") end,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- zenbones
|
|
||||||
use {
|
|
||||||
"mcchrish/zenbones.nvim",
|
|
||||||
requires = {
|
|
||||||
"rktjmp/lush.nvim",
|
|
||||||
},
|
|
||||||
config = function() require("plugins/zenbones") end,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- lsp_lines
|
-- lsp_lines
|
||||||
use {
|
use {
|
||||||
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||||
|
@ -236,6 +228,15 @@ return require('packer').startup(function()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- zenbones
|
||||||
|
use {
|
||||||
|
"mcchrish/zenbones.nvim",
|
||||||
|
requires = {
|
||||||
|
"rktjmp/lush.nvim",
|
||||||
|
},
|
||||||
|
config = function() require("plugins/zenbones") end,
|
||||||
|
}
|
||||||
|
|
||||||
-- copilot
|
-- copilot
|
||||||
-- use({
|
-- use({
|
||||||
-- "github/copilot.vim",
|
-- "github/copilot.vim",
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
vim.cmd[[set undofile]]
|
vim.cmd([[set undofile]])
|
||||||
vim.cmd[[set completeopt-=preview]]
|
vim.cmd([[set completeopt-=preview]])
|
||||||
vim.cmd[[set viewoptions-=options]]
|
vim.cmd([[set viewoptions-=options]])
|
||||||
vim.g.mapleader = ','
|
vim.g.mapleader = ","
|
||||||
vim.o.hidden = true
|
vim.o.hidden = true
|
||||||
vim.o.mouse = 'a'
|
vim.o.mouse = "a"
|
||||||
vim.o.splitbelow = true
|
vim.o.splitbelow = true
|
||||||
vim.o.splitright = true
|
vim.o.splitright = true
|
||||||
vim.o.ttimeout = true
|
vim.o.ttimeout = true
|
||||||
|
@ -21,7 +21,7 @@ vim.o.breakindent = true
|
||||||
vim.o.expandtab = true
|
vim.o.expandtab = true
|
||||||
vim.o.smartindent = true
|
vim.o.smartindent = true
|
||||||
vim.o.joinspaces = false
|
vim.o.joinspaces = false
|
||||||
vim.o.listchars = 'extends:›,precedes:‹,nbsp:·,tab:→ ,trail:·'
|
vim.o.listchars = "extends:›,precedes:‹,nbsp:·,tab:→ ,trail:·"
|
||||||
vim.wo.foldlevel = 99
|
vim.wo.foldlevel = 99
|
||||||
vim.wo.linebreak = true
|
vim.wo.linebreak = true
|
||||||
vim.wo.list = true
|
vim.wo.list = true
|
||||||
|
@ -30,22 +30,22 @@ vim.o.tabstop = 2
|
||||||
vim.o.softtabstop = 2
|
vim.o.softtabstop = 2
|
||||||
|
|
||||||
--- Search
|
--- Search
|
||||||
vim.cmd('set path+=**')
|
vim.cmd("set path+=**")
|
||||||
vim.cmd('set wildignore+=*/tmp/*,/var/*,*.so,*.swp,*.zip,*.tar,*.pyc')
|
vim.cmd("set wildignore+=*/tmp/*,/var/*,*.so,*.swp,*.zip,*.tar,*.pyc")
|
||||||
vim.o.ignorecase = true
|
vim.o.ignorecase = true
|
||||||
vim.o.smartcase = true
|
vim.o.smartcase = true
|
||||||
vim.o.wildmode = 'longest:full,full'
|
vim.o.wildmode = "longest:full,full"
|
||||||
|
|
||||||
if vim.fn.executable('rg') then
|
if vim.fn.executable("rg") then
|
||||||
vim.o.grepprg = 'rg --vimgrep --no-heading --smart-case'
|
vim.o.grepprg = "rg --vimgrep --no-heading --smart-case"
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Completion
|
--- Completion
|
||||||
vim.cmd('set shortmess+=c')
|
vim.cmd("set shortmess+=c")
|
||||||
vim.o.completeopt = 'menuone,noinsert,noselect'
|
vim.o.completeopt = "menuone,noinsert,noselect"
|
||||||
|
|
||||||
--- Appearance
|
--- Appearance
|
||||||
vim.o.background = 'light'
|
vim.o.background = "light"
|
||||||
vim.o.scrolloff = 5
|
vim.o.scrolloff = 5
|
||||||
vim.o.showmode = false
|
vim.o.showmode = false
|
||||||
vim.o.sidescrolloff = 5
|
vim.o.sidescrolloff = 5
|
||||||
|
@ -63,27 +63,26 @@ vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
|
||||||
|
|
||||||
--- Key mappings
|
--- Key mappings
|
||||||
local map = require("dln.utils").map
|
local map = require("dln.utils").map
|
||||||
map('n', '<C-l>', ':let @/=""<CR>') -- clear search
|
map("n", "<C-l>", ':let @/=""<CR>') -- clear search
|
||||||
map('n', 'H', '^')
|
map("n", "H", "^")
|
||||||
map('n', 'L', '$')
|
map("n", "L", "$")
|
||||||
map('i', '', '<C-w>')
|
map("i", "", "<C-w>")
|
||||||
|
|
||||||
map('n', ',L', ':luafile %<CR>') -- Reload lua file
|
map("n", ",L", ":luafile %<CR>") -- Reload lua file
|
||||||
|
|
||||||
--- Plugins
|
--- Plugins
|
||||||
vim.g.netrw_dirhistmax = 0
|
vim.g.netrw_dirhistmax = 0
|
||||||
|
|
||||||
|
|
||||||
local border = {
|
local border = {
|
||||||
{"🭽", "FloatBorder"},
|
{ "🭽", "FloatBorder" },
|
||||||
{"▔", "FloatBorder"},
|
{ "▔", "FloatBorder" },
|
||||||
{"🭾", "FloatBorder"},
|
{ "🭾", "FloatBorder" },
|
||||||
{"▕", "FloatBorder"},
|
{ "▕", "FloatBorder" },
|
||||||
{"🭿", "FloatBorder"},
|
{ "🭿", "FloatBorder" },
|
||||||
{"▁", "FloatBorder"},
|
{ "▁", "FloatBorder" },
|
||||||
{"🭼", "FloatBorder"},
|
{ "🭼", "FloatBorder" },
|
||||||
{"▏", "FloatBorder"},
|
{ "▏", "FloatBorder" },
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {border = border })
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
|
||||||
|
|
Loading…
Reference in a new issue