From 6c9250d1da310f230bba81bfbcb8a8e10b4a0069 Mon Sep 17 00:00:00 2001 From: anth64 Date: Wed, 16 Apr 2025 07:41:42 +0200 Subject: [PATCH] Squashed commit of the following: commit 7322bc0f73a1294fcf72bf53ee88bf413aa6f05e Author: anth64 Date: Tue Apr 15 22:21:09 2025 +0200 use lspconfig commit 5577628a22b990057240de05b8992800cba31191 Author: anth64 Date: Tue Apr 15 20:08:14 2025 +0200 reorderd lazy and config commit 7f1a3b82daf846d6bc350ab2304469474371705c Author: anth64 Date: Tue Apr 15 19:29:43 2025 +0200 add colorschemes, default to moonfly commit 466c8cf410b8d64cfe252d6dea474cde81eabcca Author: anth64 Date: Tue Apr 15 18:51:56 2025 +0200 make it work on windows as well commit a9d9c2199df869b17182f82fed768c1ea6c1a131 Author: anth64 Date: Fri Apr 11 07:26:54 2025 +0200 added jdtls and newline to end of files commit 4db9e65e6f0e9a7e3857a3b49cef609c55fcfd34 Author: anth64 Date: Thu Apr 10 22:33:16 2025 +0200 remove redundant remap of mapleader commit bb0ad9af1b78c8feb51b8a46e99654b789f1ffdc Author: anth64 Date: Thu Apr 10 22:28:45 2025 +0200 readd telescope and harpoon commit 1a56e26e6b4f3548913b8ebebf074fa33dc60f1d Author: anth64 Date: Thu Apr 10 22:20:12 2025 +0200 redid mapping, set and util, also readded nvim-cmp and cmp-nvim-lsp commit 690e575c030cafa07f718ba5e0ac57d02823f3eb Author: anth64 Date: Wed Apr 9 23:23:51 2025 +0200 make sure that colorscheme is not touched commit 0ab0b593f23401ba6b6524eef9c18e3a244573ef Author: anth64 Date: Wed Apr 9 22:56:58 2025 +0200 add lazy.nvim and lualine plugin commit a8dd286e39145480d279e81a89b9437534d05d9e Author: anth64 Date: Wed Apr 9 07:59:00 2025 +0200 initial configuration --- README.md | 1 + ftplugin/java.lua | 5 +-- init.lua | 17 ++++++++- lua/config/lazy.lua | 3 +- lua/config/remap.lua | 2 +- lua/config/set.lua | 27 ++++---------- lua/plugins/lsp.lua | 80 ++++-------------------------------------- lua/plugins/util.lua | 75 ++++++++++++++++++++------------------- lua/plugins/visual.lua | 26 ++++++-------- 9 files changed, 83 insertions(+), 153 deletions(-) diff --git a/README.md b/README.md index 36d5210..42f4fe3 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,4 @@ [ripgrep](https://github.com/BurntSushi/ripgrep) is required for this to work. My configuration for Neovim. + diff --git a/ftplugin/java.lua b/ftplugin/java.lua index d2abac8..c4a676a 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -1,5 +1,6 @@ local config = { - cmd = { os.getenv('HOME') .. '/.local/share/java/jdtls/bin/jdtls' }, - root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw' }, { upward = true })[1]), + cmd = { os.getenv('HOME') .. '/.local/share/java/jdtls/bin/jdtls' }, + root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw' }, { upward = true })[1]), } require('jdtls').start_or_attach(config) + diff --git a/init.lua b/init.lua index 7861bed..273cd8d 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,18 @@ +require("config.lazy") require("config.set") require("config.remap") -require("config.lazy") + +vim.api.nvim_create_autocmd('LspAttach', { + callback = function(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client:supports_method('textDocument/completion') then + vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true }) + end + end, +}) + +vim.lsp.enable({'basedpyright', 'lua_ls', 'yamlls'}) + +vim.cmd("set completeopt+=noselect") +vim.o.winborder='rounded' + diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index f5ee74c..11eda4a 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -28,8 +28,7 @@ require("lazy").setup({ { import = "plugins" }, }, -- Configure any other settings here. See the documentation for more details. - -- colorscheme that will be used when installing plugins. - install = { colorscheme = { "habamax" } }, -- automatically check for plugin updates checker = { enabled = true }, }) + diff --git a/lua/config/remap.lua b/lua/config/remap.lua index b760350..cb8a0cf 100644 --- a/lua/config/remap.lua +++ b/lua/config/remap.lua @@ -1,2 +1,2 @@ -vim.g.mapleader = " " vim.keymap.set("n", "pv", vim.cmd.Ex) + diff --git a/lua/config/set.lua b/lua/config/set.lua index 8f4433b..9434081 100644 --- a/lua/config/set.lua +++ b/lua/config/set.lua @@ -1,29 +1,15 @@ -vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { - group = vim.api.nvim_create_augroup("float_diagnostic_cursor", { clear = true }), - callback = function () - vim.diagnostic.open_float(nil, {focus=false, scope="cursor"}) - end -}) - -vim.opt.shell="zsh" -vim.opt.fileformat="unix" -vim.opt.fileformats="unix" +vim.opt.shell = "zsh" +vim.opt.fileformat = "unix" +vim.opt.fileformats = "unix" vim.opt.cmdheight = 0 vim.opt.guicursor = "" vim.opt.mouse = "" -vim.opt.nu = true +vim.opt.number = true vim.opt.relativenumber = true -vim.opt.tabstop = 2 -vim.opt.softtabstop = 2 -vim.opt.shiftwidth = 2 -vim.opt.expandtab = true - vim.opt.smartindent = true -vim.opt.wrap = false - vim.opt.swapfile = false vim.opt.backup = false local home = os.getenv("HOME") or os.getenv("USERPROFILE") @@ -34,6 +20,7 @@ vim.opt.hlsearch = false vim.opt.incsearch = true vim.opt.termguicolors = true + vim.opt.scrolloff = 8 vim.opt.signcolumn = "yes" vim.opt.isfname:append("@-@") @@ -41,7 +28,7 @@ vim.opt.isfname:append("@-@") vim.opt.updatetime = 50 vim.opt.colorcolumn = "80" - vim.g.c_syntax_for_h = 1 -vim.g.mapleader = " " + +vim.cmd.colorscheme("moonfly") diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index bfba5f6..bd83f07 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,76 +1,8 @@ return { - { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, - { "mfussenegger/nvim-jdtls" }, - { - "neovim/nvim-lspconfig", - config = function() - local lspconfig = require("lspconfig") - lspconfig.lua_ls.setup {} - lspconfig.ccls.setup {} - lspconfig.basedpyright.setup { - settings = { - basedpyright = { - analysis = { - typeCheckingMode = "basic", - inlayHints = { callArgumentNames = true } - } - } - } - } - lspconfig.yamlls.setup {} - end, - }, - { - "VonHeikemen/lsp-zero.nvim", - dependencies = { - "neovim/nvim-lspconfig", - "hrsh7th/nvim-cmp", - "hrsh7th/cmp-nvim-lsp" - }, - config = function() - vim.opt.signcolumn = 'yes' - - local lspconfig_defaults = require('lspconfig').util.default_config - lspconfig_defaults.capabilities = vim.tbl_deep_extend( - 'force', - lspconfig_defaults.capabilities, - require('cmp_nvim_lsp').default_capabilities() - ) - - vim.api.nvim_create_autocmd('LspAttach', { - desc = 'LSP actions', - callback = function(event) - local opts = { buffer = event.buf } - - vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) - vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) - vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) - vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) - vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) - vim.keymap.set({ 'n', 'x' }, '', 'lua vim.lsp.buf.format({async = true})', opts) - vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) - end, - }) - - local lspconfig = require('lspconfig') - lspconfig.lua_ls.setup{} - - local cmp = require('cmp') - - cmp.setup({ - sources = { - { name = 'nvim_lsp' }, - }, - snippet = { - expand = function(args) - vim.snippet.expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({}), - }) - end, - } + { "neovim/nvim-lspconfig" }, + { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, + { "hrsh7th/nvim-cmp" }, + { "hrsh7th/cmp-nvim-lsp" }, + { "mfussenegger/nvim-jdtls" } -- jdtls bindings for neovim } + diff --git a/lua/plugins/util.lua b/lua/plugins/util.lua index a08737e..6ae9445 100644 --- a/lua/plugins/util.lua +++ b/lua/plugins/util.lua @@ -1,41 +1,42 @@ return { - { - "theprimeagen/harpoon", - config = function() - local mark = require("harpoon.mark") - local ui = require("harpoon.ui") + { + "mbbill/undotree", + config = function() + vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + end, + }, + { + "tpope/vim-fugitive", + config = function() + vim.keymap.set("n", "gs", vim.cmd.Git) + end, + }, + { + "nvim-telescope/telescope.nvim", + dependencies = {"nvim-lua/plenary.nvim"}, + config = function() + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'pf', builtin.find_files, {}) + vim.keymap.set('n', '', builtin.git_files, {}) + vim.keymap.set('n', 'ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }); + end) + end, + }, + { + "theprimeagen/harpoon", + config = function() + local mark = require("harpoon.mark") + local ui = require("harpoon.ui") - vim.keymap.set("n", "a", mark.add_file) - vim.keymap.set("n", "", ui.toggle_quick_menu) + vim.keymap.set("n", "a", mark.add_file) + vim.keymap.set("n", "", ui.toggle_quick_menu) - vim.keymap.set("n", "", function() ui.nav_file(1) end) - vim.keymap.set("n", "", function() ui.nav_file(2) end) - vim.keymap.set("n", "", function() ui.nav_file(3) end) - vim.keymap.set("n", "", function() ui.nav_file(4) end) - end, - }, - { - "mbbill/undotree", - config = function() - vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) - end, - }, - { - "tpope/vim-fugitive", - config = function() - vim.keymap.set("n", "gs", vim.cmd.Git) - end, - }, - { - "nvim-telescope/telescope.nvim", - dependencies = {"nvim-lua/plenary.nvim"}, - config = function() - local builtin = require('telescope.builtin') - vim.keymap.set('n', 'pf', builtin.find_files, {}) - vim.keymap.set('n', '', builtin.git_files, {}) - vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }); - end) - end, - } + vim.keymap.set("n", "", function() ui.nav_file(1) end) + vim.keymap.set("n", "", function() ui.nav_file(2) end) + vim.keymap.set("n", "", function() ui.nav_file(3) end) + vim.keymap.set("n", "", function() ui.nav_file(4) end) + end + } } + diff --git a/lua/plugins/visual.lua b/lua/plugins/visual.lua index d096778..488302e 100644 --- a/lua/plugins/visual.lua +++ b/lua/plugins/visual.lua @@ -1,20 +1,14 @@ return { { - "oxfist/night-owl.nvim", - lazy = false, -- make sure we load this during startup if it is your main colorscheme - priority = 1000, -- make sure to load this before all the other start plugins - config = function() - -- load the colorscheme here - require("night-owl").setup() - vim.cmd.colorscheme("night-owl") - end, + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + lazy = false, + config = function() + require("lualine").setup() + end, }, - { - "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - lazy = false, - config = function() - require("lualine").setup() - end, - } + { "bluz71/vim-moonfly-colors", lazy = false }, + { "EdenEast/nightfox.nvim", lazy = false }, + { "oxfist/night-owl.nvim", lazy = false }, } +