195 lines
5.1 KiB
Lua
195 lines
5.1 KiB
Lua
vim.opt.number = true
|
|
vim.opt.relativenumber = true
|
|
vim.opt.smartcase = true
|
|
vim.opt.ignorecase = true
|
|
vim.opt.ts = 4
|
|
vim.opt.sw = 0
|
|
vim.opt.foldmethod = "indent"
|
|
vim.opt.foldlevel = 99
|
|
vim.opt.clipboard = "unnamedplus"
|
|
vim.opt.signcolumn = "yes"
|
|
vim.opt.termguicolors = true
|
|
|
|
vim.pack.add({
|
|
{ src = "https://github.com/stevearc/oil.nvim" },
|
|
{ src = "https://github.com/echasnovski/mini.pick" },
|
|
{ src = "https://github.com/echasnovski/mini.icons" },
|
|
{ src = "https://github.com/nvim-treesitter/nvim-treesitter" },
|
|
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
|
{ src = "https://github.com/sainnhe/everforest" },
|
|
{ src = "https://github.com/nvim-lualine/lualine.nvim" },
|
|
-- currently not working, see https://github.com/laytan/tailwind-sorter.nvim/issues/114
|
|
-- { src = "https://github.com/laytan/tailwind-sorter.nvim" },
|
|
-- { src = "https://github.com/nvim-lua/plenary.nvim" }, -- required by tailwind-sorter
|
|
|
|
-- autoclosing tags
|
|
{ src = "https://github.com/windwp/nvim-ts-autotag" },
|
|
{ src = "https://github.com/terrortylor/nvim-comment" },
|
|
-- required by nvim-comment
|
|
{ src = "https://github.com/JoosepAlviste/nvim-ts-context-commentstring" },
|
|
|
|
-- java support
|
|
{ src = "https://github.com/mfussenegger/nvim-jdtls" }
|
|
})
|
|
|
|
require('nvim_comment').setup({
|
|
hook = function()
|
|
require('ts_context_commentstring.internal').update_commentstring()
|
|
end,
|
|
})
|
|
|
|
|
|
require('nvim-ts-autotag').setup()
|
|
|
|
-- local function hello()
|
|
-- local x = vim.fn["nvim_treesitter#statusline(90)"]()
|
|
-- -- print(x)
|
|
-- return "test"
|
|
-- end
|
|
require('lualine').setup({
|
|
options = {
|
|
theme = "everforest",
|
|
},
|
|
-- sections = {
|
|
-- -- lualine_a = { 'mode' },
|
|
-- -- lualine_b = { 'branch', 'diff', 'diagnostics' },
|
|
-- -- lualine_c = { 'filename' },
|
|
-- lualine_c = { 'filename', hello },
|
|
-- -- lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
|
-- -- lualine_y = { 'progress' },
|
|
-- -- lualine_z = { 'location' }
|
|
-- },
|
|
})
|
|
|
|
vim.cmd([[colorscheme everforest]])
|
|
require('mini.icons').setup()
|
|
|
|
|
|
require('oil').setup({
|
|
view_options = {
|
|
show_hidden = true,
|
|
sort = {
|
|
{ "type", "asc" },
|
|
{ "name", "asc" },
|
|
},
|
|
},
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
callback = function(ev)
|
|
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
|
if client == nil then
|
|
return
|
|
end
|
|
if client:supports_method('textDocument/completion') then
|
|
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
|
|
end
|
|
|
|
if client:supports_method("textDocument/inlayHint") or client.server_capabilities.inlayHintProvider then
|
|
vim.lsp.inlay_hint.enable(true, { bufnr = ev.buf })
|
|
end
|
|
end,
|
|
})
|
|
vim.cmd("set completeopt+=menuone,noselect,popup")
|
|
|
|
vim.lsp.config('gopls', {
|
|
settings = {
|
|
['gopls'] = {
|
|
hints = {
|
|
assignVariableTypes = true,
|
|
parameterNames = true
|
|
}
|
|
},
|
|
},
|
|
})
|
|
vim.lsp.config('tailwindcss', {
|
|
settings = {
|
|
tailwindCSS = {
|
|
colorDecorators = false
|
|
},
|
|
}
|
|
})
|
|
vim.lsp.config('lua_ls', {
|
|
settings = {
|
|
Lua = {
|
|
runtime = {
|
|
version = 'LuaJIT',
|
|
},
|
|
workspace = {
|
|
library = vim.api.nvim_get_runtime_file("", true),
|
|
}
|
|
},
|
|
}
|
|
})
|
|
vim.lsp.config('jdtls', {
|
|
cmd = { "jdtls", "--jvm-arg=-javaagent:/usr/share/java/lombok/lombok.jar" }
|
|
})
|
|
vim.lsp.enable({ "lua_ls", "gopls", "templ", "ts_ls", "tailwindcss", "bashls", "jdtls" })
|
|
|
|
-- Enables filtered completions for tailwindcss class names, e.g. "mt-<C-n>".
|
|
-- Otherwise the completion contains EVERYTHING
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = { "html", "templ", "javascript", "typescript", "css" },
|
|
callback = function()
|
|
vim.opt_local.iskeyword:append("-")
|
|
end,
|
|
})
|
|
|
|
require "mini.pick".setup()
|
|
require "nvim-treesitter.configs".setup({
|
|
auto_install = true,
|
|
highlight = {
|
|
enable = true,
|
|
},
|
|
incremental_selection = {
|
|
enable = true,
|
|
}
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
desc = 'Hightlight selection on yank',
|
|
pattern = '*',
|
|
callback = function()
|
|
vim.highlight.on_yank { higroup = 'IncSearch', timeout = 500 }
|
|
end,
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
desc = 'Atuformat code on save',
|
|
pattern = '*',
|
|
callback = function()
|
|
vim.lsp.buf.format()
|
|
end,
|
|
})
|
|
|
|
|
|
-- require('tailwind-sorter').setup({
|
|
-- on_save_enabled = true,
|
|
-- on_save_pattern = { '*.html' },
|
|
-- trim_spaces = false,
|
|
-- })
|
|
|
|
vim.filetype.add({ extension = { templ = "templ" } })
|
|
|
|
vim.g.mapleader = " "
|
|
|
|
vim.keymap.set('i', '<C-n>', vim.lsp.completion.get, {})
|
|
vim.keymap.set('i', '<C-z>', "<C-y>", {})
|
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
|
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, {})
|
|
vim.keymap.set('n', '<F2>', vim.lsp.buf.rename, {})
|
|
vim.keymap.set('n', '<F4>', vim.lsp.buf.code_action, {})
|
|
|
|
vim.keymap.set('n', '<leader>q', ':q<CR>', {})
|
|
vim.keymap.set('n', '<leader>w', ':w<CR>', {})
|
|
vim.keymap.set('n', '<leader>c', ':noh<CR>', {})
|
|
vim.keymap.set('n', '<leader>en', vim.diagnostic.goto_next, {})
|
|
vim.keymap.set('n', '<leader>ep', vim.diagnostic.goto_prev, {})
|
|
|
|
vim.keymap.set('n', '<leader>ff', ":Pick files<CR>", {})
|
|
vim.keymap.set('n', '<leader>fg', ":Pick grep<CR><CR>", {})
|
|
-- vim.keymap.set('n', '<leader>fb', telescope.buffers, {})
|
|
vim.keymap.set('n', '<leader>fh', ":Pick help<CR>", {})
|
|
|
|
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
|