From 3b96ad1b57efc65c432c5e5cc8897c694e322453 Mon Sep 17 00:00:00 2001 From: angryluck Date: Tue, 28 May 2024 21:08:24 +0200 Subject: [PATCH] Moved configs to seperate files --- .stylua.toml | 2 +- after/ftplugin/lua.lua | 1 + after/ftplugin/markdown.lua | 11 + init.lua | 298 +++++++++--------- lua/angryluck/commands.lua | 9 + lua/angryluck/keymaps.lua | 27 ++ lua/angryluck/options.lua | 63 ++++ .../plugins/autopairs.lua | 0 .../plugins/colorscheme.lua | 9 +- lua/angryluck/plugins/harpoon.lua | 64 ++++ lua/angryluck/plugins/haskell-tools.lua | 6 + lua/angryluck/plugins/init.lua | 78 +++++ lua/angryluck/plugins/neorg.lua | 29 ++ lua/angryluck/plugins/rasi.lua | 4 + lua/angryluck/plugins/sideways.lua | 10 + lua/angryluck/plugins/vim-orgmode.lua | 83 +++++ .../plugins/vim-template.lua | 0 lua/{custom => angryluck}/plugins/vimtex.lua | 0 lua/custom/plugins/haskell-tools.lua | 5 - lua/custom/plugins/init.lua | 9 - lua/custom/plugins/neorg.lua | 29 -- lua/custom/plugins/rasi.lua | 3 - lua/custom/plugins/sideways.lua | 9 - lua/custom/plugins/vim-orgmode.lua | 26 -- old-init.md => old-configs.md | 2 +- todo-init.org | 30 ++ 26 files changed, 578 insertions(+), 229 deletions(-) create mode 100644 after/ftplugin/lua.lua create mode 100644 after/ftplugin/markdown.lua create mode 100644 lua/angryluck/commands.lua create mode 100644 lua/angryluck/keymaps.lua create mode 100644 lua/angryluck/options.lua rename lua/{custom => angryluck}/plugins/autopairs.lua (100%) rename lua/{custom => angryluck}/plugins/colorscheme.lua (63%) create mode 100644 lua/angryluck/plugins/harpoon.lua create mode 100644 lua/angryluck/plugins/haskell-tools.lua create mode 100644 lua/angryluck/plugins/init.lua create mode 100644 lua/angryluck/plugins/neorg.lua create mode 100644 lua/angryluck/plugins/rasi.lua create mode 100644 lua/angryluck/plugins/sideways.lua create mode 100644 lua/angryluck/plugins/vim-orgmode.lua rename lua/{custom => angryluck}/plugins/vim-template.lua (100%) rename lua/{custom => angryluck}/plugins/vimtex.lua (100%) delete mode 100644 lua/custom/plugins/haskell-tools.lua delete mode 100644 lua/custom/plugins/init.lua delete mode 100644 lua/custom/plugins/neorg.lua delete mode 100644 lua/custom/plugins/rasi.lua delete mode 100644 lua/custom/plugins/sideways.lua delete mode 100644 lua/custom/plugins/vim-orgmode.lua rename old-init.md => old-configs.md (99%) create mode 100644 todo-init.org diff --git a/.stylua.toml b/.stylua.toml index ecb6dca5..6090f425 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -3,4 +3,4 @@ line_endings = "Unix" indent_type = "Spaces" indent_width = 2 quote_style = "AutoPreferDouble" -call_parentheses = "None" +call_parentheses = "Always" diff --git a/after/ftplugin/lua.lua b/after/ftplugin/lua.lua new file mode 100644 index 00000000..145e9e73 --- /dev/null +++ b/after/ftplugin/lua.lua @@ -0,0 +1 @@ +vim.opt.shiftwidth = 2 diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua new file mode 100644 index 00000000..5ffb5547 --- /dev/null +++ b/after/ftplugin/markdown.lua @@ -0,0 +1,11 @@ +vim.opt.breakindentopt = "shift:2" +vim.opt.shiftwidth = 4 +vim.opt.textwidth = 0 + +vim.cmd [[ +function! MyFormatExpr(start, end) + silent execute a:start.','.a:end.'s/[.!?]\zs /\r/g' +endfunction + +set formatexpr=MyFormatExpr(v:lnum,v:lnum+v:count-1) +]] diff --git a/init.lua b/init.lua index 2dd74042..456f32f8 100644 --- a/init.lua +++ b/init.lua @@ -1,120 +1,34 @@ --- DISABLED FOR NOW --- @diagnostic disable: missing-fields -- disables annoying warnings - --- [[ Options ]] --- See :help option-list +--- @diagnostic disable: missing-fields -- disables annoying warnings -- Must happen before plugins are required vim.g.mapleader = " " vim.g.maplocalleader = " " --- For custom functions later -vim.g.have_nerd_font = true - -vim.opt.number = true -vim.opt.relativenumber = true - -vim.opt.colorcolumn = "80" - --- Only mouse in [h]elp windows -vim.opt.mouse = "h" - --- statusline already shows mode -vim.opt.showmode = false - --- Copy from anywhere -vim.opt.clipboard = "unnamedplus" - --- Visual wrap keeps indentation -vim.opt.breakindent = true - -vim.opt.undofile = true - --- Case-insensitive searching UNLESS \C or capital in search -vim.opt.ignorecase = true -vim.opt.smartcase = true - --- Text keeps moving, if not always on -vim.opt.signcolumn = "yes" - -vim.opt.updatetime = 250 --- For which-key -vim.opt.timeoutlen = 300 - -vim.opt.list = true -vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } - --- Preview substitutions live, as you type! -vim.opt.inccommand = "split" - -vim.opt.cursorline = true - -vim.opt.scrolloff = 10 - -vim.opt.splitright = true -vim.opt.splitbelow = true - --- wrap between words -vim.o.linebreak = true -vim.o.expandtab = true -vim.o.shiftwidth = 4 -vim.o.tabstop = 8 -vim.o.softtabstop = 4 - --- [[ Basic Keymaps ]] -vim.opt.hlsearch = true -vim.keymap.set("n", "", "nohlsearch") - -vim.keymap.set({ "n", "v" }, "", "", { silent = true }) - --- Remap for dealing with word wrap -vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -vim.keymap.set("n", "gk", "v:count == 0 ? 'k' : 'k'", { expr = true, silent = true }) -vim.keymap.set("n", "gj", "v:count == 0 ? 'j' : 'j'", { expr = true, silent = true }) - --- Diagnostic keymaps -vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" }) -vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" }) -vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) -vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) - -vim.keymap.set("t", "", "", { desc = "Exit terminal mode" }) - -vim.keymap.set("n", "", "", { desc = "Move focus to the left window" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the right window" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the lower window" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the upper window" }) - --- [[ Basic Autocommands ]] --- See ':help lua-guide-autocommands' -vim.api.nvim_create_autocmd("TextYankPost", { - desc = "Highlight when yanking (copying text)", - group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) +require("angryluck.options") +require("angryluck.keymaps") +require("angryluck.commands") -- [[ Install lazy.nvim ]] -local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system { + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, - } + }) end vim.opt.runtimepath:prepend(lazypath) -- [[ Plugins ]] +-- TODO: require("lazy").setup("angryluck.plugins") require("lazy").setup({ -- Detect tabstop and shiftwidth automatically - "tpope/vim-sleuth", + -- Don't like this... + -- "tpope/vim-sleuth", -- "gc" to comment visual regions/lines { "numToStr/Comment.nvim", opts = {} }, @@ -139,10 +53,20 @@ require("lazy").setup({ "folke/which-key.nvim", event = "VimEnter", config = function() - require("which-key").setup() + require("which-key").setup({ + -- Remove this if so many keymaps, that you need to scroll + popup_mappings = { + scroll_down = "", + scroll_up = "", + }, + -- Doesn't work + -- trigger_blacklist = { + -- v = { "j", "k", "", "" }, + -- }, + }) -- Document existing key chains - require("which-key").register { + require("which-key").register({ -- Naming leader-key-groups ["c"] = { name = "[C]ode", _ = "which_key_ignore" }, ["d"] = { name = "[D]ocument", _ = "which_key_ignore" }, @@ -150,7 +74,7 @@ require("lazy").setup({ ["s"] = { name = "[S]earch", _ = "which_key_ignore" }, ["w"] = { name = "[W]orkspace", _ = "which_key_ignore" }, ["o"] = { name = "[O]rgmode", _ = "which_key_ignore" }, - } + }) end, }, @@ -165,14 +89,15 @@ require("lazy").setup({ "nvim-telescope/telescope-fzf-native.nvim", build = "make", cond = function() - return vim.fn.executable "make" == 1 + return vim.fn.executable("make") == 1 end, }, { "nvim-telescope/telescope-ui-select.nvim" }, { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, + { "xiyaowong/telescope-emoji.nvim" }, }, config = function() - require("telescope").setup { + require("telescope").setup({ defaults = { mappings = { i = { [""] = "to_fuzzy_refine" }, @@ -183,14 +108,15 @@ require("lazy").setup({ require("telescope.themes").get_dropdown(), }, }, - } + }) -- Enable telescope fzf native, if installed pcall(require("telescope").load_extension, "fzf") pcall(require("telescope").load_extension, "ui-select") + require("telescope").load_extension("emoji") -- See `:help telescope.builtin` - local builtin = require "telescope.builtin" + local builtin = require("telescope.builtin") vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) vim.keymap.set("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) vim.keymap.set("n", "sf", builtin.find_files, { desc = "[S]earch [F]iles" }) @@ -202,30 +128,35 @@ require("lazy").setup({ vim.keymap.set("n", "s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set("n", "sg", builtin.git_files, { desc = "[S]earch [G]it Files" }) vim.keymap.set("n", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) + + vim.keymap.set("n", "se", ":Telescope emoji", { desc = "[S]earch [E]mojis" }) -- Overriding default behavior and theme vim.keymap.set("n", "/", function() -- You can pass additional configuration to telescope to change theme, layout, etc. - builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown { + builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ winblend = 10, previewer = false, - }) + })) end, { desc = "[/] Fuzzily search in current buffer" }) -- Also possible to pass additional configuration options. -- See `:help telescope.builtin.live_grep()` for information about particular keys vim.keymap.set("n", "s/", function() - builtin.live_grep { + builtin.live_grep({ grep_open_files = true, prompt_title = "Live Grep in Open Files", - } + }) end, { desc = "[S]earch [/] in Open Files" }) vim.keymap.set("n", "sn", function() - builtin.find_files { cwd = vim.fn.stdpath "config" } + builtin.find_files({ cwd = vim.fn.stdpath("config") }) end, { desc = "[S]earch [N]eovim files" }) end, }, + -- To add "add to dictionary" to ltex, but doesn't work... + -- { "vigoux/ltex-ls.nvim", dependencies = { "neovim/nvim-lspconfig" } }, + { -- LSP Configuration & Plugins "neovim/nvim-lspconfig", dependencies = { @@ -292,18 +223,18 @@ require("lazy").setup({ nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") -- Highlight references of word under cursor - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.server_capabilities.documentHighlightProvider then - vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { - buffer = event.buf, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { - buffer = event.buf, - callback = vim.lsp.buf.clear_references, - }) - end + -- local client = vim.lsp.get_client_by_id(event.data.client_id) + -- if client and client.server_capabilities.documentHighlightProvider then + -- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + -- buffer = event.buf, + -- callback = vim.lsp.buf.document_highlight, + -- }) + -- + -- vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + -- buffer = event.buf, + -- callback = vim.lsp.buf.clear_references, + -- }) + -- end end, }) @@ -319,7 +250,7 @@ require("lazy").setup({ local servers = { lua_ls = { -- cmd = {...}, - -- filetypes { ...}, + -- filetypes = { ...}, -- capabilities = {}, settings = { Lua = { @@ -330,15 +261,31 @@ require("lazy").setup({ }, }, }, + ltex = { + filetypes = { "tex" }, + settings = { + dictionary = { + ["en-US"] = { "homotopy" }, + }, + }, + }, + hls = { + filetypes = { "haskell", "lhaskell", "cabal" }, + haskell = { + cabalFormattingProvider = "cabalfmt", + formattingProvider = "fourmolu", + }, + single_file_suppport = true, + }, } -- Use :Mason to install manually require("mason").setup() local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { "stylua" }) - require("mason-tool-installer").setup { ensure_installed = ensure_installed } + require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) - require("mason-lspconfig").setup { + require("mason-lspconfig").setup({ handlers = { function(server_name) local server = servers[server_name] or {} @@ -349,7 +296,7 @@ require("lazy").setup({ require("lspconfig")[server_name].setup(server) end, }, - } + }) end, }, @@ -370,6 +317,7 @@ require("lazy").setup({ formatters_by_ft = { lua = { "stylua" }, haskell = { "fourmolu" }, + json = { "jq" }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- @@ -389,7 +337,7 @@ require("lazy").setup({ "L3MON4D3/LuaSnip", -- build needed for regex support build = (function() - if vim.fn.has "win32" == 1 or vim.fn.executable "make" == 0 then + if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then return end return "make install_jsregexp" @@ -415,11 +363,11 @@ require("lazy").setup({ "hrsh7th/cmp-path", }, config = function() - local cmp = require "cmp" - local luasnip = require "luasnip" - luasnip.config.setup { enable_autosnippets = true } + local cmp = require("cmp") + local luasnip = require("luasnip") + luasnip.config.setup({ enable_autosnippets = true }) - cmp.setup { + cmp.setup({ snippet = { expand = function(args) luasnip.lsp_expand(args.body) @@ -427,7 +375,7 @@ require("lazy").setup({ }, -- old one: completeopt = "menuone,noselect", completion = { completeopt = "menu,menuone,noinsert" }, - mapping = cmp.mapping.preset.insert { + mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.scroll_docs(-4), @@ -435,9 +383,9 @@ require("lazy").setup({ [""] = cmp.mapping.scroll_docs(-8), [""] = cmp.mapping.scroll_docs(8), -- Accept ([y]es) the completion - [""] = cmp.mapping.confirm { select = true }, + [""] = cmp.mapping.confirm({ select = true }), -- Manually trigger a completion from nvim-cmp (normally not needed) - [""] = cmp.mapping.complete {}, + [""] = cmp.mapping.complete({}), [""] = cmp.mapping(function() if luasnip.expand_or_locally_jumpable() then luasnip.expand_or_jump() @@ -448,14 +396,15 @@ require("lazy").setup({ luasnip.jump(-1) end end, { "i", "s" }), - }, + }), sources = { { name = "nvim_lsp" }, { name = "luasnip" }, { name = "path" }, { name = "neorg" }, + { name = "orgmode" }, }, - } + }) end, }, @@ -507,14 +456,16 @@ require("lazy").setup({ -- Examples: -- - yinq - [Y]ank [I]nside [N]ext [']quote -- - ci' - [C]hange [I]nside [']quote - require("mini.ai").setup { n_lines = 500 } + require("mini.ai").setup({ n_lines = 500 }) -- Add/delete/replace surroundings (brackets, quotes, etc.) -- -- - saiw( - [S]urround [A]dd [I]nner [W]ord [)]Paren -- - sd' - [S]urround [D]elete [']quotes -- - sr(' - [S]urround [R]eplace [)] ['] - require("mini.surround").setup() + -- + -- nvim-surround is better... + -- require("mini.surround").setup {} -- See 'https://github.com/echasnovski/mini.nvim' for more uses end, @@ -529,6 +480,8 @@ require("lazy").setup({ "nvim-treesitter/nvim-treesitter-textobjects", -- Keeps function description stuck on top "nvim-treesitter/nvim-treesitter-context", + -- Extra stuff + "nvim-treesitter/nvim-treesitter-refactor", }, opts = { -- Add languages to be installed here that you want installed for treesitter @@ -539,17 +492,17 @@ require("lazy").setup({ "lua", "vim", "vimdoc", - "org", + -- "org", "norg", "markdown", }, ignore_install = { "latex" }, auto_install = true, - indent = { enable = true }, + -- indent = { enable = true }, highlight = { enable = true, disable = { "latex" }, - additional_vim_regex_highlighting = { "latex", "markdown" }, + -- additional_vim_regex_highlighting = { "latex", "markdown" }, }, incremental_selection = { @@ -607,10 +560,10 @@ require("lazy").setup({ swap = { enable = true, swap_next = { - ["a"] = "@parameter.inner", + [">"] = "@parameter.inner", }, swap_previous = { - ["A"] = "@parameter.inner", + ["<"] = "@parameter.inner", }, }, lsp_interop = { @@ -623,6 +576,21 @@ require("lazy").setup({ }, }, }, + refactor = { + highlight_definitions = { + enable = true, + -- Set to false if you have an `updatetime` of ~100. + clear_on_cursor_move = true, + }, + highlight_current_scope = { enable = true }, + smart_rename = { + enable = true, + -- Assign keymaps to false to disable them, e.g. `smart_rename = false`. + keymaps = { + smart_rename = "grr", + }, + }, + }, }, config = function(_, opts) @@ -634,7 +602,8 @@ require("lazy").setup({ -- require 'kickstart.plugins.debug', -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - { import = "custom.plugins" }, + { import = "angryluck.plugins" }, + -- { import = "kickstart.plugins" }, }, { ui = { -- Default icons, if no nerd font installed @@ -656,5 +625,50 @@ require("lazy").setup({ }, }) +-- require("ltex-ls").setup { +-- on_attach = on_attach, +-- capabilities = capabilities, +-- use_spellfile = false, +-- filetypes = { "latex", "tex", "bib", "markdown", "gitcommit", "text" }, +-- settings = { +-- ltex = { +-- enabled = { "latex", "tex", "bib", "markdown" }, +-- language = "auto", +-- diagnosticSeverity = "information", +-- sentenceCacheSize = 2000, +-- additionalRules = { +-- enablePickyRules = true, +-- motherTongue = "fr", +-- }, +-- disabledRules = { +-- fr = { "APOS_TYP", "FRENCH_WHITESPACE" }, +-- }, +-- dictionary = (function() +-- -- For dictionary, search for files in the runtime to have +-- -- and include them as externals the format for them is +-- -- dict/{LANG}.txt +-- -- +-- -- Also add dict/default.txt to all of them +-- local files = {} +-- for _, file in ipairs(vim.api.nvim_get_runtime_file("dict/*", true)) do +-- local lang = vim.fn.fnamemodify(file, ":t:r") +-- local fullpath = vim.fs.normalize(file, ":p") +-- files[lang] = { ":" .. fullpath } +-- end +-- +-- if files.default then +-- for lang, _ in pairs(files) do +-- if lang ~= "default" then +-- vim.list_extend(files[lang], files.default) +-- end +-- end +-- files.default = nil +-- end +-- return files +-- end)(), +-- }, +-- }, +-- } + -- modeline -- vim: ts=2 sts=4 sw=2 et diff --git a/lua/angryluck/commands.lua b/lua/angryluck/commands.lua new file mode 100644 index 00000000..f826f21a --- /dev/null +++ b/lua/angryluck/commands.lua @@ -0,0 +1,9 @@ +-- [[ Basic Autocommands ]] +-- See ':help lua-guide-autocommands' +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight when yanking (copying text)", + group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/lua/angryluck/keymaps.lua b/lua/angryluck/keymaps.lua new file mode 100644 index 00000000..a221975e --- /dev/null +++ b/lua/angryluck/keymaps.lua @@ -0,0 +1,27 @@ +-- [[ Basic Keymaps ]] +-- mapleader = " " and maplocalleader = " " are set in init.lua + +-- Combined with 'vim.opt.hlssearch = true' +vim.keymap.set("n", "", "nohlsearch") + +vim.keymap.set({ "n", "v" }, "", "", { silent = true }) + +-- Remap for dealing with word wrap +vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +vim.keymap.set("n", "gk", "v:count == 0 ? 'k' : 'k'", { expr = true, silent = true }) +vim.keymap.set("n", "gj", "v:count == 0 ? 'j' : 'j'", { expr = true, silent = true }) + +-- Diagnostic keymaps +vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" }) +vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" }) +vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) +vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) + +vim.keymap.set("t", "", "", { desc = "Exit terminal mode" }) + +-- Easier window movement (but conflicts with Harpoon) +-- vim.keymap.set("n", "", "", { desc = "Move focus to the left window" }) +-- vim.keymap.set("n", "", "", { desc = "Move focus to the right window" }) +-- vim.keymap.set("n", "", "", { desc = "Move focus to the lower window" }) +-- vim.keymap.set("n", "", "", { desc = "Move focus to the upper window" }) diff --git a/lua/angryluck/options.lua b/lua/angryluck/options.lua new file mode 100644 index 00000000..72183e1d --- /dev/null +++ b/lua/angryluck/options.lua @@ -0,0 +1,63 @@ +-- [[ Options ]] +-- See :help option-list + +-- For custom functions later +vim.g.have_nerd_font = true + +vim.opt.number = true +vim.opt.relativenumber = true + +vim.opt.colorcolumn = "80" + +-- Only mouse in [h]elp windows +-- Or [a]llways +vim.opt.mouse = "a" + +-- statusline already shows mode +vim.opt.showmode = false + +-- Copy from anywhere +vim.opt.clipboard = "unnamedplus" + +-- Visual wrap keeps indentation +vim.opt.breakindent = true + +vim.opt.undofile = true + +-- Case-insensitive searching UNLESS \C or capital in search +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Text keeps moving, if not always on +vim.opt.signcolumn = "yes" + +vim.opt.updatetime = 250 +-- For which-key +vim.opt.timeoutlen = 300 + +vim.opt.list = true +vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } + +-- Preview substitutions live, as you type! +vim.opt.inccommand = "nosplit" + +vim.opt.cursorline = true + +vim.opt.scrolloff = 10 + +vim.opt.splitright = true +vim.opt.splitbelow = true + +-- wrap between words +vim.opt.linebreak = true + +vim.opt.expandtab = true +vim.opt.shiftwidth = 4 +vim.opt.tabstop = 8 +vim.opt.softtabstop = 4 + +-- Don't keep buffer open when opening new file +vim.opt.hidden = false + +-- Combined with mapping to clear highlights +vim.opt.hlsearch = true diff --git a/lua/custom/plugins/autopairs.lua b/lua/angryluck/plugins/autopairs.lua similarity index 100% rename from lua/custom/plugins/autopairs.lua rename to lua/angryluck/plugins/autopairs.lua diff --git a/lua/custom/plugins/colorscheme.lua b/lua/angryluck/plugins/colorscheme.lua similarity index 63% rename from lua/custom/plugins/colorscheme.lua rename to lua/angryluck/plugins/colorscheme.lua index 7a9de5ce..91613699 100644 --- a/lua/custom/plugins/colorscheme.lua +++ b/lua/angryluck/plugins/colorscheme.lua @@ -1,17 +1,18 @@ return { { -- Best colorscheme - 'catppuccin/nvim', - name = 'catppuccin', + "catppuccin/nvim", + lazy = false, + name = "catppuccin", priority = 1000, config = function() - vim.cmd.colorscheme 'catppuccin' + vim.cmd.colorscheme "catppuccin" end, }, { -- Theme inspired by Atom - 'navarasu/onedark.nvim', + "navarasu/onedark.nvim", priority = 1000, -- config = function() -- vim.cmd.colorscheme 'onedark' diff --git a/lua/angryluck/plugins/harpoon.lua b/lua/angryluck/plugins/harpoon.lua new file mode 100644 index 00000000..f51c2048 --- /dev/null +++ b/lua/angryluck/plugins/harpoon.lua @@ -0,0 +1,64 @@ +return { + -- "ThePrimeagen/harpoon", + -- branch = "harpoon2", + -- dependencies = { "nvim-lua/plenary.nvim" }, + -- config = function() + -- local harpoon = require "harpoon" + -- + -- -- REQUIRED + -- harpoon:setup {} + -- -- REQUIRED + -- + -- vim.keymap.set("n", "a", function() + -- harpoon:list():append() + -- end) + -- -- vim.keymap.set("n", "", function() + -- -- harpoon.ui:toggle_quick_menu(harpoon:list()) + -- -- end) + -- + -- vim.keymap.set("n", "", function() + -- harpoon:list():select(1) + -- end) + -- vim.keymap.set("n", "", function() + -- harpoon:list():select(2) + -- end) + -- vim.keymap.set("n", "", function() + -- harpoon:list():select(3) + -- end) + -- vim.keymap.set("n", "", function() + -- harpoon:list():select(4) + -- end) + -- + -- -- Toggle previous & next buffers stored within Harpoon list + -- vim.keymap.set("n", "", function() + -- harpoon:list():prev() + -- end) + -- vim.keymap.set("n", "", function() + -- harpoon:list():next() + -- end) + -- + -- -- basic telescope configuration + -- local conf = require("telescope.config").values + -- local function toggle_telescope(harpoon_files) + -- local file_paths = {} + -- for _, item in ipairs(harpoon_files.items) do + -- table.insert(file_paths, item.value) + -- end + -- + -- require("telescope.pickers") + -- .new({}, { + -- prompt_title = "Harpoon", + -- finder = require("telescope.finders").new_table { + -- results = file_paths, + -- }, + -- previewer = conf.file_previewer {}, + -- sorter = conf.generic_sorter {}, + -- }) + -- :find() + -- end + -- + -- vim.keymap.set("n", "", function() + -- toggle_telescope(harpoon:list()) + -- end, { desc = "Open harpoon window" }) + -- end, +} diff --git a/lua/angryluck/plugins/haskell-tools.lua b/lua/angryluck/plugins/haskell-tools.lua new file mode 100644 index 00000000..d4b7ff9c --- /dev/null +++ b/lua/angryluck/plugins/haskell-tools.lua @@ -0,0 +1,6 @@ +return { + -- "mrcjkb/haskell-tools.nvim", + -- version = "^3", -- Recommended + -- lazy = false, + -- ft = { "haskell", "stack", "lhaskell", "cabal", "cabalproject" }, +} diff --git a/lua/angryluck/plugins/init.lua b/lua/angryluck/plugins/init.lua new file mode 100644 index 00000000..bcfee9e7 --- /dev/null +++ b/lua/angryluck/plugins/init.lua @@ -0,0 +1,78 @@ +-- Own plugins, too small for own file +-- Probably better to add one file for each +return { + "fladson/vim-kitty", + + -- OWN PLUGINS + -- Better scrolloff + { + "Aasim-A/scrollEOF.nvim", + event = { "CursorMoved", "WinScrolled" }, + opts = {}, + }, + + { + "renerocksai/telekasten.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, + }, + + -- install without yarn or npm + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function() + vim.fn["mkdp#util#install"]() + end, + }, + + -- Better than mini.surround, imo + -- Remember: y for "yadd". + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end, + }, + + -- "." repeats plugincommands + "tpope/vim-repeat", + + -- { + -- "ggandor/leap.nvim", + -- -- opts = {}, + -- config = function() + -- require("leap").create_default_mappings() + -- end, + -- }, + + { + "folke/flash.nvim", + event = "VeryLazy", + opts = {}, + keys = { + -- stylua: ignore start + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash", }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter", }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash", }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search", }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search", }, + -- stylua: ignore end + }, + }, + + -- Edit files like nvim buffer + { + "stevearc/oil.nvim", + opts = {}, + -- Optional dependencies + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("oil").setup() + end, + }, +} diff --git a/lua/angryluck/plugins/neorg.lua b/lua/angryluck/plugins/neorg.lua new file mode 100644 index 00000000..3fae6e00 --- /dev/null +++ b/lua/angryluck/plugins/neorg.lua @@ -0,0 +1,29 @@ +return { + -- "nvim-neorg/neorg", + -- dependencies = { "nvim-lua/plenary.nvim" }, + -- build = ":Neorg sync-parsers", + -- -- tag = "*", + -- lazy = true, -- enable lazy load + -- ft = "norg", -- lazy load on file type + -- cmd = "Neorg", -- lazy load on command + -- config = function() + -- require("neorg").setup { + -- load = { + -- ["core.defaults"] = {}, -- Loads default behaviour + -- ["core.concealer"] = {}, -- Adds pretty icons to your documents + -- ["core.dirman"] = { -- Manages Neorg workspaces + -- config = { + -- workspaces = { + -- notes = "~/documents/notes", + -- }, + -- }, + -- }, + -- ["core.completion"] = { + -- config = { + -- engine = "nvim-cmp", + -- } + -- } + -- }, + -- } + -- end, +} diff --git a/lua/angryluck/plugins/rasi.lua b/lua/angryluck/plugins/rasi.lua new file mode 100644 index 00000000..802fe247 --- /dev/null +++ b/lua/angryluck/plugins/rasi.lua @@ -0,0 +1,4 @@ +return { + -- Syntax highlight for rofi config (config.rasi) + "Fymyte/rasi.vim", +} diff --git a/lua/angryluck/plugins/sideways.lua b/lua/angryluck/plugins/sideways.lua new file mode 100644 index 00000000..a396bdc2 --- /dev/null +++ b/lua/angryluck/plugins/sideways.lua @@ -0,0 +1,10 @@ +return { + -- -- TREESITTER SHOULD HANDLE THIS! + -- "AndrewRadev/sideways.vim", + -- config = function() + -- vim.keymap.set("n", "s<", ":SidewaysLeft") + -- vim.keymap.set("n", "s>", ":SidewaysRight") + -- vim.keymap.set("n", "sh", ":SidewaysJumpLeft") + -- vim.keymap.set("n", "sl", ":SidewaysJumpRight") + -- end, +} diff --git a/lua/angryluck/plugins/vim-orgmode.lua b/lua/angryluck/plugins/vim-orgmode.lua new file mode 100644 index 00000000..ea171346 --- /dev/null +++ b/lua/angryluck/plugins/vim-orgmode.lua @@ -0,0 +1,83 @@ +return { + "nvim-orgmode/orgmode", + dependencies = { + { + "nvim-treesitter/nvim-treesitter", + lazy = true, + config = function() + -- Setup treesitter + require("nvim-treesitter.configs").setup { + highlight = { + enable = true, + }, + ensure_installed = { "org" }, + } + end, + }, + { + "akinsho/org-bullets.nvim", + config = function() + require("org-bullets").setup() + end, + }, + -- "joaomsa/telescope-orgmode.nvim", + -- "nvim-telescope/telescope.nvim", + -- { + -- "lukas-reineke/headlines.nvim", + -- dependencies = "nvim-treesitter/nvim-treesitter", + -- config = function() + -- vim.cmd [[highlight Headline1 guibg=#1e2718]] + -- vim.cmd [[highlight Headline2 guibg=#21262d]] + -- vim.cmd [[highlight CodeBlock guibg=#1c1c1c]] + -- vim.cmd [[highlight Dash guibg=#D19A66 gui=bold]] + -- + -- require("headlines").setup { + -- org = { + -- headline_highlights = { "Headline1", "Headline2" }, + -- }, + -- } + -- end, -- or `opts = {}` + -- }, + }, + -- ADD THIS BACK LATER - SOMETHING WRONG, SO DOESNT START + -- event = 'VeryLazy', + config = function() + -- Load treesitter grammar for org + -- require("orgmode").setup_ts_grammar() + -- require("telescope").load_extension "orgmode" + + -- vim.api.nvim_create_autocmd("FileType", { + -- pattern = "org", + -- group = vim.api.nvim_create_augroup("orgmode_telescope_nvim", { clear = true }), + -- callback = function() + -- vim.keymap.set("n", "or", require("telescope").extensions.orgmode.refile_heading) + -- end, + -- }) + + -- Setup orgmode + require("orgmode").setup { + org_agenda_files = { "~/documents/orgfiles/**/*", "~/gtd/**/*" }, + -- org_default_notes_file = "~/documents/orgfiles/refile.org", + org_default_notes_file = "~/gtd/inbox.org", + org_archive_location = "~/gtd/archive/%s_archive::", + org_todo_keywords = { + "NEXT(n)", + "TODO(t)", + "WAITING(w)", + -- "SCHEDULED(s)", + "|", + "DONE(d)", + "CANCELLED(c)", + }, + -- org_hide_leading_stars = true, + mappings = { + capture = { + org_capture_finalize = "ow", + }, + note = { + org_note_finalize = "ow", + }, + }, + } + end, +} diff --git a/lua/custom/plugins/vim-template.lua b/lua/angryluck/plugins/vim-template.lua similarity index 100% rename from lua/custom/plugins/vim-template.lua rename to lua/angryluck/plugins/vim-template.lua diff --git a/lua/custom/plugins/vimtex.lua b/lua/angryluck/plugins/vimtex.lua similarity index 100% rename from lua/custom/plugins/vimtex.lua rename to lua/angryluck/plugins/vimtex.lua diff --git a/lua/custom/plugins/haskell-tools.lua b/lua/custom/plugins/haskell-tools.lua deleted file mode 100644 index a3c0bd0f..00000000 --- a/lua/custom/plugins/haskell-tools.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - 'mrcjkb/haskell-tools.nvim', - version = '^3', -- Recommended - ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' }, -} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index 18fea752..00000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,9 +0,0 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information --- --- FOR PLUGINS NOT REQUIRING CONFIGURATION: -return { - "fladson/vim-kitty" -} diff --git a/lua/custom/plugins/neorg.lua b/lua/custom/plugins/neorg.lua deleted file mode 100644 index 619a8113..00000000 --- a/lua/custom/plugins/neorg.lua +++ /dev/null @@ -1,29 +0,0 @@ -return { - "nvim-neorg/neorg", - dependencies = { "nvim-lua/plenary.nvim" }, - build = ":Neorg sync-parsers", - -- tag = "*", - lazy = true, -- enable lazy load - ft = "norg", -- lazy load on file type - cmd = "Neorg", -- lazy load on command - config = function() - require("neorg").setup { - load = { - ["core.defaults"] = {}, -- Loads default behaviour - ["core.concealer"] = {}, -- Adds pretty icons to your documents - ["core.dirman"] = { -- Manages Neorg workspaces - config = { - workspaces = { - notes = "~/documents/notes", - }, - }, - }, - ["core.completion"] = { - config = { - engine = "nvim-cmp", - } - } - }, - } - end, -} diff --git a/lua/custom/plugins/rasi.lua b/lua/custom/plugins/rasi.lua deleted file mode 100644 index 933415f8..00000000 --- a/lua/custom/plugins/rasi.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - "Fymyte/rasi.vim" -} diff --git a/lua/custom/plugins/sideways.lua b/lua/custom/plugins/sideways.lua deleted file mode 100644 index 4f29bbfd..00000000 --- a/lua/custom/plugins/sideways.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "AndrewRadev/sideways.vim", - config = function() - vim.keymap.set("n", "s<", ":SidewaysLeft") - vim.keymap.set("n", "s>", ":SidewaysRight") - vim.keymap.set("n", "sh", ":SidewaysJumpLeft") - vim.keymap.set("n", "sl", ":SidewaysJumpRight") - end, -} diff --git a/lua/custom/plugins/vim-orgmode.lua b/lua/custom/plugins/vim-orgmode.lua deleted file mode 100644 index 9b4836f4..00000000 --- a/lua/custom/plugins/vim-orgmode.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - 'nvim-orgmode/orgmode', - dependencies = { - { 'nvim-treesitter/nvim-treesitter', lazy = true }, - }, - -- ADD THIS BACK LATER - SOMETHING WRONG, SO DOESNT START - -- event = 'VeryLazy', - config = function() - -- Load treesitter grammar for org - require('orgmode').setup_ts_grammar() - - -- Setup treesitter - require('nvim-treesitter.configs').setup({ - highlight = { - enable = true, - }, - ensure_installed = { 'org' }, - }) - - -- Setup orgmode - require('orgmode').setup({ - org_agenda_files = '~/documents/orgfiles/**/*', - org_default_notes_file = '~/documents/orgfiles/refile.org', - }) - end, -} diff --git a/old-init.md b/old-configs.md similarity index 99% rename from old-init.md rename to old-configs.md index 11cf014f..8350cb1c 100644 --- a/old-init.md +++ b/old-configs.md @@ -1,4 +1,4 @@ -``` +```lua -- Old stuff removed from config, but saving in case it should be added back. return { -- Adds git related signs to the gutter, as well as utilities for managing changes "lewis6991/gitsigns.nvim", diff --git a/todo-init.org b/todo-init.org new file mode 100644 index 00000000..2b659bd8 --- /dev/null +++ b/todo-init.org @@ -0,0 +1,30 @@ +* todo in config +** Replace lazy.nvim with Rocks.nvim + Code: + #+begin_src lua + local rocks_config = { + rocks_path = vim.env.HOME .. "/.local/share/nvim/rocks", + luarocks_binary = vim.env.HOME .. "luarocks", + } + + vim.g.rocks_nvim = rocks_config + + local luarocks_path = { + vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"), + vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?", "init.lua"), + } + package.path = package.path .. ";" .. table.concat(luarocks_path, ";") + + local luarocks_cpath = { + vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"), + vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"), + -- Remove the dylib and dll paths if you do not need macos or windows support + vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dylib"), + vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dylib"), + vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dll"), + vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dll"), + } + package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";") + + vim.opt.runtimepath:append(vim.fs.joinpath(rocks_config.rocks_path, "lib", "luarocks", "rocks-5.1", "*", "*")) + #+end_src