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-". -- 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', '', vim.lsp.completion.get, {}) vim.keymap.set('i', '', "", {}) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {}) vim.keymap.set('n', 'gr', vim.lsp.buf.references, {}) vim.keymap.set('n', '', vim.lsp.buf.rename, {}) vim.keymap.set('n', '', vim.lsp.buf.code_action, {}) vim.keymap.set('n', 'q', ':q', {}) vim.keymap.set('n', 'w', ':w', {}) vim.keymap.set('n', 'c', ':noh', {}) vim.keymap.set('n', 'en', vim.diagnostic.goto_next, {}) vim.keymap.set('n', 'ep', vim.diagnostic.goto_prev, {}) vim.keymap.set('n', 'ff', ":Pick files", {}) vim.keymap.set('n', 'fg', ":Pick grep", {}) -- vim.keymap.set('n', 'fb', telescope.buffers, {}) vim.keymap.set('n', 'fh', ":Pick help", {}) vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" })