nvim: better lua conf

This commit is contained in:
Daniel Lundin 2022-07-23 11:52:42 +02:00
parent c0352a7c85
commit 6c91dbbe63
3 changed files with 46 additions and 47 deletions

View file

@ -48,7 +48,10 @@ local efm_prettier = {
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 = {
Lua = {
completion = {kewordSnippet = "Disable"},
@ -61,14 +64,10 @@ lspconfig.sumneko_lua.setup {
path = {"?.lua", "?/init.lua", "?/?.lua"}
},
workspace = {
library = {
[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,
preloadFileSize = 1000
library = vim.api.nvim_get_runtime_file("", true),
maxPreload = 2000,
preloadFileSize = 1000,
checkThirdParty = false,
}
}
}

View file

@ -9,6 +9,7 @@ return require('packer').startup(function()
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
use {'ray-x/guihua.lua', run = 'cd lua/fzy && make'}
use 'jjo/vim-cue'
use("ckipp01/stylua-nvim")
use {
'theHamsta/nvim-dap-virtual-text',
@ -216,15 +217,6 @@ return require('packer').startup(function()
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
use {
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
@ -236,6 +228,15 @@ return require('packer').startup(function()
end
}
-- zenbones
use {
"mcchrish/zenbones.nvim",
requires = {
"rktjmp/lush.nvim",
},
config = function() require("plugins/zenbones") end,
}
-- copilot
-- use({
-- "github/copilot.vim",

View file

@ -1,9 +1,9 @@
vim.cmd[[set undofile]]
vim.cmd[[set completeopt-=preview]]
vim.cmd[[set viewoptions-=options]]
vim.g.mapleader = ','
vim.cmd([[set undofile]])
vim.cmd([[set completeopt-=preview]])
vim.cmd([[set viewoptions-=options]])
vim.g.mapleader = ","
vim.o.hidden = true
vim.o.mouse = 'a'
vim.o.mouse = "a"
vim.o.splitbelow = true
vim.o.splitright = true
vim.o.ttimeout = true
@ -21,7 +21,7 @@ vim.o.breakindent = true
vim.o.expandtab = true
vim.o.smartindent = true
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.linebreak = true
vim.wo.list = true
@ -30,22 +30,22 @@ vim.o.tabstop = 2
vim.o.softtabstop = 2
--- Search
vim.cmd('set path+=**')
vim.cmd('set wildignore+=*/tmp/*,/var/*,*.so,*.swp,*.zip,*.tar,*.pyc')
vim.cmd("set path+=**")
vim.cmd("set wildignore+=*/tmp/*,/var/*,*.so,*.swp,*.zip,*.tar,*.pyc")
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.wildmode = 'longest:full,full'
vim.o.wildmode = "longest:full,full"
if vim.fn.executable('rg') then
vim.o.grepprg = 'rg --vimgrep --no-heading --smart-case'
if vim.fn.executable("rg") then
vim.o.grepprg = "rg --vimgrep --no-heading --smart-case"
end
--- Completion
vim.cmd('set shortmess+=c')
vim.o.completeopt = 'menuone,noinsert,noselect'
vim.cmd("set shortmess+=c")
vim.o.completeopt = "menuone,noinsert,noselect"
--- Appearance
vim.o.background = 'light'
vim.o.background = "light"
vim.o.scrolloff = 5
vim.o.showmode = false
vim.o.sidescrolloff = 5
@ -63,27 +63,26 @@ vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
--- Key mappings
local map = require("dln.utils").map
map('n', '<C-l>', ':let @/=""<CR>') -- clear search
map('n', 'H', '^')
map('n', 'L', '$')
map('i', '', '<C-w>')
map("n", "<C-l>", ':let @/=""<CR>') -- clear search
map("n", "H", "^")
map("n", "L", "$")
map("i", "", "<C-w>")
map('n', ',L', ':luafile %<CR>') -- Reload lua file
map("n", ",L", ":luafile %<CR>") -- Reload lua file
--- Plugins
vim.g.netrw_dirhistmax = 0
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/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 })