diff --git a/.gitignore b/.gitignore index 9adc0c9..e033bc6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -plugin/packer_compiled.lua -workspace/ +lazy-lock.json diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua deleted file mode 100644 index 20aacec..0000000 --- a/after/plugin/colors.lua +++ /dev/null @@ -1,20 +0,0 @@ -require('tokyonight').setup({ - style = "night", - styles = { - comments = { italic = false }, - keywords = { italic = false } - } -}) - -require('night-owl').setup({ - transparent_background = true -}) - -function ColorMyPencils(color) - color = color or 'default' - vim.cmd.colorscheme(color) - -- vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - -- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) -end - -ColorMyPencils('night-owl') diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua deleted file mode 100644 index 73b78b8..0000000 --- a/after/plugin/fugitive.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set("n", "gs", vim.cmd.Git); diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua deleted file mode 100644 index eed35ed..0000000 --- a/after/plugin/harpoon.lua +++ /dev/null @@ -1,10 +0,0 @@ -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", "", 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) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua deleted file mode 100644 index 3e2715d..0000000 --- a/after/plugin/lsp.lua +++ /dev/null @@ -1,48 +0,0 @@ -local lsp = require('lsp-zero') - -lsp.preset('recommended') -lsp.setup_servers({ - 'basedpyright', - 'bashls', - 'jsonls', - 'ccls', - 'csharp_ls', - 'gopls', - 'html', - 'htmx', - 'lua_ls', - 'ruby_lsp', - 'rust_analyzer', - 'yamlls' -}) - -local cmp = require('cmp') -local cmp_select = { behavior = cmp.SelectBehavior.Select } -local cmp_mappings = lsp.defaults.cmp_mappings({ - [''] = cmp.mapping.select_prev_item(cmp_select), - [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), -}) - -lsp.set_preferences({ - sign_icons = {} -}) - -lsp.setup({ - mapping = cmp_mappings -}) - -lsp.on_attach(function(client, bufnr) - local opts = { buffer = bufnr, remap = false } - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) - vim.keymap.set("n", "vws", function() vim.diagnostic.workspace_symbol() end, opts) - vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) - vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts) - vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) - vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("i", "", function() end, opts) -end) diff --git a/after/plugin/lualine.lua b/after/plugin/lualine.lua deleted file mode 100644 index 90e6db2..0000000 --- a/after/plugin/lualine.lua +++ /dev/null @@ -1 +0,0 @@ -require('lualine').setup() diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua deleted file mode 100644 index 4806008..0000000 --- a/after/plugin/telescope.lua +++ /dev/null @@ -1,6 +0,0 @@ -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) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua deleted file mode 100644 index 0766cca..0000000 --- a/after/plugin/treesitter.lua +++ /dev/null @@ -1,21 +0,0 @@ -require'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" (the five listed parsers should always be installed) - ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "rust", "java", "javascript", "typescript", "bash" }, - - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, - - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, - - highlight = { - enable = true, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, -} diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua deleted file mode 100644 index b6b9276..0000000 --- a/after/plugin/undotree.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/ftplugin/java.lua b/ftplugin/java.lua deleted file mode 100644 index 41785e9..0000000 --- a/ftplugin/java.lua +++ /dev/null @@ -1,5 +0,0 @@ -local config = { - cmd = {'/home/anth/.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 4bbe9f9..5a6ba1e 100644 --- a/init.lua +++ b/init.lua @@ -1 +1,3 @@ -require("anth64") +require("config.set") +require("config.remap") +require("config.lazy") diff --git a/lua/anth64/init.lua b/lua/anth64/init.lua deleted file mode 100644 index 6d26b81..0000000 --- a/lua/anth64/init.lua +++ /dev/null @@ -1,2 +0,0 @@ -require("anth64.set") -require("anth64.remap") diff --git a/lua/anth64/packer.lua b/lua/anth64/packer.lua deleted file mode 100644 index 5984c95..0000000 --- a/lua/anth64/packer.lua +++ /dev/null @@ -1,48 +0,0 @@ --- This file can be loaded by calling `lua require('plugins')` from your init.vim - --- Only required if you have packer configured as `opt` -vim.cmd [[packadd packer.nvim]] - -return require('packer').startup(function(use) - -- Packer can manage itself - use 'wbthomason/packer.nvim' - - use { - 'nvim-telescope/telescope.nvim', tag = '0.1.4', - -- or , branch = '0.1.x', - requires = { {'nvim-lua/plenary.nvim'} } - } - - use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) - use('nvim-treesitter/playground') - use('theprimeagen/harpoon') - use('mbbill/undotree') - use('tpope/vim-fugitive') - use { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v3.x', - requires = { - -- LSP Support - {'neovim/nvim-lspconfig'}, - -- Autocompletion - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'L3MON4D3/LuaSnip'}, - } - } - use('mfussenegger/nvim-jdtls') - -- Color schemes. - use({ - 'folke/tokyonight.nvim', - as = 'tokyonight', - }) - use({ - "oxfist/night-owl.nvim", - as = 'night-owl', - }) - -- Status bar - use { - 'nvim-lualine/lualine.nvim', - requires = { 'nvim-tree/nvim-web-devicons', opt = true } - } -end) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..217aeb7 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { 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/anth64/remap.lua b/lua/config/remap.lua similarity index 97% rename from lua/anth64/remap.lua rename to lua/config/remap.lua index b760350..c488e32 100644 --- a/lua/anth64/remap.lua +++ b/lua/config/remap.lua @@ -1,2 +1,2 @@ -vim.g.mapleader = " " -vim.keymap.set("n", "pv", vim.cmd.Ex) +vim.g.mapleader = " " +vim.keymap.set("n", "pv", vim.cmd.Ex) diff --git a/lua/anth64/set.lua b/lua/config/set.lua similarity index 91% rename from lua/anth64/set.lua rename to lua/config/set.lua index 73e3306..addeab6 100644 --- a/lua/anth64/set.lua +++ b/lua/config/set.lua @@ -1,34 +1,35 @@ -vim.opt.guicursor = "" -vim.opt.mouse = "" - -vim.opt.nu = 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 -vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" -vim.opt.undofile = true - -vim.opt.hlsearch = false -vim.opt.incsearch = true - -vim.opt.termguicolors = true -vim.opt.scrolloff = 8 -vim.opt.signcolumn = "yes" -vim.opt.isfname:append("@-@") - -vim.opt.updatetime = 50 - -vim.opt.colorcolumn = "80" - -vim.g.c_syntax_for_h = 1 -vim.g.mapleader = " " +vim.opt.cmdheight = 0 +vim.opt.guicursor = "" +vim.opt.mouse = "" + +vim.opt.nu = 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 +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "80" + +vim.g.c_syntax_for_h = 1 +vim.g.mapleader = " " diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..7f372f6 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,44 @@ +return { + {"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"}, + { + "neovim/nvim-lspconfig", + config = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup{} + end, + }, + { + "VonHeikemen/lsp-zero.nvim", + dependencies = { + "neovim/nvim-lspconfig", + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp" + }, + config = function() + require("lsp-zero") + 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, + }) + end, + } +} diff --git a/lua/plugins/util.lua b/lua/plugins/util.lua new file mode 100644 index 0000000..9ec319b --- /dev/null +++ b/lua/plugins/util.lua @@ -0,0 +1,41 @@ +return { + { + "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", "", 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, + } +} diff --git a/lua/plugins/visual.lua b/lua/plugins/visual.lua new file mode 100644 index 0000000..ce247d3 --- /dev/null +++ b/lua/plugins/visual.lua @@ -0,0 +1,20 @@ +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, + } +}