refactor(nvim): clean up lua file structure

main
mandlm 2022-06-25 16:00:14 +02:00
parent d6bfa5c583
commit 98750e1a51
Signed by: mandlm
GPG Key ID: 4AA25D647AA54CC7
20 changed files with 37 additions and 167 deletions

View File

@ -88,7 +88,7 @@
kitty = {
enable = true;
theme = "Solarized Dark";
theme = "Solarized Light";
font = {
name = "DejaVu Sans Mono";
size = 12;
@ -153,44 +153,21 @@
extraConfig = ''
lua << EOF
${builtins.readFile ./nvim/lua/keymaps.lua }
${builtins.readFile ./nvim/lua/options.lua }
${builtins.readFile ./nvim/lua/plugins/treesitter.lua }
${builtins.readFile ./nvim/lua/plugins/lspconfig.lua }
require("toggleterm").setup({ size = 32, open_mapping = [[<F4>]] })
require("notify").setup({ stages = "fade" })
vim.notify = require("notify")
require('Comment').setup({})
require('lualine').setup({
options = { globalstatus = true },
sections = {
lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" }
},
extensions = { "toggleterm" }
})
require('tabline').setup({ enable = true, options = { show_bufnr = true, show_filename_only = true }})
require("indent_blankline").setup {
char = "",
buftype_exclude = { "terminal", "help", "nofile" },
filetype_exclude = { 'help', 'packer' },
show_trailing_blankline_indent = false
}
require('gitsigns').setup()
require("luasnip.loaders.from_vscode").lazy_load()
${builtins.readFile ./nvim/lua/plugins/nvim-cmp.lua }
${builtins.readFile ./nvim/lua/plugins/telescope.lua }
${builtins.readFile ./nvim/lua/themes.lua }
${builtins.readFile ./nvim/keymaps.lua }
${builtins.readFile ./nvim/options.lua }
${builtins.readFile ./nvim/treesitter.lua }
${builtins.readFile ./nvim/lspconfig.lua }
${builtins.readFile ./nvim/toggleterm.lua }
${builtins.readFile ./nvim/notify.lua }
${builtins.readFile ./nvim/comment.lua }
${builtins.readFile ./nvim/lualine.lua }
${builtins.readFile ./nvim/tabline.lua }
${builtins.readFile ./nvim/indent-blankline.lua }
${builtins.readFile ./nvim/gitsigns.lua }
${builtins.readFile ./nvim/luasnip.lua }
${builtins.readFile ./nvim/nvim-cmp.lua }
${builtins.readFile ./nvim/telescope.lua }
${builtins.readFile ./nvim/themes.lua }
EOF
'';
};

1
nvim/comment.lua Normal file
View File

@ -0,0 +1 @@
require('Comment').setup({})

1
nvim/gitsigns.lua Normal file
View File

@ -0,0 +1 @@
require('gitsigns').setup()

View File

@ -0,0 +1,6 @@
require("indent_blankline").setup {
char = "",
buftype_exclude = { "terminal", "help", "nofile" },
filetype_exclude = { 'help', 'packer' },
show_trailing_blankline_indent = false
}

View File

@ -1,4 +0,0 @@
require("keymaps")
require('options')
require('plugins')
require('themes')

View File

@ -1,39 +0,0 @@
return require('packer').startup(function(use)
-- language server
use {
'junnplus/nvim-lsp-setup',
requires = {
'neovim/nvim-lspconfig',
'williamboman/nvim-lsp-installer',
-- additional rust tools
"simrat39/rust-tools.nvim",
-- highlight current symbol
"RRethy/vim-illuminate",
-- lua plugin development
"folke/lua-dev.nvim",
-- lsp status
"nvim-lua/lsp-status.nvim",
},
config = function() require('plugins.nvim-lsp-setup') end,
}
-- null-ls
use {
"jose-elias-alvarez/null-ls.nvim",
config = function()
require("null-ls").setup({
sources = {
require("null-ls").builtins.formatting.prettier,
},
on_attach = function(client)
local utils = require("nvim-lsp-setup.utils")
utils.format_on_save(client)
end,
})
end,
}
end)

View File

@ -1,19 +0,0 @@
require('bufferline')
-- format as "<id>. <file-name>"
local tabname_format = function (opts)
return string.format('%s.', opts.ordinal)
end
require('bufferline').setup({
options = {
always_show_bufferline = true,
numbers = tabname_format,
show_buffer_icons = true,
show_buffer_close_icons = false,
show_close_icon = false,
--separator_style = 'slant',
},
-- Don't use italic on current buffer
highlights = {buffer_selected = { gui = "bold" },},
})

View File

@ -1,65 +0,0 @@
local lsp_status = require("lsp-status")
lsp_status.config({
current_function = false,
show_filename = false,
diagnostics = true,
})
lsp_status.register_progress()
local utils = require("nvim-lsp-setup.utils")
require("nvim-lsp-setup").setup({
default_mappings = false,
mappings = {
gD = "lua vim.lsp.buf.declaration()",
gd = "Telescope lsp_definitions",
gt = "Telescope lsp_type_definitions",
gi = "Telescope lsp_implementations",
gr = "Telescope lsp_references",
K = "lua vim.lsp.buf.hover()",
["<C-k>"] = "lua vim.lsp.buf.signature_help()",
["<leader>rn"] = "lua vim.lsp.buf.rename()",
["<leader>ca"] = "lua vim.lsp.buf.code_action()",
["<leader>f"] = "lua vim.lsp.buf.formatting()",
["<leader>e"] = "lua vim.lsp.diagnostic.show_line_diagnostics()",
["<leader>d"] = "Telescope diagnostics",
["<C-p>"] = "lua vim.diagnostic.goto_prev()",
["<C-n>"] = "lua vim.diagnostic.goto_next()",
},
on_attach = function(client)
utils.format_on_save(client)
require("illuminate").on_attach(client)
lsp_status.on_attach(client)
end,
capabilities = vim.tbl_extend("keep", vim.lsp.protocol.make_client_capabilities(), lsp_status.capabilities),
servers = {
ansiblels = {},
bashls = {},
dockerls = {},
eslint = {},
jsonls = {},
pylsp = {},
rnix = {},
rust_analyzer = require("nvim-lsp-setup.rust-tools").setup({
server = {
settings = {
["rust-analyzer"] = {
cargo = {
loadOutDirsFromCheck = true,
},
checkOnSave = { command = "clippy" },
procMacro = {
enable = true,
},
},
},
},
}),
sumneko_lua = require('lua-dev').setup({}),
taplo = {},
terraformls = {},
tflint = {},
volar = {},
yamlls = {},
},
})

7
nvim/lualine.lua Normal file
View File

@ -0,0 +1,7 @@
require('lualine').setup({
options = { globalstatus = true },
sections = {
lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" }
},
extensions = { "toggleterm" }
})

1
nvim/luasnip.lua Normal file
View File

@ -0,0 +1 @@
require("luasnip.loaders.from_vscode").lazy_load()

2
nvim/notify.lua Normal file
View File

@ -0,0 +1,2 @@
require("notify").setup({ stages = "fade" })
vim.notify = require("notify")

1
nvim/tabline.lua Normal file
View File

@ -0,0 +1 @@
require('tabline').setup({ enable = true, options = { show_bufnr = true, show_filename_only = true } })

View File

@ -1,2 +1,2 @@
vim.opt.background = 'dark'
vim.opt.background = 'light'
vim.cmd("colorscheme solarized")

1
nvim/toggleterm.lua Normal file
View File

@ -0,0 +1 @@
require("toggleterm").setup({ size = 32, open_mapping = [[<F4>]] })