commit fae6e1fb6f95bc710b3bb7564c0e5c850c7cd1f6 Author: Robin Jenni Date: Tue Mar 10 18:39:47 2026 +0100 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..5a6625c --- /dev/null +++ b/init.lua @@ -0,0 +1,35 @@ +require("funsi") + +-- paths to check for project.godot file +local paths_to_check = { '/', '/../' } +local is_godot_project = false +local godot_project_path = '' +local cwd = vim.fn.getcwd() + +-- iterate over paths and check +for value in pairs(paths_to_check) do + if vim.uv.fs_stat(cwd .. value .. 'project.godot') then + is_godot_project = true + godot_project_path = cwd .. value + break + end +end + +-- check if server is already running in godot project path +local is_server_running = vim.uv.fs_stat(godot_project_path .. '/server.pipe') +-- start server, if not already running +if is_godot_project and not is_server_running then + vim.fn.serverstart(godot_project_path .. '/server.pipe') +end + + +-- autosave after 1 sec +vim.opt.updatetime = 1000 +vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + pattern = "*", + callback = function() + if vim.bo.modified and vim.bo.buftype == "" and vim.fn.expand("%") ~= "" then + vim.cmd("silent! write") + end + end, +}) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..734f078 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,30 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "catppuccin": { "branch": "main", "commit": "12c004cde3f36cb1d57242f1e6aac46b09a0e5b4" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, + "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lspsaga.nvim": { "branch": "main", "commit": "562d9724e3869ffd1801c572dd149cc9f8d0cc36" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "mason-registry": { "branch": "main", "commit": "7ca6d40afb94c452d779b48c59a7fa87f804e434" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, + "nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" }, + "nvim-lspconfig": { "branch": "master", "commit": "d8bf4c47385340ab2029402201d4d7c9f99f437a" }, + "nvim-tree.lua": { "branch": "master", "commit": "a0db8bf7d6488b1dcd9cb5b0dfd6684a1e14f769" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" }, + "onedarkpro.nvim": { "branch": "main", "commit": "dab7b623d48b50330c43234958c0ba2de9b501d5" }, + "outline.nvim": { "branch": "main", "commit": "ead1820d49c8e79ce89cab1c2c318981b695c9d2" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, + "vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }, + "vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }, + "vim-tmux-navigator": { "branch": "master", "commit": "e41c431a0c7b7388ae7ba341f01a0d217eb3a432" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/lua/funsi/gdscript.lua b/lua/funsi/gdscript.lua new file mode 100644 index 0000000..d92a819 --- /dev/null +++ b/lua/funsi/gdscript.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/godotengine/godot +--- +--- Language server for GDScript, used by Godot Engine. + +local port = os.getenv 'GDScript_Port' or '6005' +local cmd = vim.lsp.rpc.connect('127.0.0.1', tonumber(port)) + +---@type vim.lsp.Config +return { + cmd = cmd, + filetypes = { 'gd', 'gdscript', 'gdscript3' }, + root_markers = { 'project.godot', '.git' }, +} diff --git a/lua/funsi/init.lua b/lua/funsi/init.lua new file mode 100644 index 0000000..b408704 --- /dev/null +++ b/lua/funsi/init.lua @@ -0,0 +1,6 @@ +require("funsi.lazy_init") +require("funsi.settings") +require("funsi.keymaps") + +vim.lsp.config('gdscript', {}) +vim.lsp.enable('gdscript') diff --git a/lua/funsi/keymaps.lua b/lua/funsi/keymaps.lua new file mode 100644 index 0000000..b455fb3 --- /dev/null +++ b/lua/funsi/keymaps.lua @@ -0,0 +1,28 @@ +-- Easier window navigation +-- vim.keymap.set("n", "", "h", { noremap = true, silent = true }) +-- vim.keymap.set("n", "", "j", { noremap = true, silent = true }) +-- vim.keymap.set("n", "", "k", { noremap = true, silent = true }) +-- vim.keymap.set("n", "", "l", { noremap = true, silent = true }) +-- Telescope related +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, { + desc = 'Telescope find files' +}) +vim.keymap.set('n', 'fg', builtin.live_grep, { + desc = 'Telescope live grep' +}) +vim.keymap.set('n', 'fb', builtin.buffers, { + desc = 'Telescope buffers' +}) +vim.keymap.set('n', 'fh', builtin.help_tags, { + desc = 'Telescope help tags' +}) + +vim.keymap.set('n', 'w', ':set wrap!', { + noremap = true, silent = true }) + +vim.keymap.set("n", "i", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ 0 }), { 0 }) +end, { noremap = true, silent = true }) + +vim.keymap.set('n', 'L', 'Lspsaga show_cursor_diagnostics', { desc = 'Show diagnostic' }) diff --git a/lua/funsi/lazy_init.lua b/lua/funsi/lazy_init.lua new file mode 100644 index 0000000..865da87 --- /dev/null +++ b/lua/funsi/lazy_init.lua @@ -0,0 +1,31 @@ +-- 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) + +-- Setup map leader before initializing lazy +vim.g.mapleader = " " +vim.g.maplocalleader = " " + + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { import = "funsi.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/funsi/plugins/catppucino.lua b/lua/funsi/plugins/catppucino.lua new file mode 100644 index 0000000..b67e5bc --- /dev/null +++ b/lua/funsi/plugins/catppucino.lua @@ -0,0 +1 @@ +return { "catppuccin/nvim", name = "catppuccin", priority = 1000, opts = { transparent_background = true } } diff --git a/lua/funsi/plugins/comment.lua b/lua/funsi/plugins/comment.lua new file mode 100644 index 0000000..ae2ef02 --- /dev/null +++ b/lua/funsi/plugins/comment.lua @@ -0,0 +1,46 @@ +return { + 'numToStr/Comment.nvim', + opts = { + ---Add a space b/w comment and the line + padding = true, + ---Whether the cursor should stay at its position + sticky = true, + ---Lines to be ignored while (un)comment + ignore = nil, + ---LHS of toggle mappings in NORMAL mode + toggler = { + ---Line-comment toggle keymap + line = 'gcc', + ---Block-comment toggle keymap + block = 'gbc', + }, + ---LHS of operator-pending mappings in NORMAL and VISUAL mode + opleader = { + ---Line-comment keymap + line = 'gc', + ---Block-comment keymap + block = 'gb', + }, + ---LHS of extra mappings + extra = { + ---Add comment on the line above + above = 'gcO', + ---Add comment on the line below + below = 'gco', + ---Add comment at the end of line + eol = 'gcA', + }, + ---Enable keybindings + ---NOTE: If given `false` then the plugin won't create any mappings + mappings = { + ---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}` + basic = true, + ---Extra mapping; `gco`, `gcO`, `gcA` + extra = true, + }, + ---Function to call before (un)comment + pre_hook = nil, + ---Function to call after (un)comment + post_hook = nil, + } +} diff --git a/lua/funsi/plugins/dressing.lua b/lua/funsi/plugins/dressing.lua new file mode 100644 index 0000000..a5615cd --- /dev/null +++ b/lua/funsi/plugins/dressing.lua @@ -0,0 +1,4 @@ +return { + 'stevearc/dressing.nvim', + opts = {}, +} diff --git a/lua/funsi/plugins/harpoon.lua b/lua/funsi/plugins/harpoon.lua new file mode 100644 index 0000000..7af495f --- /dev/null +++ b/lua/funsi/plugins/harpoon.lua @@ -0,0 +1,42 @@ +return { + "ThePrimeagen/harpoon", + branch = "harpoon2", + opts = { + menu = { + width = vim.api.nvim_win_get_width(0) - 4, + }, + settings = { + save_on_toggle = true, + }, + }, + keys = function() + local keys = { + { + "h", + function() + require("harpoon"):list():add() + end, + desc = "Harpoon File", + }, + { + "H", + function() + local harpoon = require("harpoon") + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + desc = "Harpoon Quick Menu", + }, + } + + for i = 1, 5 do + table.insert(keys, { + "" .. i, + function() + require("harpoon"):list():select(i) + end, + desc = "Harpoon to File " .. i, + }) + end + return keys + end, +} diff --git a/lua/funsi/plugins/ident-blankline.lua b/lua/funsi/plugins/ident-blankline.lua new file mode 100644 index 0000000..a1e1bc9 --- /dev/null +++ b/lua/funsi/plugins/ident-blankline.lua @@ -0,0 +1,7 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + ---@module "ibl" + ---@type ibl.config + opts = {}, +} diff --git a/lua/funsi/plugins/lsp-saga.lua b/lua/funsi/plugins/lsp-saga.lua new file mode 100644 index 0000000..1aefb28 --- /dev/null +++ b/lua/funsi/plugins/lsp-saga.lua @@ -0,0 +1,18 @@ +return { + 'nvimdev/lspsaga.nvim', + config = function() + require('lspsaga').setup({ + lightbulb = { + enable = false + } + }) + vim.keymap.set('n', 'K', 'Lspsaga hover_doc', { + silent = true, + desc = 'Saga hover docs', + }) + end, + dependencies = { + 'nvim-treesitter/nvim-treesitter', + 'nvim-tree/nvim-web-devicons', + } +} diff --git a/lua/funsi/plugins/lsp.lua b/lua/funsi/plugins/lsp.lua new file mode 100644 index 0000000..4eb22b6 --- /dev/null +++ b/lua/funsi/plugins/lsp.lua @@ -0,0 +1,202 @@ +return { { + 'williamboman/mason.nvim', + lazy = false, + opts = {} +}, -- Autocompletion + { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + config = function() + local cmp = require('cmp') + + cmp.setup({ + sources = { { + name = 'nvim_lsp' + } }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + + -- Use enter to confirm completion + [''] = cmp.mapping.confirm({ + select = false + }), + + -- Navigate completions with and + [""] = cmp.mapping.select_next_item({ + behavior = cmp.SelectBehavior.Insert + }), + [""] = cmp.mapping.select_prev_item({ + behavior = cmp.SelectBehavior.Insert + }), + + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.confirm({ select = true }) + elseif vim.snippet and vim.snippet.active() then + vim.snippet.jump(1) + else + fallback() + end + end, { 'i', 's' }), + }), + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end + } + }) + end + }, -- LSP + { + 'neovim/nvim-lspconfig', + cmd = { 'LspInfo', 'LspInstall', 'LspStart' }, + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { { 'hrsh7th/cmp-nvim-lsp' }, { 'williamboman/mason.nvim' }, { 'williamboman/mason-lspconfig.nvim' } }, + init = function() + -- Reserve a space in the gutter + -- This will avoid an annoying layout shift in the screen + vim.opt.signcolumn = 'yes' + end, + config = function() + -- Add cmp_nvim_lsp capabilities settings to lspconfig + -- This should be executed before you configure any language server + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + + + -- Define the autoformat function locally + local buffer_autoformat = function(bufnr) + local group = 'lsp_autoformat' + vim.api.nvim_create_augroup(group, { + clear = false + }) + vim.api.nvim_clear_autocmds({ + group = group, + buffer = bufnr + }) + + vim.api.nvim_create_autocmd('BufWritePre', { + buffer = bufnr, + group = group, + desc = 'LSP format on save', + callback = function() + -- note: do not enable async formatting + vim.lsp.buf.format({ + async = false, + timeout_ms = 10000 + }) + end + }) + end + + -- LspAttach is where you enable features that only work + -- if there is a language server active in the file + vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + -- Autoformat on save + local id = vim.tbl_get(event, 'data', 'client_id') + local client = id and vim.lsp.get_client_by_id(id) + if client == nil then + return + end + + if client.supports_method('textDocument/formatting') then + buffer_autoformat(event.buf) + end + + -- vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', + -- { buffer = event.buf, desc = "Hover over selection" }) + vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', + { buffer = event.buf, desc = "Go to definition" }) + -- Go to definition in split window: Split window, move to left and open definition + vim.keymap.set('n', 'gD', 'vsplit | wincmd L | lua vim.lsp.buf.declaration()', + { noremap = true, silent = true, desc = "Go to definition in split window" }) + vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', + { buffer = event.buf, desc = "Go to implementation" }) + vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', + { buffer = event.buf, desc = "Go to type definition" }) + vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', + { buffer = event.buf, desc = "Show references" }) + vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', + { buffer = event.buf, desc = "Show signature help" }) + vim.keymap.set('n', 'gR', 'lua vim.lsp.buf.rename()', + { buffer = event.buf, desc = "Rename" }) + vim.keymap.set({ 'n', 'x' }, 'f', 'lua vim.lsp.buf.format({async = true})', + { buffer = event.buf, desc = "Format selection" }) + vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', + { buffer = event.buf, desc = "Code action" }) + end + }) + + vim.lsp.config('eslint', { + capabilities = capabilities, + settings = { + eslint = { + enable = true, + packageManager = "yarn", + configFiles = ".eslint.config.mjs", + validate = "on" + } + } + }) + + require('mason').setup() + + require('mason-lspconfig').setup({ + ensure_installed = { "eslint", "clangd" }, + handlers = { -- this first function is the "default handler" + -- it applies to every language server without a "custom handler" + function(server_name) + vim.lsp.config(server_name, { + capabilities = capabilities + }) + vim.lsp.enable(server_name) + end, + + lua_ls = function() + vim.lsp.config('lua_ls', { + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + globals = { 'vim' }, + }, + }, + }, + }) + vim.lsp.enable('lua_ls') + end, + + tinymist = function() + vim.lsp.config('tinymist', { + capabilities = capabilities, + settings = { + formatterMode = "typstyle", + exportPdf = "onSave", + }, + }) + vim.lsp.enable('tinymist') + end, + } + }) + + -- sourcekit is NOT managed by mason, set up separately + local lspconfig = require('lspconfig') + lspconfig["sourcekit"].setup({ + capabilities = capabilities, + cmd = { + "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp", + }, + root_dir = function(filename, _) + local util = require("lspconfig.util") + return util.root_pattern("buildServer.json")(filename) + or util.root_pattern("*.xcodeproj", "*.xcworkspace")(filename) + or util.find_git_ancestor(filename) + or util.root_pattern("Package.swift")(filename) + end, + }) + end + } } diff --git a/lua/funsi/plugins/lualine.lua b/lua/funsi/plugins/lualine.lua new file mode 100644 index 0000000..0aef424 --- /dev/null +++ b/lua/funsi/plugins/lualine.lua @@ -0,0 +1,49 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + local config = require("lualine") + + config.setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + always_show_tabline = true, + globalstatus = false, + refresh = { + statusline = 100, + tabline = 100, + winbar = 100, + } + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = { 'encoding', 'fileformat', 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'location' } + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} + } + end +} diff --git a/lua/funsi/plugins/mason-pin.lua b/lua/funsi/plugins/mason-pin.lua new file mode 100644 index 0000000..547cccb --- /dev/null +++ b/lua/funsi/plugins/mason-pin.lua @@ -0,0 +1,18 @@ +return { + { + "williamboman/mason.nvim", + version = "1.11.0", + lazy = false, + opts = {} + }, + { + "williamboman/mason-lspconfig.nvim", + version = "1.32.0" + }, + { + "williamboman/mason-registry", + version = "1.4.0" + }, + -- ... everything else stays as-is +} + diff --git a/lua/funsi/plugins/nvim-autopairs.lua b/lua/funsi/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..2db00d8 --- /dev/null +++ b/lua/funsi/plugins/nvim-autopairs.lua @@ -0,0 +1,7 @@ +return { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function +} diff --git a/lua/funsi/plugins/nvim-tree.lua b/lua/funsi/plugins/nvim-tree.lua new file mode 100644 index 0000000..ce28334 --- /dev/null +++ b/lua/funsi/plugins/nvim-tree.lua @@ -0,0 +1,30 @@ +return { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + -- disable netrw + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + -- Enable 24-bit color + vim.opt.termguicolors = true + require("nvim-tree").setup({ + filters = { + dotfiles = false, + }, + git = { + enable = true, + ignore = false, + timeout = 500 + } + }) + + vim.keymap.set("n", "e", ":NvimTreeToggle", { + noremap = true, + silent = true, + desc = "Toggle File Explorer" + }) + end +} diff --git a/lua/funsi/plugins/nvim-treesitter.lua b/lua/funsi/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..effab5e --- /dev/null +++ b/lua/funsi/plugins/nvim-treesitter.lua @@ -0,0 +1,14 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local configs = require("nvim-treesitter.configs") + + configs.setup({ + ensure_installed = { "lua", 'gdscript', 'godot_resource', 'gdshader', "vim", "javascript", "html", "rust", "typescript", "glsl", "wgsl" }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} diff --git a/lua/funsi/plugins/one-dark.lua b/lua/funsi/plugins/one-dark.lua new file mode 100644 index 0000000..c81e942 --- /dev/null +++ b/lua/funsi/plugins/one-dark.lua @@ -0,0 +1,11 @@ +return { + "olimorris/onedarkpro.nvim", + priority = 1000, -- Ensure it loads first + config = function() + require("onedarkpro").setup({ + options = { + transparency = false + } + }) + end +} diff --git a/lua/funsi/plugins/outline.lua b/lua/funsi/plugins/outline.lua new file mode 100644 index 0000000..8e5cdd6 --- /dev/null +++ b/lua/funsi/plugins/outline.lua @@ -0,0 +1,11 @@ +return { + "hedyhli/outline.nvim", + lazy = true, + cmd = { "Outline", "OutlineOpen" }, + keys = { -- Example mapping to toggle outline + { "o", "Outline", desc = "Toggle outline" }, + }, + opts = { + -- Your setup opts here + }, +} diff --git a/lua/funsi/plugins/telescope.lua b/lua/funsi/plugins/telescope.lua new file mode 100644 index 0000000..8a16e9a --- /dev/null +++ b/lua/funsi/plugins/telescope.lua @@ -0,0 +1,20 @@ +return { + 'nvim-telescope/telescope.nvim', + tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local actions = require("telescope.actions") + require('telescope').setup({ + defaults = { + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous + } + } + }, + pickers = {}, + extensions = {} + }) + end +} diff --git a/lua/funsi/plugins/tmux-navigator.lua b/lua/funsi/plugins/tmux-navigator.lua new file mode 100644 index 0000000..3af2f7b --- /dev/null +++ b/lua/funsi/plugins/tmux-navigator.lua @@ -0,0 +1,18 @@ +return { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + "TmuxNavigatorProcessList", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + { "", "TmuxNavigatePrevious" }, + }, +} diff --git a/lua/funsi/plugins/todo.lua b/lua/funsi/plugins/todo.lua new file mode 100644 index 0000000..b64ca31 --- /dev/null +++ b/lua/funsi/plugins/todo.lua @@ -0,0 +1,12 @@ +return { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, + keys = { + { + "t", + "Trouble todo toggle", + desc = "Todo List (Trouble)", + }, + }, +} diff --git a/lua/funsi/plugins/trouble.lua b/lua/funsi/plugins/trouble.lua new file mode 100644 index 0000000..e3ae746 --- /dev/null +++ b/lua/funsi/plugins/trouble.lua @@ -0,0 +1,37 @@ +return { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, +} diff --git a/lua/funsi/plugins/vim-illuminate.lua b/lua/funsi/plugins/vim-illuminate.lua new file mode 100644 index 0000000..3583374 --- /dev/null +++ b/lua/funsi/plugins/vim-illuminate.lua @@ -0,0 +1,63 @@ +return { + "RRethy/vim-illuminate", + event = "BufReadPost", + config = function() + -- default configuration + require('illuminate').configure({ + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + -- delay: delay in milliseconds + delay = 100, + -- filetype_overrides: filetype specific overrides. + -- The keys are strings to represent the filetype while the values are tables that + -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist + filetype_overrides = {}, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + 'dirbuf', + 'dirvish', + 'fugitive', + }, + -- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist + -- You must set filetypes_denylist = {} to override the defaults to allow filetypes_allowlist to take effect + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + -- See `:help mode()` for possible values + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overridden by modes_denylist + -- See `:help mode()` for possible values + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + -- large_file_cutoff: number of lines at which to use large_file_config + -- The `under_cursor` option is disabled when this cutoff is hit + large_file_cutoff = 10000, + -- large_file_config: config to use for large files (based on large_file_cutoff). + -- Supports the same keys passed to .configure + -- If nil, vim-illuminate will be disabled for large files. + large_file_overrides = nil, + -- min_count_to_highlight: minimum number of matches required to perform highlighting + min_count_to_highlight = 1, + -- should_enable: a callback that overrides all other settings to + -- enable/disable illumination. This will be called a lot so don't do + -- anything expensive in it. + should_enable = function(bufnr) return true end, + -- case_insensitive_regex: sets regex case sensitivity + case_insensitive_regex = false, + -- disable_keymaps: disable default keymaps + disable_keymaps = false, + }) + end, +} diff --git a/lua/funsi/plugins/vim-maximizer.lua b/lua/funsi/plugins/vim-maximizer.lua new file mode 100644 index 0000000..79fe36e --- /dev/null +++ b/lua/funsi/plugins/vim-maximizer.lua @@ -0,0 +1,6 @@ +return { + "szw/vim-maximizer", + keys = { + { "m", "MaximizerToggle", desc = "Maximize/minimize a split" }, + }, +} diff --git a/lua/funsi/plugins/vimtex.lua b/lua/funsi/plugins/vimtex.lua new file mode 100644 index 0000000..cb5aaf7 --- /dev/null +++ b/lua/funsi/plugins/vimtex.lua @@ -0,0 +1,9 @@ +{ + "lervag/vimtex", + lazy = false, -- we don't want to lazy load VimTeX + -- tag = "v2.15", -- uncomment to pin to a specific release + init = function() + -- VimTeX configuration goes here, e.g. + vim.g.vimtex_view_method = "zathura" + end +} diff --git a/lua/funsi/plugins/which-key.lua b/lua/funsi/plugins/which-key.lua new file mode 100644 index 0000000..700f0fc --- /dev/null +++ b/lua/funsi/plugins/which-key.lua @@ -0,0 +1,21 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + spec = { + { "x", group = "Trouble" }, + { "f", group = "Telescope" } + } + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + { "f", group = "+Telescope" }, + { "x", group = "+Trouble" } + }, +} diff --git a/lua/funsi/settings.lua b/lua/funsi/settings.lua new file mode 100644 index 0000000..1dd4da5 --- /dev/null +++ b/lua/funsi/settings.lua @@ -0,0 +1,40 @@ +-- Show relative line numbers +vim.wo.number = true +vim.wo.relativenumber = true +vim.o.cursorline = true +vim.o.cursorlineopt = "both" +vim.opt.showmode = false + +-- 4 space indenting +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +-- Some undo related stuff +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir" +vim.opt.undofile = true + +-- Search highlighting behavior +vim.opt.hlsearch = false +vim.opt.incsearch = true + +-- Good colors +vim.opt.termguicolors = true + +-- Keep space above and below when scrolling +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "80" + +vim.cmd("colorscheme catppuccin-macchiato")