diff --git a/nvim/init.lua b/nvim/init.lua deleted file mode 100644 index bba3837..0000000 --- a/nvim/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -require('user.plugins') -require('user.options') -require('user.lsp') -require('user.dap') -require('user.bindings') diff --git a/nvim/init.vim b/nvim/init.vim new file mode 100644 index 0000000..db70da4 --- /dev/null +++ b/nvim/init.vim @@ -0,0 +1,55 @@ +filetype plugin on +syntax on +set number +set nowrap +set wildmode=longest,list +set colorcolumn=120 +let $NVIM_TUI_ENABLE_TRUE_COLOR=1 +let g:gruvbox_contrast_dark='hard' +let g:gruvbox_hls_cursor='red' +set tabpagemax=500 + +" Indentation +set smartindent +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab +set cursorcolumn +set cursorline + +" Search +set incsearch +set hlsearch +set ignorecase +set smartcase + +" Whitespaces +set listchars=tab:>-,trail:· +set list + +" Terminal mode +:tnoremap + +" File handling +set hidden + +" Custom shortcuts +map gb :bn +map gB :bp +map g# :b# + +" Close the completion preview window (docstring) automatically +autocmd CompleteDone * pclose + +" LSP config +lua <"] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ select = false }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "buffer" }, - { name = "path" }, - }), -}) + cmp.setup({ + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ select = false }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "buffer" }, + { name = "path" }, + }), + }) + + vim.cmd([[ + set completeopt=menuone,noinsert,noselect + highlight! default link CmpItemKind CmpItemMenuDefault + ]]) + end, +} diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..c2b976a --- /dev/null +++ b/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,14 @@ +return { + { + "ellisonleao/gruvbox.nvim", + priority = 1000 , + config = true, + init = function() + require("gruvbox").setup({ + contrast = "hard", + hls_cursor = "red", + }) + vim.cmd("colorscheme gruvbox") + end + } +} diff --git a/nvim/lua/plugins/dap-go.lua b/nvim/lua/plugins/dap-go.lua index 776ed00..33adaa6 100644 --- a/nvim/lua/plugins/dap-go.lua +++ b/nvim/lua/plugins/dap-go.lua @@ -1,5 +1,11 @@ -vim.pack.add({ - gh("leoluz/nvim-dap-go"), -}) - -require('dap-go').setup() +return { + "leoluz/nvim-dap-go", + dependencies = { + "https://codeberg.org/mfussenegger/nvim-dap", + }, + lazy = true, + ft = { "go" }, + config = function() + require('dap-go').setup() + end, +} diff --git a/nvim/lua/plugins/dap-ui.lua b/nvim/lua/plugins/dap-ui.lua new file mode 100644 index 0000000..9a9a2c4 --- /dev/null +++ b/nvim/lua/plugins/dap-ui.lua @@ -0,0 +1,31 @@ +return { + "rcarriga/nvim-dap-ui", + dependencies = { + "nvim-neotest/nvim-nio", + { + "theHamsta/nvim-dap-virtual-text", + opts = {}, + }, + }, + lazy = true, + ft = { "java", "go", "python" }, + keys = { + { "du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, + { "de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, + }, + opts = {}, + config = function(_, opts) + local dap = require("dap") + local dapui = require("dapui") + dapui.setup(opts) + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open({}) + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close({}) + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close({}) + end + end, +} diff --git a/nvim/lua/plugins/dap.lua b/nvim/lua/plugins/dap.lua index e2ee74b..6642065 100644 --- a/nvim/lua/plugins/dap.lua +++ b/nvim/lua/plugins/dap.lua @@ -1,20 +1,37 @@ -vim.pack.add({ - cb("mfussenegger/nvim-dap"), - gh("rcarriga/nvim-dap-ui"), - gh("theHamsta/nvim-dap-virtual-text"), - gh("rcarriga/nvim-dap-ui"), - gh("nvim-neotest/nvim-nio"), -}) - -local dap = require("dap") -local dapui = require("dapui") -dapui.setup(opts) -dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open({}) -end -dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close({}) -end -dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close({}) -end +return { + "https://codeberg.org/mfussenegger/nvim-dap", + lazy = true, + ft = { "java", "go", "python" }, + dependencies = { + "rcarriga/nvim-dap-ui", + { + "theHamsta/nvim-dap-virtual-text", + opts = {}, + }, + }, + keys = { + { "", function() require("dap").continue() end, desc = "Continue" }, + { "", function() require("dap").step_over() end, desc = "Step over" }, + { "", function() require("dap").step_into() end, desc = "Step into" }, + { "", function() require("dap").step_out() end, desc = "Step out" }, + { "b", function() require("dap").toggle_breakpoint() end, desc = "Toggle " }, + { "d", "", desc = "+debug", mode = {"n", "v"} }, + { "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, + { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, + { "dc", function() require("dap").continue() end, desc = "Continue" }, + { "da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" }, + { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, + { "dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" }, + { "di", function() require("dap").step_into() end, desc = "Step Into" }, + { "dj", function() require("dap").down() end, desc = "Down" }, + { "dk", function() require("dap").up() end, desc = "Up" }, + { "dl", function() require("dap").run_last() end, desc = "Run Last" }, + { "do", function() require("dap").step_out() end, desc = "Step Out" }, + { "dO", function() require("dap").step_over() end, desc = "Step Over" }, + { "dp", function() require("dap").pause() end, desc = "Pause" }, + { "dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, + { "ds", function() require("dap").session() end, desc = "Session" }, + { "dt", function() require("dap").terminate() end, desc = "Terminate" }, + { "dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, + }, +} diff --git a/nvim/lua/plugins/gitsigns.lua b/nvim/lua/plugins/gitsigns.lua index 132b683..3ca0639 100644 --- a/nvim/lua/plugins/gitsigns.lua +++ b/nvim/lua/plugins/gitsigns.lua @@ -1,5 +1,6 @@ -vim.pack.add({ - gh("lewis6991/gitsigns.nvim"), -}) - -require("gitsigns").setup() +return { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup() + end +} diff --git a/nvim/lua/plugins/gruvbox.lua b/nvim/lua/plugins/gruvbox.lua deleted file mode 100644 index 55206c1..0000000 --- a/nvim/lua/plugins/gruvbox.lua +++ /dev/null @@ -1,8 +0,0 @@ -vim.pack.add({ - gh("ellisonleao/gruvbox.nvim"), -}) - -require("gruvbox").setup({ - contrast = "hard", - hls_cursor = "red", -}) diff --git a/nvim/lua/plugins/jdtls.lua b/nvim/lua/plugins/jdtls.lua index b9a8df2..3b5f99d 100644 --- a/nvim/lua/plugins/jdtls.lua +++ b/nvim/lua/plugins/jdtls.lua @@ -1,3 +1,27 @@ -vim.pack.add({ - cb("mfussenegger/nvim-jdtls"), -}) +return { + "https://codeberg.org/mfussenegger/nvim-jdtls", + lazy = true, + ft = { "java" }, + config = function() + local dap = require('dap') + dap.configurations.java = {{ + type = 'java', + request = 'attach', + name = 'Debug (Attach) port 5005', + hostName = '127.0.0.1', + port = 5005, + },{ + type = 'java', + request = 'attach', + name = 'Debug (Attach) port 5006', + hostName = '127.0.0.1', + port = 5006, + },{ + type = 'java', + request = 'attach', + name = 'Debug (Attach) port 5105', + hostName = '127.0.0.1', + port = 5105, + }} + end, +} diff --git a/nvim/lua/plugins/lspconfig.lua b/nvim/lua/plugins/lspconfig.lua index f2453cf..9803cc5 100644 --- a/nvim/lua/plugins/lspconfig.lua +++ b/nvim/lua/plugins/lspconfig.lua @@ -1,3 +1,127 @@ -vim.pack.add({ - gh("neovim/nvim-lspconfig"), -}) +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + }, + keys = { + { "e", vim.diagnostic.open_float }, + { "[d", vim.diagnostic.goto_prev }, + { "]d", vim.diagnostic.goto_next }, + { "q", vim.diagnostic.setloclist }, + { "gD", vim.lsp.buf.declaration }, + { "gd", vim.lsp.buf.definition }, + { "K", vim.lsp.buf.hover }, + { "gi", vim.lsp.buf.implementation }, + { "", vim.lsp.buf.signature_help }, + { "D", vim.lsp.buf.type_definition }, + { "rn", vim.lsp.buf.rename }, + { "ca", vim.lsp.buf.code_action }, + { "gr", vim.lsp.buf.references }, + { + "f", + function() + vim.lsp.buf.format { async = true } + end + }, + }, + config = function() + + local on_attach = function(client, bufnr) + -- Format on save + if client.server_capabilities.documentFormattingProvider then + vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("Format", { clear = true }), + buffer = bufnr, + callback = function() + vim.lsp.buf.format() + end, + }) + end + end + + -- Typos + vim.lsp.config("typos_lsp", { + settings = { + filetypes = { + 'java', + 'go' + }, + }, + init_options = { + diagnosticSeverity = "Hint", + } + }) + + -- HTML + vim.lsp.enable('html') + + -- CSS + vim.lsp.enable('cssls') + + -- JSON + vim.lsp.enable('jsonls') + + -- Python + vim.lsp.enable('pylsp') + + -- Go + vim.lsp.config("gopls", { + settings = { + gopls = { + gofumpt = true, + staticcheck = true, + analyses = { + unusedparams = true, + unusedresult = true, + unusedwrite = true, + unusedvariable = true, + useany = true, + fieldalignment = false, + nilness = true, + shadow = true, + }, + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, + }, + codelenses = { + gc_details = true, + generate = true, + regenerate_cgo = true, + tidy = true, + upgrade_dependency = true, + vendor = true, + }, + }, + }, + }) + -- Organize imports and format code on save + vim.api.nvim_create_autocmd({"BufWritePre"}, { + pattern = "*.go", + callback = function() + local params = vim.lsp.util.make_range_params() + params.context = {only = {"source.organizeImports"}} + local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params) + for cid, res in pairs(result or {}) do + for _, r in pairs(res.result or {}) do + if r.edit then + local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16" + vim.lsp.util.apply_workspace_edit(r.edit, enc) + end + end + end + vim.lsp.buf.format({async = false}) + end + }) + vim.lsp.enable('gopls') + + -- PHP + vim.lsp.enable('phpactor') + end, +} diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua index 5727aa8..473c340 100644 --- a/nvim/lua/plugins/lualine.lua +++ b/nvim/lua/plugins/lualine.lua @@ -1,5 +1,7 @@ -vim.pack.add({ - gh("nvim-lualine/lualine.nvim"), -}) - -require("lualine").setup() +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("lualine").setup() + end, +} diff --git a/nvim/lua/plugins/neo-tree.lua b/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..db38ff2 --- /dev/null +++ b/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,21 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + keys = { + { "tt", "Neotree toggle", desc = "NeoTree toggle" }, + { "tr", "Neotree reveal", desc = "NeoTree reveal" }, + }, + config = function() + require("neo-tree").setup({ + window = { + position = "left", + width = 50, + }, + }) + end +} diff --git a/nvim/lua/plugins/neotree.lua b/nvim/lua/plugins/neotree.lua deleted file mode 100644 index e117998..0000000 --- a/nvim/lua/plugins/neotree.lua +++ /dev/null @@ -1,16 +0,0 @@ -vim.pack.add({ - { - src = gh("nvim-neo-tree/neo-tree.nvim"), - version = vim.version.range("3") - }, - gh("nvim-lua/plenary.nvim"), - gh("MunifTanjim/nui.nvim"), - gh("nvim-tree/nvim-web-devicons"), -}) - -require("neo-tree").setup({ - window = { - position = "left", - width = 50, - }, -}) diff --git a/nvim/lua/plugins/sonarlint.lua b/nvim/lua/plugins/sonarlint.lua index 1b8ddc7..8f7c2cf 100644 --- a/nvim/lua/plugins/sonarlint.lua +++ b/nvim/lua/plugins/sonarlint.lua @@ -1,33 +1,38 @@ -vim.pack.add({ - gl("schrieveslaach/sonarlint.nvim"), -}) - -require('sonarlint').setup({ - server = { - cmd = { - 'sonarlint-ls', - '-stdio', - '-analyzers', - "/usr/share/java/sonarlint-ls/analyzers/sonarjava.jar", - "/usr/share/java/sonarlint-ls/analyzers/sonargo.jar", - "/usr/share/java/sonarlint-ls/analyzers/sonarhtml.jar", - "/usr/share/java/sonarlint-ls/analyzers/sonarpython.jar", - "/usr/share/java/sonarlint-ls/analyzers/sonarphp.jar", - }, - settings = { - sonarlint = { - test = "test", - disableTelemetry = true, - focusOnNewCode = true, - showAnalyzerLogs = true, - }, - }, - }, - filetypes = { - 'java', - 'go', - 'html', - 'python', - "php" - }, -}) +return { + { + url = "https://gitlab.com/schrieveslaach/sonarlint.nvim", + lazy = true, + ft = {"java", "go", "html", "python", "php"}, + config = function() + require('sonarlint').setup({ + server = { + cmd = { + 'sonarlint-ls', + '-stdio', + '-analyzers', + "/usr/share/java/sonarlint-ls/analyzers/sonarjava.jar", + "/usr/share/java/sonarlint-ls/analyzers/sonargo.jar", + "/usr/share/java/sonarlint-ls/analyzers/sonarhtml.jar", + "/usr/share/java/sonarlint-ls/analyzers/sonarpython.jar", + "/usr/share/java/sonarlint-ls/analyzers/sonarphp.jar", + }, + settings = { + sonarlint = { + test = "test", + disableTelemetry = true, + focusOnNewCode = true, + showAnalyzerLogs = true, + }, + }, + }, + filetypes = { + 'java', + 'go', + 'html', + 'python', + "php" + }, + }) + end + } +} diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua index a1d9264..3675166 100644 --- a/nvim/lua/plugins/telescope.lua +++ b/nvim/lua/plugins/telescope.lua @@ -1,12 +1,26 @@ -vim.pack.add({ - gh('nvim-telescope/telescope.nvim'), - gh('nvim-telescope/telescope-ui-select.nvim'), - gh("nvim-lua/plenary.nvim"), -}) - -require("telescope").setup({ - defaults = { - preview = false, +return { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + lazy = false, + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope-ui-select.nvim', }, -}) -require("telescope").load_extension("ui-select") + keys = { + { "", "Telescope" }, + { "", "Telescope buffers", desc = "Find luffers" }, + { "", "Telescope git_files", desc = "Find files" }, + { "", "Telescope lsp_document_symbols", desc = "Find symbols" }, + { "", "lua require('telescope.builtin').diagnostics({severity_limit='WARN'})", desc = "Show errors and warnings" }, + }, + config = function() + local t = require("telescope") + t.setup({ + defaults = { + preview = false, + }, + }) + + t.load_extension("ui-select") + end +} diff --git a/nvim/lua/plugins/todo-comments.lua b/nvim/lua/plugins/todo-comments.lua index 439993e..8e8d8ee 100644 --- a/nvim/lua/plugins/todo-comments.lua +++ b/nvim/lua/plugins/todo-comments.lua @@ -1,6 +1,8 @@ -vim.pack.add({ - gh("folke/todo-comments.nvim"), - gh("nvim-lua/plenary.nvim"), -}) - -require("todo-comments").setup() +return { + "folke/todo-comments.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + opts = { + }, +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index 1b33116..81e10a4 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -1,75 +1,57 @@ -vim.pack.add({ - gh("neovim-treesitter/nvim-treesitter"), -}) +return { + "nvim-treesitter/nvim-treesitter", + event = { + "BufReadPre", + "BufNewFile", + }, + build = ":TSUpdate", + config = function() + local treesitter = require("nvim-treesitter.configs") ---require("nvim-treesitter.configs").setup({ --- highlight = { --- enable = true, --- additional_vim_regex_highlighting = false, --- }, --- indent = { --- enable = true --- }, --- autotag = { --- enable = true, --- }, --- ensure_installed = { --- "json", --- "javascript", --- "yaml", --- "html", --- "http", --- "css", --- "markdown", --- "markdown_inline", --- "bash", --- "lua", --- "vim", --- "gitignore", --- "go", --- }, --- incremental_selection = { --- enable = true, --- keymaps = { --- init_selection = "", --- node_incremental = "", --- scope_incremental = false, --- node_decremental = "", --- }, --- }, --- rainbow = { --- enable = true, --- disable = { "html" }, --- extended_mode = false, --- max_file_lines = nil, --- }, --- context_commentstring = { --- enable = true, --- enable_autocmd = false, --- }, ---}) -require("nvim-treesitter").install { - "fish", - "lua", - "gitcommit", - "gitignore", - "http", - "html", - "css", - "javascript", - "json", - "yaml", - "markdown", - "markdown_inline", - "go", -} - -vim.api.nvim_create_autocmd("FileType", { - pattern = { "http", "html", "go" }, - callback = function() - vim.treesitter.start() - --vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" - --vim.wo.foldmethod = "expr" - vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + treesitter.setup({ + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true + }, + autotag = { + enable = true, + }, + ensure_installed = { + "json", + "javascript", + "yaml", + "html", + "css", + "markdown", + "markdown_inline", + "bash", + "lua", + "vim", + "gitignore", + "go", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + rainbow = { + enable = true, + disable = { "html" }, + extended_mode = false, + max_file_lines = nil, + }, + context_commentstring = { + enable = true, + enable_autocmd = false, + }, + }) end, -}) +} diff --git a/nvim/lua/plugins/trouble.lua b/nvim/lua/plugins/trouble.lua index 2cb625b..562539c 100644 --- a/nvim/lua/plugins/trouble.lua +++ b/nvim/lua/plugins/trouble.lua @@ -1,4 +1,87 @@ -vim.pack.add({ - gh("folke/trouble.nvim"), - gh("nvim-tree/nvim-web-devicons"), -}) +return { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "xe", + "Trouble diagnostics filter.severity=vim.diagnostic.severity.ERROR", + desc = "Error Diagnostics (Trouble)", + }, + { + "xE", + "Trouble diagnostics filter.buf=0 filter.severity=vim.diagnostic.severity.ERROR", + desc = "Error Diagnostics (Trouble)", + }, + { + "xw", + "Trouble diagnostics filter.severity=vim.diagnostic.severity.WARN", + desc = "Warning Diagnostics (Trouble)", + }, + { + "xW", + "Trouble diagnostics filter.buf=0 filter.severity=vim.diagnostic.severity.WARN", + desc = "Warning Diagnostics (Trouble)", + }, + { + "xi", + "Trouble diagnostics filter.severity=vim.diagnostic.severity.INFO", + desc = "Info Diagnostics (Trouble)", + }, + { + "xI", + "Trouble diagnostics filter.buf=0 filter.severity=vim.diagnostic.severity.INFO", + desc = "Info Diagnostics (Trouble)", + }, + { + "xh", + "Trouble diagnostics filter.severity=vim.diagnostic.severity.HINT", + desc = "Info Diagnostics (Trouble)", + }, + { + "xH", + "Trouble diagnostics filter.buf=0 filter.severity=vim.diagnostic.severity.HINT", + desc = "Info Diagnostics (Trouble)", + }, + { + "xt", + "Trouble todo", + desc = "TODOs (Trouble)", + }, + { + "xT", + "Trouble todo filter.buf=0", + desc = "TODOs (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, +} diff --git a/nvim/lua/plugins/typos.lua b/nvim/lua/plugins/typos.lua deleted file mode 100644 index b4b7bfc..0000000 --- a/nvim/lua/plugins/typos.lua +++ /dev/null @@ -1,11 +0,0 @@ -vim.lsp.config("typos_lsp", { - settings = { - filetypes = { - 'java', - 'go' - }, - }, - init_options = { - diagnosticSeverity = "Hint", - } -}) diff --git a/nvim/lua/user/bindings.lua b/nvim/lua/user/bindings.lua deleted file mode 100644 index 1eee88d..0000000 --- a/nvim/lua/user/bindings.lua +++ /dev/null @@ -1,77 +0,0 @@ -vim.g.mapleader = " " - --- Navigation -vim.keymap.set('n', 'gb', ':bn') -vim.keymap.set('n', 'gB', ':bp') -vim.keymap.set('n', 'g#', ':b#') -vim.keymap.set("n", "tt", "Neotree toggle") -vim.keymap.set("n", "tr", "Neotree reveal") -vim.keymap.set("n", "", "Telescope") -vim.keymap.set("n", "", "Telescope buffers") -vim.keymap.set("n", "", "Telescope git_files") -vim.keymap.set("n", "", "Telescope lsp_document_symbols") -vim.keymap.set("n", "", "lua require('telescope.builtin').diagnostics({severity_limit='WARN'})") - --- Terminal mode -vim.keymap.set('t', '', '', { noremap = true}) - --- LSP -vim.keymap.set("n", "e", vim.diagnostic.open_float) -vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) -vim.keymap.set("n", "]d", vim.diagnostic.goto_next) -vim.keymap.set("n", "q", vim.diagnostic.setloclist) -vim.keymap.set("n", "gD", vim.lsp.buf.declaration) -vim.keymap.set("n", "gd", vim.lsp.buf.definition) -vim.keymap.set("n", "K", vim.lsp.buf.hover) -vim.keymap.set("n", "gi", vim.lsp.buf.implementation) -vim.keymap.set("n", "", vim.lsp.buf.signature_help) -vim.keymap.set("n", "D", vim.lsp.buf.type_definition) -vim.keymap.set("n", "rn", vim.lsp.buf.rename) -vim.keymap.set("n", "ca", vim.lsp.buf.code_action) -vim.keymap.set("n", "gr", vim.lsp.buf.references) -vim.keymap.set("n", "f", function() vim.lsp.buf.format { async = true } end) -vim.keymap.set("n", "xx", function() require('trouble').toggle({mode="diagnostics"}) end) -vim.keymap.set("n", "xX", function() require('trouble').toggle({mode="diagnostics", filter={buf=0}}) end) -vim.keymap.set("n", "xe", function() require('trouble').toggle({mode="diagnostics", filter={severity=vim.diagnostic.severity.ERROR}}) end) -vim.keymap.set("n", "xE", function() require('trouble').toggle({mode="diagnostics", filter={severity=vim.diagnostic.severity.ERROR, buf=0}}) end) -vim.keymap.set("n", "xw", function() require('trouble').toggle({mode="diagnostics", filter={severity=vim.diagnostic.severity.WARN}}) end) -vim.keymap.set("n", "xW", function() require('trouble').toggle({mode="diagnostics", filter={severity=vim.diagnostic.severity.WARN, buf=0}}) end) -vim.keymap.set("n", "xi", function() require('trouble').toggle({mode="diagnostics", filter={severity=vim.diagnostic.severity.INFO}}) end) -vim.keymap.set("n", "xI", function() require('trouble').toggle({mode="diagnostics", filter={severity=vim.diagnostic.severity.INFO, buf=0}}) end) -vim.keymap.set("n", "xh", function() require('trouble').toggle({mode="diagnostics", filter={severity=vim.diagnostic.severity.HINT}}) end) -vim.keymap.set("n", "xH", function() require('trouble').toggle({mode="diagnostics", filter={severity=vim.diagnostic.severity.HINT, buf=0}}) end) -vim.keymap.set("n", "xt", function() require('trouble').toggle({mode="todo"}) end) -vim.keymap.set("n", "xT", function() require('trouble').toggle({mode="todo", filter={buf=0}}) end) -vim.keymap.set("n", "cs", function() require('trouble').toggle({mode="symbols"}) end) -vim.keymap.set("n", "cl", function() require('trouble').toggle({mode="lsp", win={position="right"}}) end) -vim.keymap.set("n", "xL", function() require('trouble').toggle({mode="loclist"}) end) -vim.keymap.set("n", "xQ", function() require('trouble').toggle({mode="qflist"}) end) - --- DAP -vim.keymap.set("n", "", function() require("dap").continue() end) -vim.keymap.set("n", "", function() require("dap").step_over() end) -vim.keymap.set("n", "", function() require("dap").step_into() end) -vim.keymap.set("n", "", function() require("dap").step_out() end) -vim.keymap.set("n", "b", function() require("dap").toggle_breakpoint() end) -vim.keymap.set({"n", "v"}, "d", "") -vim.keymap.set("n", "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end) -vim.keymap.set("n", "db", function() require("dap").toggle_breakpoint() end) -vim.keymap.set("n", "dc", function() require("dap").continue() end) -vim.keymap.set("n", "da", function() require("dap").continue({ before = get_args }) end) -vim.keymap.set("n", "dC", function() require("dap").run_to_cursor() end) -vim.keymap.set("n", "dg", function() require("dap").goto_() end) -vim.keymap.set("n", "di", function() require("dap").step_into() end) -vim.keymap.set("n", "dj", function() require("dap").down() end) -vim.keymap.set("n", "dk", function() require("dap").up() end) -vim.keymap.set("n", "dl", function() require("dap").run_last() end) -vim.keymap.set("n", "do", function() require("dap").step_out() end) -vim.keymap.set("n", "dO", function() require("dap").step_over() end) -vim.keymap.set("n", "dp", function() require("dap").pause() end) -vim.keymap.set("n", "dr", function() require("dap").repl.toggle() end) -vim.keymap.set("n", "ds", function() require("dap").session() end) -vim.keymap.set("n", "dt", function() require("dap").terminate() end) -vim.keymap.set("n", "dw", function() require("dap.ui.widgets").hover() end) -vim.keymap.set("n", "df", function() require('jdtls').test_class() end) -vim.keymap.set("n", "dn", function() require('jdtls').test_nearest_method() end) -vim.keymap.set("n", "du", function() require("dapui").toggle({ }) end) -vim.keymap.set({"n", "v"}, "de", function() require("dapui").eval() end) diff --git a/nvim/lua/user/dap.lua b/nvim/lua/user/dap.lua deleted file mode 100644 index 07c22e8..0000000 --- a/nvim/lua/user/dap.lua +++ /dev/null @@ -1,21 +0,0 @@ -local dap = require("dap") - -dap.configurations.java = {{ - type = 'java', - request = 'attach', - name = 'Debug (Attach) port 5005', - hostName = '127.0.0.1', - port = 5005, -},{ - type = 'java', - request = 'attach', - name = 'Debug (Attach) port 5006', - hostName = '127.0.0.1', - port = 5006, -},{ - type = 'java', - request = 'attach', - name = 'Debug (Attach) port 5105', - hostName = '127.0.0.1', - port = 5105, -}} diff --git a/nvim/lua/user/lsp.lua b/nvim/lua/user/lsp.lua deleted file mode 100644 index 174bfda..0000000 --- a/nvim/lua/user/lsp.lua +++ /dev/null @@ -1,69 +0,0 @@ ---vim.lsp.inlay_hint.enable() -vim.diagnostic.config({ - virtual_text = true, - --virtual_lines = true, - --virtual_lines = { - -- current_line = true, - --}, - severity_sort = true, -}) -vim.opt.completeopt = { "menuone", "noselect", "popup", "fuzzy" } - -vim.lsp.enable('html') -vim.lsp.enable('cssls') -vim.lsp.enable('jsonls') -vim.lsp.enable('typos_lsp') --- Go -vim.lsp.config("gopls", { - settings = { - gopls = { - gofumpt = true, - staticcheck = true, - analyses = { - unusedparams = true, - unusedresult = true, - unusedwrite = true, - unusedvariable = true, - useany = true, - fieldalignment = false, - nilness = true, - shadow = true, - }, - hints = { - assignVariableTypes = true, - compositeLiteralFields = true, - compositeLiteralTypes = true, - constantValues = true, - functionTypeParameters = true, - parameterNames = true, - rangeVariableTypes = true, - }, - codelenses = { - gc_details = true, - generate = true, - regenerate_cgo = true, - tidy = true, - upgrade_dependency = true, - vendor = true, - }, - }, - }, -}) -vim.api.nvim_create_autocmd({"BufWritePre"}, { - pattern = "*.go", - callback = function() - local params = vim.lsp.util.make_range_params() - params.context = {only = {"source.organizeImports"}} - local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params) - for cid, res in pairs(result or {}) do - for _, r in pairs(res.result or {}) do - if r.edit then - local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16" - vim.lsp.util.apply_workspace_edit(r.edit, enc) - end - end - end - vim.lsp.buf.format({async = false}) - end -}) -vim.lsp.enable('gopls') diff --git a/nvim/lua/user/options.lua b/nvim/lua/user/options.lua deleted file mode 100644 index f7f5aaf..0000000 --- a/nvim/lua/user/options.lua +++ /dev/null @@ -1,38 +0,0 @@ -vim.o.wrap = false -vim.o.number = true -vim.o.wildmode = "longest,list" -vim.o.colorcolumn = "120" -vim.o.tabpagemax = 500 -vim.o.scrolloff = 4; - --- Indentation -vim.o.smartindent = true -vim.o.tabstop = 4 -vim.o.softtabstop = 4 -vim.o.shiftwidth = 4 -vim.o.expandtab = true -vim.o.cursorcolumn = true -vim.o.cursorline = true - --- Search -vim.o.incsearch = true -vim.o.hlsearch = true -vim.o.ignorecase = true -vim.o.smartcase = true - --- Whitespaces -vim.o.listchars = "tab:>-,trail:·" -vim.o.list = true - --- File handling -vim.o.hidden = true - -vim.cmd("syntax enable") -vim.cmd("filetype plugin on") - --- Colorscheme -vim.cmd("colorscheme gruvbox") - --- REST -vim.g.rest_nvim = { -} diff --git a/nvim/lua/user/plugins.lua b/nvim/lua/user/plugins.lua deleted file mode 100644 index f330e80..0000000 --- a/nvim/lua/user/plugins.lua +++ /dev/null @@ -1,19 +0,0 @@ -gh = function(x) return "https://github.com/" .. x end -gl = function(x) return "https://gitlab.com/" .. x end -cb = function(x) return "https://codeberg.org/" .. x end - -require("plugins.gruvbox") -require("plugins.lualine") -require("plugins.neotree") -require("plugins.gitsigns") -require("plugins.telescope") -require("plugins.trouble") -require("plugins.todo-comments") -require("plugins.treesitter") -require("plugins.lspconfig") -require("plugins.typos") -require("plugins.jdtls") -require("plugins.sonarlint") -require("plugins.dap") -require("plugins.dap-go") -require("plugins.cmp") diff --git a/sway/config b/sway/config index 21a9dc9..412391a 100644 --- a/sway/config +++ b/sway/config @@ -106,6 +106,10 @@ bindsym Ctrl+Shift+space exec makoctl dismiss --all # Passmenu bindcode $mod+55 exec gopass ls --flat | bemenu -i -l 10 -m all -p Password: --fn "DejaVu Sans 12" | xargs --no-run-if-empty gopass show -c --nosync +# Timew +bindcode $mod+56 exec ~/.local/bin/timewmenu -i -l 10 -m all -p "Track:" --fn "DejaVu Sans 12" +bindcode $mod+Ctrl+56 exec timew stop + # Resizing containers mode "resize" { bindcode $left resize shrink width 80px @@ -150,23 +154,6 @@ mode "$mode_system" { } bindcode $mod+Shift+55 mode "$mode_system" -# Screenshot -set $mode_screenshot Screenshot (o) output, (a) active, (r) region, (Shift+o) copy output, (Shift+a) copy active, (Shift+r) copy region -mode "$mode_screenshot" { - bindsym o exec 'grimshot save output | xargs -I {} notify-send -t 10000 Screenshot "{}"', mode "default" - bindsym a exec 'grimshot save active | xargs -I {} notify-send -t 10000 Screenshot "{}"', mode "default" - bindsym r exec 'grimshot save area | xargs -I {} notify-send -t 10000 Screenshot "{}"', mode "default" - bindsym Shift+o exec 'grimshot copy output | xargs -I {} notify-send -t 10000 Screenshot "{}"', mode "default" - bindsym Shift+a exec 'grimshot copy active | xargs -I {} notify-send -t 10000 Screenshot "{}"', mode "default" - bindsym Shift+r exec 'grimshot copy area | xargs -I {} notify-send -t 10000 Screenshot "{}"', mode "default" - bindsym Return mode "default" - bindsym mod3+Return mode "default" - bindsym Escape mode "default" - bindsym mod3+Escape mode "default" -} -bindsym $mod+l mode "$mode_screenshot" -bindsym Print exec grimshot save output | xargs -I {} notify-send -t 10000 Screenshot "{}" - # Systemd environment exec "systemctl --user import-environment; systemctl --user start sway-session.target" exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway diff --git a/sway/yuki b/sway/yuki index bcb9310..40e9fac 100644 --- a/sway/yuki +++ b/sway/yuki @@ -1,8 +1,6 @@ # Output configuration output * bg "~/.config/sway/bg.png" fill -output DP-1 resolution 3840x2160 scale 1.5 position 1080,0 color_profile icc "~/.config/sway/yuki.icc" -output HDMI-A-1 resolution 1920x1080 scale 1.0 position 0,-300 transform 90 -output HDMI-A-1 disable +output DP-1 resolution 3840x2160 scale 1.5 position 0,0 color_profile icc "~/.config/sway/yuki.icc" # Input configuration input type:pointer { @@ -11,10 +9,12 @@ input type:pointer { } # Monitor setup -set $mode_monitor Monitor (s) single, (d) dual +set $mode_monitor Monitor (l) single left, (r) single right, (h) dual horizontal, ((v) dual vertical mode "$mode_monitor" { - bindsym s output HDMI-A-1 disable, mode "default" - bindsym d output HDMI-A-1 enable, mode "default" + bindsym l output HDMI-A-1 enable, output DP-1 disable, mode "default" + bindsym r output DP-1 enable position 0 0 transform normal, output HDMI-A-1 disable, mode "default" + bindsym h output HDMI-A-1 enable, output DP-1 enable position 1920 0 transform normal, mode "default" + bindsym v output HDMI-A-1 enable, output DP-1 enable position 1920 -500 transform 270, mode "default" bindsym Return mode "default" bindsym mod3+Return mode "default" bindsym Escape mode "default"