Moved configs to seperate files

This commit is contained in:
angryluck 2024-05-28 21:08:24 +02:00
parent fdb565ce87
commit 3b96ad1b57
26 changed files with 578 additions and 229 deletions

View File

@ -3,4 +3,4 @@ line_endings = "Unix"
indent_type = "Spaces" indent_type = "Spaces"
indent_width = 2 indent_width = 2
quote_style = "AutoPreferDouble" quote_style = "AutoPreferDouble"
call_parentheses = "None" call_parentheses = "Always"

1
after/ftplugin/lua.lua Normal file
View File

@ -0,0 +1 @@
vim.opt.shiftwidth = 2

View File

@ -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)
]]

298
init.lua
View File

@ -1,120 +1,34 @@
-- DISABLED FOR NOW --- @diagnostic disable: missing-fields -- disables annoying warnings
-- @diagnostic disable: missing-fields -- disables annoying warnings
-- [[ Options ]]
-- See :help option-list
-- Must happen before plugins are required -- Must happen before plugins are required
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = " " vim.g.maplocalleader = " "
-- For custom functions later require("angryluck.options")
vim.g.have_nerd_font = true require("angryluck.keymaps")
require("angryluck.commands")
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", "<Esc>", "<cmd>nohlsearch<CR>")
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { 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", "<leader>e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { 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,
})
-- [[ Install lazy.nvim ]] -- [[ 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 if not vim.loop.fs_stat(lazypath) then
vim.fn.system { vim.fn.system({
"git", "git",
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable", -- latest stable release
lazypath, lazypath,
} })
end end
vim.opt.runtimepath:prepend(lazypath) vim.opt.runtimepath:prepend(lazypath)
-- [[ Plugins ]] -- [[ Plugins ]]
-- TODO: require("lazy").setup("angryluck.plugins")
require("lazy").setup({ require("lazy").setup({
-- Detect tabstop and shiftwidth automatically -- Detect tabstop and shiftwidth automatically
"tpope/vim-sleuth", -- Don't like this...
-- "tpope/vim-sleuth",
-- "gc" to comment visual regions/lines -- "gc" to comment visual regions/lines
{ "numToStr/Comment.nvim", opts = {} }, { "numToStr/Comment.nvim", opts = {} },
@ -139,10 +53,20 @@ require("lazy").setup({
"folke/which-key.nvim", "folke/which-key.nvim",
event = "VimEnter", event = "VimEnter",
config = function() 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 = "<Nop>",
scroll_up = "<Nop>",
},
-- Doesn't work
-- trigger_blacklist = {
-- v = { "j", "k", "<C-D>", "<C-U>" },
-- },
})
-- Document existing key chains -- Document existing key chains
require("which-key").register { require("which-key").register({
-- Naming leader-key-groups -- Naming leader-key-groups
["<leader>c"] = { name = "[C]ode", _ = "which_key_ignore" }, ["<leader>c"] = { name = "[C]ode", _ = "which_key_ignore" },
["<leader>d"] = { name = "[D]ocument", _ = "which_key_ignore" }, ["<leader>d"] = { name = "[D]ocument", _ = "which_key_ignore" },
@ -150,7 +74,7 @@ require("lazy").setup({
["<leader>s"] = { name = "[S]earch", _ = "which_key_ignore" }, ["<leader>s"] = { name = "[S]earch", _ = "which_key_ignore" },
["<leader>w"] = { name = "[W]orkspace", _ = "which_key_ignore" }, ["<leader>w"] = { name = "[W]orkspace", _ = "which_key_ignore" },
["<leader>o"] = { name = "[O]rgmode", _ = "which_key_ignore" }, ["<leader>o"] = { name = "[O]rgmode", _ = "which_key_ignore" },
} })
end, end,
}, },
@ -165,14 +89,15 @@ require("lazy").setup({
"nvim-telescope/telescope-fzf-native.nvim", "nvim-telescope/telescope-fzf-native.nvim",
build = "make", build = "make",
cond = function() cond = function()
return vim.fn.executable "make" == 1 return vim.fn.executable("make") == 1
end, end,
}, },
{ "nvim-telescope/telescope-ui-select.nvim" }, { "nvim-telescope/telescope-ui-select.nvim" },
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
{ "xiyaowong/telescope-emoji.nvim" },
}, },
config = function() config = function()
require("telescope").setup { require("telescope").setup({
defaults = { defaults = {
mappings = { mappings = {
i = { ["<c-enter>"] = "to_fuzzy_refine" }, i = { ["<c-enter>"] = "to_fuzzy_refine" },
@ -183,14 +108,15 @@ require("lazy").setup({
require("telescope.themes").get_dropdown(), require("telescope.themes").get_dropdown(),
}, },
}, },
} })
-- Enable telescope fzf native, if installed -- Enable telescope fzf native, if installed
pcall(require("telescope").load_extension, "fzf") pcall(require("telescope").load_extension, "fzf")
pcall(require("telescope").load_extension, "ui-select") pcall(require("telescope").load_extension, "ui-select")
require("telescope").load_extension("emoji")
-- See `:help telescope.builtin` -- See `:help telescope.builtin`
local builtin = require "telescope.builtin" local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" }) vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
@ -202,30 +128,35 @@ require("lazy").setup({
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set("n", "<leader>sg", builtin.git_files, { desc = "[S]earch [G]it Files" }) vim.keymap.set("n", "<leader>sg", builtin.git_files, { desc = "[S]earch [G]it Files" })
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" }) vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
vim.keymap.set("n", "<leader>se", ":Telescope emoji<CR>", { desc = "[S]earch [E]mojis" })
-- Overriding default behavior and theme -- Overriding default behavior and theme
vim.keymap.set("n", "<leader>/", function() vim.keymap.set("n", "<leader>/", function()
-- You can pass additional configuration to telescope to change theme, layout, etc. -- 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, winblend = 10,
previewer = false, previewer = false,
}) }))
end, { desc = "[/] Fuzzily search in current buffer" }) end, { desc = "[/] Fuzzily search in current buffer" })
-- Also possible to pass additional configuration options. -- Also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys -- See `:help telescope.builtin.live_grep()` for information about particular keys
vim.keymap.set("n", "<leader>s/", function() vim.keymap.set("n", "<leader>s/", function()
builtin.live_grep { builtin.live_grep({
grep_open_files = true, grep_open_files = true,
prompt_title = "Live Grep in Open Files", prompt_title = "Live Grep in Open Files",
} })
end, { desc = "[S]earch [/] in Open Files" }) end, { desc = "[S]earch [/] in Open Files" })
vim.keymap.set("n", "<leader>sn", function() vim.keymap.set("n", "<leader>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, { desc = "[S]earch [N]eovim files" })
end, end,
}, },
-- To add "add to dictionary" to ltex, but doesn't work...
-- { "vigoux/ltex-ls.nvim", dependencies = { "neovim/nvim-lspconfig" } },
{ -- LSP Configuration & Plugins { -- LSP Configuration & Plugins
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = { dependencies = {
@ -292,18 +223,18 @@ require("lazy").setup({
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
-- Highlight references of word under cursor -- Highlight references of word under cursor
local client = vim.lsp.get_client_by_id(event.data.client_id) -- local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.server_capabilities.documentHighlightProvider then -- if client and client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { -- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
buffer = event.buf, -- buffer = event.buf,
callback = vim.lsp.buf.document_highlight, -- callback = vim.lsp.buf.document_highlight,
}) -- })
--
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { -- vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
buffer = event.buf, -- buffer = event.buf,
callback = vim.lsp.buf.clear_references, -- callback = vim.lsp.buf.clear_references,
}) -- })
end -- end
end, end,
}) })
@ -319,7 +250,7 @@ require("lazy").setup({
local servers = { local servers = {
lua_ls = { lua_ls = {
-- cmd = {...}, -- cmd = {...},
-- filetypes { ...}, -- filetypes = { ...},
-- capabilities = {}, -- capabilities = {},
settings = { settings = {
Lua = { 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 -- Use :Mason to install manually
require("mason").setup() require("mason").setup()
local ensure_installed = vim.tbl_keys(servers or {}) local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, { "stylua" }) 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 = { handlers = {
function(server_name) function(server_name)
local server = servers[server_name] or {} local server = servers[server_name] or {}
@ -349,7 +296,7 @@ require("lazy").setup({
require("lspconfig")[server_name].setup(server) require("lspconfig")[server_name].setup(server)
end, end,
}, },
} })
end, end,
}, },
@ -370,6 +317,7 @@ require("lazy").setup({
formatters_by_ft = { formatters_by_ft = {
lua = { "stylua" }, lua = { "stylua" },
haskell = { "fourmolu" }, haskell = { "fourmolu" },
json = { "jq" },
-- Conform can also run multiple formatters sequentially -- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" }, -- python = { "isort", "black" },
-- --
@ -389,7 +337,7 @@ require("lazy").setup({
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
-- build needed for regex support -- build needed for regex support
build = (function() 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 return
end end
return "make install_jsregexp" return "make install_jsregexp"
@ -415,11 +363,11 @@ require("lazy").setup({
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
}, },
config = function() config = function()
local cmp = require "cmp" local cmp = require("cmp")
local luasnip = require "luasnip" local luasnip = require("luasnip")
luasnip.config.setup { enable_autosnippets = true } luasnip.config.setup({ enable_autosnippets = true })
cmp.setup { cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
@ -427,7 +375,7 @@ require("lazy").setup({
}, },
-- old one: completeopt = "menuone,noselect", -- old one: completeopt = "menuone,noselect",
completion = { completeopt = "menu,menuone,noinsert" }, completion = { completeopt = "menu,menuone,noinsert" },
mapping = cmp.mapping.preset.insert { mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(), ["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(), ["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-u>"] = cmp.mapping.scroll_docs(-4), ["<C-u>"] = cmp.mapping.scroll_docs(-4),
@ -435,9 +383,9 @@ require("lazy").setup({
["<C-b>"] = cmp.mapping.scroll_docs(-8), ["<C-b>"] = cmp.mapping.scroll_docs(-8),
["<C-f>"] = cmp.mapping.scroll_docs(8), ["<C-f>"] = cmp.mapping.scroll_docs(8),
-- Accept ([y]es) the completion -- Accept ([y]es) the completion
["<C-y>"] = cmp.mapping.confirm { select = true }, ["<C-y>"] = cmp.mapping.confirm({ select = true }),
-- Manually trigger a completion from nvim-cmp (normally not needed) -- Manually trigger a completion from nvim-cmp (normally not needed)
["<C-Space>"] = cmp.mapping.complete {}, ["<C-Space>"] = cmp.mapping.complete({}),
["<C-l>"] = cmp.mapping(function() ["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
@ -448,14 +396,15 @@ require("lazy").setup({
luasnip.jump(-1) luasnip.jump(-1)
end end
end, { "i", "s" }), end, { "i", "s" }),
}, }),
sources = { sources = {
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "luasnip" }, { name = "luasnip" },
{ name = "path" }, { name = "path" },
{ name = "neorg" }, { name = "neorg" },
{ name = "orgmode" },
}, },
} })
end, end,
}, },
@ -507,14 +456,16 @@ require("lazy").setup({
-- Examples: -- Examples:
-- - yinq - [Y]ank [I]nside [N]ext [']quote -- - yinq - [Y]ank [I]nside [N]ext [']quote
-- - ci' - [C]hange [I]nside [']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.) -- Add/delete/replace surroundings (brackets, quotes, etc.)
-- --
-- - saiw( - [S]urround [A]dd [I]nner [W]ord [)]Paren -- - saiw( - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes -- - sd' - [S]urround [D]elete [']quotes
-- - sr(' - [S]urround [R]eplace [)] ['] -- - 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 -- See 'https://github.com/echasnovski/mini.nvim' for more uses
end, end,
@ -529,6 +480,8 @@ require("lazy").setup({
"nvim-treesitter/nvim-treesitter-textobjects", "nvim-treesitter/nvim-treesitter-textobjects",
-- Keeps function description stuck on top -- Keeps function description stuck on top
"nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/nvim-treesitter-context",
-- Extra stuff
"nvim-treesitter/nvim-treesitter-refactor",
}, },
opts = { opts = {
-- Add languages to be installed here that you want installed for treesitter -- Add languages to be installed here that you want installed for treesitter
@ -539,17 +492,17 @@ require("lazy").setup({
"lua", "lua",
"vim", "vim",
"vimdoc", "vimdoc",
"org", -- "org",
"norg", "norg",
"markdown", "markdown",
}, },
ignore_install = { "latex" }, ignore_install = { "latex" },
auto_install = true, auto_install = true,
indent = { enable = true }, -- indent = { enable = true },
highlight = { highlight = {
enable = true, enable = true,
disable = { "latex" }, disable = { "latex" },
additional_vim_regex_highlighting = { "latex", "markdown" }, -- additional_vim_regex_highlighting = { "latex", "markdown" },
}, },
incremental_selection = { incremental_selection = {
@ -607,10 +560,10 @@ require("lazy").setup({
swap = { swap = {
enable = true, enable = true,
swap_next = { swap_next = {
["<leader>a"] = "@parameter.inner", ["<leader>>"] = "@parameter.inner",
}, },
swap_previous = { swap_previous = {
["<leader>A"] = "@parameter.inner", ["<leader><"] = "@parameter.inner",
}, },
}, },
lsp_interop = { 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) config = function(_, opts)
@ -634,7 +602,8 @@ require("lazy").setup({
-- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.debug',
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
{ import = "custom.plugins" }, { import = "angryluck.plugins" },
-- { import = "kickstart.plugins" },
}, { }, {
ui = { ui = {
-- Default icons, if no nerd font installed -- 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 -- modeline
-- vim: ts=2 sts=4 sw=2 et -- vim: ts=2 sts=4 sw=2 et

View File

@ -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,
})

27
lua/angryluck/keymaps.lua Normal file
View File

@ -0,0 +1,27 @@
-- [[ Basic Keymaps ]]
-- mapleader = " " and maplocalleader = " " are set in init.lua
-- Combined with 'vim.opt.hlssearch = true'
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { 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", "<leader>e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
-- Easier window movement (but conflicts with Harpoon)
-- vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
-- vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
-- vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
-- vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })

63
lua/angryluck/options.lua Normal file
View File

@ -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 <Esc> to clear highlights
vim.opt.hlsearch = true

View File

@ -1,17 +1,18 @@
return { return {
{ {
-- Best colorscheme -- Best colorscheme
'catppuccin/nvim', "catppuccin/nvim",
name = 'catppuccin', lazy = false,
name = "catppuccin",
priority = 1000, priority = 1000,
config = function() config = function()
vim.cmd.colorscheme 'catppuccin' vim.cmd.colorscheme "catppuccin"
end, end,
}, },
{ {
-- Theme inspired by Atom -- Theme inspired by Atom
'navarasu/onedark.nvim', "navarasu/onedark.nvim",
priority = 1000, priority = 1000,
-- config = function() -- config = function()
-- vim.cmd.colorscheme 'onedark' -- vim.cmd.colorscheme 'onedark'

View File

@ -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", "<leader>a", function()
-- harpoon:list():append()
-- end)
-- -- vim.keymap.set("n", "<C-g>", function()
-- -- harpoon.ui:toggle_quick_menu(harpoon:list())
-- -- end)
--
-- vim.keymap.set("n", "<C-h>", function()
-- harpoon:list():select(1)
-- end)
-- vim.keymap.set("n", "<C-j>", function()
-- harpoon:list():select(2)
-- end)
-- vim.keymap.set("n", "<C-k>", function()
-- harpoon:list():select(3)
-- end)
-- vim.keymap.set("n", "<C-l>", function()
-- harpoon:list():select(4)
-- end)
--
-- -- Toggle previous & next buffers stored within Harpoon list
-- vim.keymap.set("n", "<C-S-P>", function()
-- harpoon:list():prev()
-- end)
-- vim.keymap.set("n", "<C-S-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", "<C-g>", function()
-- toggle_telescope(harpoon:list())
-- end, { desc = "Open harpoon window" })
-- end,
}

View File

@ -0,0 +1,6 @@
return {
-- "mrcjkb/haskell-tools.nvim",
-- version = "^3", -- Recommended
-- lazy = false,
-- ft = { "haskell", "stack", "lhaskell", "cabal", "cabalproject" },
}

View File

@ -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", },
{ "<c-s>", 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,
},
}

View File

@ -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,
}

View File

@ -0,0 +1,4 @@
return {
-- Syntax highlight for rofi config (config.rasi)
"Fymyte/rasi.vim",
}

View File

@ -0,0 +1,10 @@
return {
-- -- TREESITTER SHOULD HANDLE THIS!
-- "AndrewRadev/sideways.vim",
-- config = function()
-- vim.keymap.set("n", "<leader>s<", ":SidewaysLeft<Cr>")
-- vim.keymap.set("n", "<leader>s>", ":SidewaysRight<Cr>")
-- vim.keymap.set("n", "<leader>sh", ":SidewaysJumpLeft<Cr>")
-- vim.keymap.set("n", "<leader>sl", ":SidewaysJumpRight<Cr>")
-- end,
}

View File

@ -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", "<leader>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 = "<Leader>ow",
},
note = {
org_note_finalize = "<Leader>ow",
},
},
}
end,
}

View File

@ -1,5 +0,0 @@
return {
'mrcjkb/haskell-tools.nvim',
version = '^3', -- Recommended
ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' },
}

View File

@ -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"
}

View File

@ -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,
}

View File

@ -1,3 +0,0 @@
return {
"Fymyte/rasi.vim"
}

View File

@ -1,9 +0,0 @@
return {
"AndrewRadev/sideways.vim",
config = function()
vim.keymap.set("n", "<leader>s<", ":SidewaysLeft<Cr>")
vim.keymap.set("n", "<leader>s>", ":SidewaysRight<Cr>")
vim.keymap.set("n", "<leader>sh", ":SidewaysJumpLeft<Cr>")
vim.keymap.set("n", "<leader>sl", ":SidewaysJumpRight<Cr>")
end,
}

View File

@ -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,
}

View File

@ -1,4 +1,4 @@
``` ```lua
-- Old stuff removed from config, but saving in case it should be added back. -- 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 return { -- Adds git related signs to the gutter, as well as utilities for managing changes
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",

30
todo-init.org Normal file
View File

@ -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