From 5d4a749b7c51649bcd3953cd1686856408d08121 Mon Sep 17 00:00:00 2001 From: davidpkj Date: Sat, 3 Dec 2022 22:26:26 +0100 Subject: Merge in dotfiles --- neovim/.config/nvim/init.lua | 17 ++ neovim/.config/nvim/lua/autocmd.lua | 25 ++ neovim/.config/nvim/lua/keybinds.lua | 34 +++ neovim/.config/nvim/lua/plugins.lua | 149 ++++++++++ neovim/.config/nvim/lua/plugins/catppuccin.lua | 22 ++ neovim/.config/nvim/lua/plugins/cmp.lua | 29 ++ neovim/.config/nvim/lua/plugins/fidget.lua | 9 + neovim/.config/nvim/lua/plugins/github-theme.lua | 4 + neovim/.config/nvim/lua/plugins/gitsigns.lua | 27 ++ neovim/.config/nvim/lua/plugins/lsp.lua | 79 ++++++ neovim/.config/nvim/lua/plugins/lualine.lua | 34 +++ neovim/.config/nvim/lua/plugins/mason.lua | 10 + neovim/.config/nvim/lua/plugins/pairs.lua | 2 + neovim/.config/nvim/lua/plugins/rust-tools.lua | 24 ++ neovim/.config/nvim/lua/plugins/telescope.lua | 64 +++++ neovim/.config/nvim/lua/plugins/treesitter.lua | 126 +++++++++ neovim/.config/nvim/lua/settings.lua | 53 ++++ neovim/.config/nvim/plugin/packer_compiled.lua | 333 +++++++++++++++++++++++ 18 files changed, 1041 insertions(+) create mode 100644 neovim/.config/nvim/init.lua create mode 100644 neovim/.config/nvim/lua/autocmd.lua create mode 100644 neovim/.config/nvim/lua/keybinds.lua create mode 100644 neovim/.config/nvim/lua/plugins.lua create mode 100644 neovim/.config/nvim/lua/plugins/catppuccin.lua create mode 100644 neovim/.config/nvim/lua/plugins/cmp.lua create mode 100644 neovim/.config/nvim/lua/plugins/fidget.lua create mode 100644 neovim/.config/nvim/lua/plugins/github-theme.lua create mode 100644 neovim/.config/nvim/lua/plugins/gitsigns.lua create mode 100644 neovim/.config/nvim/lua/plugins/lsp.lua create mode 100644 neovim/.config/nvim/lua/plugins/lualine.lua create mode 100644 neovim/.config/nvim/lua/plugins/mason.lua create mode 100644 neovim/.config/nvim/lua/plugins/pairs.lua create mode 100644 neovim/.config/nvim/lua/plugins/rust-tools.lua create mode 100644 neovim/.config/nvim/lua/plugins/telescope.lua create mode 100644 neovim/.config/nvim/lua/plugins/treesitter.lua create mode 100644 neovim/.config/nvim/lua/settings.lua create mode 100644 neovim/.config/nvim/plugin/packer_compiled.lua (limited to 'neovim') diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua new file mode 100644 index 0000000..ccad37a --- /dev/null +++ b/neovim/.config/nvim/init.lua @@ -0,0 +1,17 @@ +require("settings") +require("keybinds") +require("autocmd") +require("plugins") + +-- https://sharksforarms.dev/posts/neovim-rust/ +-- https://ka.codes/posts/nvim-lspinstall +-- https://rsdlt.github.io/posts/rust-nvim-ide-guide-walkthrough-development-debug/#why-neovim-for-rust-development + +-- 1. italic error signs -> probably st + +-- Pretty print lua table +function _G.dump(...) + local objects = vim.tbl_map(vim.inspect, { ... }) + print(unpack(objects)) +end + diff --git a/neovim/.config/nvim/lua/autocmd.lua b/neovim/.config/nvim/lua/autocmd.lua new file mode 100644 index 0000000..603e6b4 --- /dev/null +++ b/neovim/.config/nvim/lua/autocmd.lua @@ -0,0 +1,25 @@ +-- Custom filetypes +vim.filetype.add({ + extension = { + conf = "conf", + nd = "markdown", + }, + pattern = { + [".*%.env.*"] = "sh", + ["ignore$"] = "conf", + }, +}) + +local cmd = vim.api.nvim_create_autocmd + +-- Go to last location when opening buffer +cmd("BufReadPost", { + command = [[ if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g`\"" | endif ]] +}) + +-- Highlight the region on yank +cmd("TextYankPost", { + group = vim.api.nvim_create_augroup("TextYankGroup", { clear = true }), + callback = function() vim.highlight.on_yank({ higroup = "Visual" }) end, +}) + diff --git a/neovim/.config/nvim/lua/keybinds.lua b/neovim/.config/nvim/lua/keybinds.lua new file mode 100644 index 0000000..56834b2 --- /dev/null +++ b/neovim/.config/nvim/lua/keybinds.lua @@ -0,0 +1,34 @@ +map = function(m, k, v) + vim.keymap.set(m, k, v, { silent = true }) +end + +-- Fix * (Keep the cursor position, don't move to next match) +map("n", "*", "*N") + +-- Fix n and N. Keeping cursor in center +map("n", "n", "nzz") +map("n", "N", "Nzz") + +-- Move line up and down in NORMAL and VISUAL modes +map("n", "", "move .+1") +map("n", "", "move .-2") +map("x", "", ":move '>+1gv=gv") +map("x", "", ":move '<-2gv=gv") + +-- map("n", "", ":Files") +map("n", "", ":!compile %") + +-- Mimic shell movements +-- map("i", "", "A") +-- map("i", "", "I") + +-- Move to the next/previous buffer +-- map("n", "[", "bp") +-- map("n", "]", "bn") + +-- Move to last buffer +-- map("n", """", "b#") + +exp = {} +exp.map = map + diff --git a/neovim/.config/nvim/lua/plugins.lua b/neovim/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..5b28fbb --- /dev/null +++ b/neovim/.config/nvim/lua/plugins.lua @@ -0,0 +1,149 @@ +-- Automatically run :PackerCompile whenever plugins.lua is updated with an autocommand: +vim.api.nvim_create_autocmd("BufWritePost", { + group = vim.api.nvim_create_augroup("PACKER", { clear = true }), + pattern = "plugins.lua", + command = "source | PackerCompile", +}) + +return require("packer").startup(function(use) + use("wbthomason/packer.nvim") + use("nvim-lua/plenary.nvim") + + -- Color theme + use({ + "catppuccin/nvim", + as = "catppuccin-theme", + run = ":CatppuccinCompile", + config = function() require("plugins.catppuccin") end, + }) + + --[[ use({ + "projekt0n/github-nvim-theme", + config = function() require("plugins.github-theme") end, + }) ]] + + -- Status line + use({ + { + "nvim-lualine/lualine.nvim", + event = "BufEnter", + config = function() require("plugins.lualine") end, + }, + { + "j-hui/fidget.nvim", + after = "lualine.nvim", + config = function() require("plugins.fidget") end, + }, + }) + + -- Better syntax highlighting + use({ + { + "nvim-treesitter/nvim-treesitter", + event = "BufEnter", + config = function() require("plugins.treesitter") end, + }, + { + "nvim-treesitter/playground", + after = "nvim-treesitter" + }, + { + "nvim-treesitter/nvim-treesitter-refactor", + after = "nvim-treesitter" + }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + after = "nvim-treesitter" + }, + }) + + -- Git features + use({ + "lewis6991/gitsigns.nvim", + event = "BufEnter", + config = function() require("plugins.gitsigns") end, + }) + + -- Automatic bracket pars + use({ + "windwp/nvim-autopairs", + event = "InsertCharPre", + after = "nvim-cmp", + config = function() require("plugins.pairs") end, + }) + + -- Comment utility + use({ + "numToStr/Comment.nvim", + event = "BufEnter", + config = function() require("Comment").setup() end, + }) + + -- Fuzzy file picker + use({ + { + "nvim-telescope/telescope.nvim", + config = function() require("plugins.telescope") end, + }, + { + "nvim-telescope/telescope-fzf-native.nvim", + run = "make", + after = "telescope.nvim", + config = function() require("telescope").load_extension("fzf") end, + }, + }) + + -- Language Server Protocol + use({ + { + "neovim/nvim-lspconfig", + -- event = "BufEnter", + config = function() require("plugins.lsp") end, + }, + { + "williamboman/mason-lspconfig.nvim", + after = "nvim-lspconfig", + }, + { + "williamboman/mason.nvim", + after = "mason-lspconfig.nvim", + config = function() require("plugins.mason") end, + }, + }) + + -- Completion framework + use({ + { + "hrsh7th/nvim-cmp", + -- after = "nvim-lspconfig", + -- event = "BufEnter", + config = function() require("plugins.cmp") end, + }, + { + "hrsh7th/cmp-nvim-lsp", + after = "nvim-cmp", + }, + { + "hrsh7th/cmp-vsnip", + after = "nvim-cmp", + }, + { + "hrsh7th/cmp-path", + after = "nvim-cmp", + }, + { + "hrsh7th/cmp-buffer", + after = "nvim-cmp", + }, + { + "hrsh7th/vim-vsnip", + after = "nvim-cmp", + }, + }) + + use({ + "simrat39/rust-tools.nvim", + after = "nvim-cmp", + config = function() require("plugins.rust-tools") end, + }) +end) diff --git a/neovim/.config/nvim/lua/plugins/catppuccin.lua b/neovim/.config/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..e1780e3 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,22 @@ +vim.g.catppuccin_flavour = "macchiato" -- latte, frappe, macchiato, mocha +local colors = require("catppuccin.palettes").get_palette() -- return vim.g.catppuccin_flavour palette + +require("catppuccin").setup({ + transparent_background = true, + styles = { + comments = {}, + conditionals = {}, + }, + integration = { + telescope = true, + }, + highlight_overrides = { + all = { + CursorLine = { bg = colors.base }, + CursorLineNr = { bg = colors.base }, + }, + }, +}) + +vim.cmd([[ colorscheme catppuccin ]]) + diff --git a/neovim/.config/nvim/lua/plugins/cmp.lua b/neovim/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..18d8fe6 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,29 @@ +-- https://github.com/hrsh7th/nvim-cmp#basic-configuration +local cmp = require('cmp') + +cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = { + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Insert, + select = false, + }) + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + { name = 'path' }, + { name = 'buffer' }, + }, +}) + diff --git a/neovim/.config/nvim/lua/plugins/fidget.lua b/neovim/.config/nvim/lua/plugins/fidget.lua new file mode 100644 index 0000000..f6564d5 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/fidget.lua @@ -0,0 +1,9 @@ +require("fidget").setup({ + text = { + spinner = "dots", -- animation shown when tasks are ongoing + done = "✓", -- character shown when all tasks are complete + }, + window = { + blend = 0, -- &winblend for the window + }, +}) diff --git a/neovim/.config/nvim/lua/plugins/github-theme.lua b/neovim/.config/nvim/lua/plugins/github-theme.lua new file mode 100644 index 0000000..b000fbb --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/github-theme.lua @@ -0,0 +1,4 @@ +require('github-theme').setup({ + transparent = true, + theme_style = "dark_default", +}) diff --git a/neovim/.config/nvim/lua/plugins/gitsigns.lua b/neovim/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..61f6238 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,27 @@ +local map = vim.keymap.set + +require("gitsigns").setup({ + signs = { + add = { text = "+" }, + delete = { text = "-" }, + change = { text = "~" }, + changedelete = { text = "⋍" }, + }, + on_attach = function(buf) + local gs = package.loaded.gitsigns + local opts = { buffer = buf, expr = true, replace_keycodes = false } + + -- Navigation + map("n", "]c", "&diff ? ']c' : 'Gitsigns next_hunk'", opts) + map("n", "[c", "&diff ? '[c' : 'Gitsigns prev_hunk'", opts) + + -- Actions + map({ "n", "v" }, "hr", gs.reset_hunk, { buffer = buf }) + map({ "n", "v" }, "hs", gs.stage_hunk) + map("n", "hS", gs.stage_buffer, { buffer = buf }) + map("n", "hp", gs.preview_hunk, { buffer = buf }) + + -- Text object + map({ "o", "x" }, "ih", ":Gitsigns select_hunk", { buffer = buf }) + end, +}) diff --git a/neovim/.config/nvim/lua/plugins/lsp.lua b/neovim/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..db73c10 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,79 @@ +require("lspconfig") + +local sign = function(opts) + vim.fn.sign_define(opts.name, { + texthl = opts.name, + text = opts.text, + numhl = '' + }) +end + +sign({name = 'DiagnosticSignError', text = ''}) +sign({name = 'DiagnosticSignWarn', text = ''}) +sign({name = 'DiagnosticSignHint', text = ''}) +sign({name = 'DiagnosticSignInfo', text = ''}) + +vim.diagnostic.config({ + signs = true, + virtual_text = false, + update_in_insert = true, + underline = false, + severity_sort = true, + float = { + source = 'always', + header = '', + prefix = '', + }, +}) + +require("keybinds") + +map("n", "", "lua vim.lsp.buf.rename()") +map("n", "", "lua vim.diagnostic.open_float()") + +--[[ +nnoremap lua vim.lsp.buf.definition() +nnoremap K lua vim.lsp.buf.hover() +nnoremap gD lua vim.lsp.buf.implementation() +nnoremap lua vim.lsp.buf.signature_help() +nnoremap 1gD lua vim.lsp.buf.type_definition() +nnoremap gr lua vim.lsp.buf.references() +nnoremap g0 lua vim.lsp.buf.document_symbol() +nnoremap gW lua vim.lsp.buf.workspace_symbol() +nnoremap gd lua vim.lsp.buf.definition() + +-- Jump to the definition +bufmap('n', 'gd', 'lua vim.lsp.buf.definition()') + +-- Jump to declaration +bufmap('n', 'gD', 'lua vim.lsp.buf.declaration()') + +-- Lists all the implementations for the symbol under the cursor +bufmap('n', 'gi', 'lua vim.lsp.buf.implementation()') + +-- Jumps to the definition of the type symbol +bufmap('n', 'go', 'lua vim.lsp.buf.type_definition()') + +-- Lists all the references +bufmap('n', 'gr', 'lua vim.lsp.buf.references()') + +-- Displays a function's signature information +bufmap('n', '', 'lua vim.lsp.buf.signature_help()') + +-- Renames all references to the symbol under the cursor +bufmap('n', '', 'lua vim.lsp.buf.rename()') + +-- Selects a code action available at the current cursor position +bufmap('n', '', 'lua vim.lsp.buf.code_action()') +bufmap('x', '', 'lua vim.lsp.buf.range_code_action()') + +-- Show diagnostics in a floating window +bufmap('n', 'gl', 'lua vim.diagnostic.open_float()') + +-- Move to the previous diagnostic +bufmap('n', '[d', 'lua vim.diagnostic.goto_prev()') + +-- Move to the next diagnostic +bufmap('n', ']d', 'lua vim.diagnostic.goto_next()') +]] + diff --git a/neovim/.config/nvim/lua/plugins/lualine.lua b/neovim/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..353e691 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,34 @@ +require("lualine").setup({ + options = { + theme = "catppuccin", + component_separators = { left = "»", right = "«" }, + section_separators = "", + icons_enabled = true, + globalstatus = true, + }, + sections = { + lualine_a = { + { "mode", color = { gui = "bold" } }, + }, + lualine_b = { + { "branch" }, + { "diff", colored = false }, + }, + lualine_c = { + { "filename", file_status = true }, + { "diagnostics" }, + }, + lualine_x = { + { "filetype" }, + { "fileformat", icons_enabled = false }, + { "encoding" }, + }, + lualine_y = { + { "progress" }, + }, + lualine_z = { + { "location", color = { gui = "bold" } }, + }, + }, + extensions = { "quickfix", "nvim-tree" }, +}) diff --git a/neovim/.config/nvim/lua/plugins/mason.lua b/neovim/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..3e97958 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,10 @@ +require("mason").setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗" + } + } +}) +require("mason-lspconfig").setup() diff --git a/neovim/.config/nvim/lua/plugins/pairs.lua b/neovim/.config/nvim/lua/plugins/pairs.lua new file mode 100644 index 0000000..ed0e692 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/pairs.lua @@ -0,0 +1,2 @@ +require("nvim-autopairs").setup() +require("cmp").event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done()) diff --git a/neovim/.config/nvim/lua/plugins/rust-tools.lua b/neovim/.config/nvim/lua/plugins/rust-tools.lua new file mode 100644 index 0000000..c8442aa --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/rust-tools.lua @@ -0,0 +1,24 @@ +require("rust-tools").setup({ + tools = { + autoSetHints = true, + inlay_hints = { + auto = false, + show_parameter_hints = false, + parameter_hints_prefix = "", + other_hints_prefix = "", + }, + }, + + -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer + server = { + settings = { + -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc + ["rust-analyzer"] = { + checkOnSave = { + command = "clippy" + }, + } + } + }, +}) + diff --git a/neovim/.config/nvim/lua/plugins/telescope.lua b/neovim/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..01dcb2f --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,64 @@ +local actions = require("telescope.actions") +local finders = require("telescope.builtin") + +local action_mt = require "telescope.actions.mt" +local action_state = require "telescope.actions.state" +-- global for later inspection +custom_actions = action_mt.transform_mod({ + print_entry = function() + print(vim.inspect(action_state.get_selected_entry())) + end, +}) + +require("telescope").setup({ + defaults = { + prompt_prefix = " ", + initial_mode = "insert", + sorting_strategy = "ascending", + layout_config = { + prompt_position = "top", + }, + mappings = { + i = { + [""] = custom_actions['print_entry'], + [""] = actions.close, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.toggle_selection + actions.move_selection_next, + [""] = actions.send_selected_to_qflist, + [""] = actions.send_to_qflist, + }, + }, + }, + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + }, + }, +}) + +local Telescope = setmetatable({}, { + __index = function(_, k) + if vim.bo.filetype == "NvimTree" then + vim.cmd.wincmd("l") + end + return finders[k] + end, +}) + +vim.keymap.set("n", "", function() + local ok = pcall(Telescope.git_files, { show_untracked = true }) + if not ok then + Telescope.find_files() + end +end) + +-- Get :help at the speed of light +vim.keymap.set("n", "H", Telescope.help_tags) +-- Search for string +vim.keymap.set("n", "s", Telescope.live_grep) +-- Fuzzy find changed files in git +vim.keymap.set("n", "c", Telescope.git_status) diff --git a/neovim/.config/nvim/lua/plugins/treesitter.lua b/neovim/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..e3d8fbb --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,126 @@ +-- Treesitter folds +-- vim.o.foldmethod = "expr" +-- vim.o.foldexpr = "nvim_treesitter#foldexpr()" +-- vim.o.foldlevelstart = 99 + +require("nvim-treesitter.configs").setup({ + -- nvim-treesitter/nvim-treesitter (self config) + auto_install = true, + ensure_installed = { + "c", + "lua", + "rust", + "go", + "javascript", + "typescript", + "tsx", + "markdown", + "markdown_inline", + "html", + "css", + "json", + "bash", + }, + highlight = { + enable = true, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on "syntax" being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gs", + -- NOTE: These are visual mode mappings + node_incremental = "gs", + node_decremental = "gS", + scope_incremental = "gc", + }, + }, + -- nvim-treesitter/nvim-treesitter-textobjects + textobjects = { + select = { + enable = true, + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + ["al"] = "@loop.outer", + ["il"] = "@loop.inner", + ["aa"] = "@parameter.outer", + ["ia"] = "@parameter.inner", + ["uc"] = "@comment.outer", + + -- Or you can define your own textobjects like this + -- ["iF"] = { + -- python = "(function_definition) @function", + -- cpp = "(function_definition) @function", + -- c = "(function_definition) @function", + -- java = "(method_declaration) @function", + -- }, + }, + }, + swap = { + enable = true, + swap_next = { + ["a"] = "@parameter.inner", + ["f"] = "@function.outer", + ["e"] = "@element", + }, + swap_previous = { + ["A"] = "@parameter.inner", + ["F"] = "@function.outer", + ["E"] = "@element", + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]f"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]F"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[f"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[F"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + }, + -- windwp/nvim-ts-autotag + autotag = { + enable = true, + }, + -- nvim-treesitter/playground + playground = { + enable = true, + disable = {}, + updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code + persist_queries = false, -- Whether the query persists across vim sessions + }, + -- nvim-treesitter/nvim-treesitter-refactor + refactor = { + highlight_definitions = { enable = true }, + -- highlight_current_scope = { enable = false }, + }, + context_commentstring = { + enable = true, + enable_autocmd = false, + }, +}) diff --git a/neovim/.config/nvim/lua/settings.lua b/neovim/.config/nvim/lua/settings.lua new file mode 100644 index 0000000..e65dbff --- /dev/null +++ b/neovim/.config/nvim/lua/settings.lua @@ -0,0 +1,53 @@ +local g = vim.g +local o = vim.o + +-- Amount of lines to keep below and above the cursor +o.scrolloff = 10 + +-- I like it this way +o.number = true +o.cursorline = true +o.relativenumber = true +o.numberwidth = 4 + +o.signcolumn = "yes:1" +o.shortmess = o.shortmess .. "c" +o.completeopt = "menuone,noselect,noinsert" + +o.hidden = true +o.backup = false +o.undofile = true +o.swapfile = false +o.writebackup = false +o.encoding = "utf-8" +o.guicursor = "a:ver25-blinkwait50-blinkon50-blinkoff50" + +o.ruler = true +o.showcmd = true +o.showmode = true +o.laststatus = 2 + +o.smarttab = true +o.expandtab = true +o.autoindent = true +o.softtabstop = -1 +o.shiftwidth = 2 +o.tabstop = 2 + +-- Search is case insensitive unless /C or searched capitalized +o.hlsearch = true +o.incsearch = true +o.smartcase = true +o.ignorecase = true + +-- Invisible characters +o.list = true +o.listchars = "trail:·,nbsp:×,tab:->" + +-- Clipboard works with os +o.clipboard = "unnamedplus" + +-- Map leader to space +g.mapleader = " " +g.maplocalleader = " " + diff --git a/neovim/.config/nvim/plugin/packer_compiled.lua b/neovim/.config/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..a561012 --- /dev/null +++ b/neovim/.config/nvim/plugin/packer_compiled.lua @@ -0,0 +1,333 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + +_G._packer = _G._packer or {} +_G._packer.inside_compile = true + +local time +local profile_info +local should_profile = false +if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end +else + time = function(chunk, start) end +end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + if threshold then + table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') + end + + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/me/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/me/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/me/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/me/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/me/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + ["Comment.nvim"] = { + config = { "\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/Comment.nvim", + url = "https://github.com/numToStr/Comment.nvim" + }, + ["catppuccin-theme"] = { + config = { "\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins.catppuccin\frequire\0" }, + loaded = true, + path = "/home/me/.local/share/nvim/site/pack/packer/start/catppuccin-theme", + url = "https://github.com/catppuccin/nvim" + }, + ["cmp-buffer"] = { + after_files = { "/home/me/.local/share/nvim/site/pack/packer/opt/cmp-buffer/after/plugin/cmp_buffer.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-nvim-lsp"] = { + after_files = { "/home/me/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp/after/plugin/cmp_nvim_lsp.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-path"] = { + after_files = { "/home/me/.local/share/nvim/site/pack/packer/opt/cmp-path/after/plugin/cmp_path.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + ["cmp-vsnip"] = { + after_files = { "/home/me/.local/share/nvim/site/pack/packer/opt/cmp-vsnip/after/plugin/cmp_vsnip.lua" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/cmp-vsnip", + url = "https://github.com/hrsh7th/cmp-vsnip" + }, + ["fidget.nvim"] = { + config = { "\27LJ\2\n.\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\19plugins.fidget\frequire\0" }, + load_after = { + ["lualine.nvim"] = true + }, + loaded = false, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/fidget.nvim", + url = "https://github.com/j-hui/fidget.nvim" + }, + ["gitsigns.nvim"] = { + config = { "\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21plugins.gitsigns\frequire\0" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/gitsigns.nvim", + url = "https://github.com/lewis6991/gitsigns.nvim" + }, + ["lualine.nvim"] = { + after = { "fidget.nvim" }, + config = { "\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins.lualine\frequire\0" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, + ["mason-lspconfig.nvim"] = { + after = { "mason.nvim" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/mason-lspconfig.nvim", + url = "https://github.com/williamboman/mason-lspconfig.nvim" + }, + ["mason.nvim"] = { + config = { "\27LJ\2\n-\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\18plugins.mason\frequire\0" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/mason.nvim", + url = "https://github.com/williamboman/mason.nvim" + }, + ["nvim-autopairs"] = { + config = { "\27LJ\2\n-\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\18plugins.pairs\frequire\0" }, + load_after = {}, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/nvim-autopairs", + url = "https://github.com/windwp/nvim-autopairs" + }, + ["nvim-cmp"] = { + after = { "cmp-vsnip", "cmp-buffer", "nvim-autopairs", "cmp-nvim-lsp", "rust-tools.nvim", "vim-vsnip", "cmp-path" }, + config = { "\27LJ\2\n+\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\16plugins.cmp\frequire\0" }, + loaded = true, + only_config = true, + path = "/home/me/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-lspconfig"] = { + after = { "mason-lspconfig.nvim" }, + config = { "\27LJ\2\n+\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\16plugins.lsp\frequire\0" }, + loaded = true, + only_config = true, + path = "/home/me/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-treesitter"] = { + after = { "nvim-treesitter-textobjects", "playground", "nvim-treesitter-refactor" }, + config = { "\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins.treesitter\frequire\0" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-treesitter-refactor"] = { + load_after = { + ["nvim-treesitter"] = true + }, + loaded = false, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/nvim-treesitter-refactor", + url = "https://github.com/nvim-treesitter/nvim-treesitter-refactor" + }, + ["nvim-treesitter-textobjects"] = { + load_after = { + ["nvim-treesitter"] = true + }, + loaded = false, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/nvim-treesitter-textobjects", + url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/me/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + playground = { + load_after = { + ["nvim-treesitter"] = true + }, + loaded = false, + needs_bufread = true, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/playground", + url = "https://github.com/nvim-treesitter/playground" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/me/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["rust-tools.nvim"] = { + config = { "\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins.rust-tools\frequire\0" }, + load_after = {}, + loaded = true, + needs_bufread = true, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/rust-tools.nvim", + url = "https://github.com/simrat39/rust-tools.nvim" + }, + ["telescope-fzf-native.nvim"] = { + config = { "\27LJ\2\nH\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\1K\0\1\0\bfzf\19load_extension\14telescope\frequire\0" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/telescope-fzf-native.nvim", + url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim" + }, + ["telescope.nvim"] = { + after = { "telescope-fzf-native.nvim" }, + config = { "\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins.telescope\frequire\0" }, + loaded = true, + only_config = true, + path = "/home/me/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["vim-vsnip"] = { + load_after = {}, + loaded = true, + needs_bufread = true, + path = "/home/me/.local/share/nvim/site/pack/packer/opt/vim-vsnip", + url = "https://github.com/hrsh7th/vim-vsnip" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: nvim-lspconfig +time([[Config for nvim-lspconfig]], true) +try_loadstring("\27LJ\2\n+\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\16plugins.lsp\frequire\0", "config", "nvim-lspconfig") +time([[Config for nvim-lspconfig]], false) +-- Config for: catppuccin-theme +time([[Config for catppuccin-theme]], true) +try_loadstring("\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins.catppuccin\frequire\0", "config", "catppuccin-theme") +time([[Config for catppuccin-theme]], false) +-- Config for: nvim-cmp +time([[Config for nvim-cmp]], true) +try_loadstring("\27LJ\2\n+\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\16plugins.cmp\frequire\0", "config", "nvim-cmp") +time([[Config for nvim-cmp]], false) +-- Config for: telescope.nvim +time([[Config for telescope.nvim]], true) +try_loadstring("\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins.telescope\frequire\0", "config", "telescope.nvim") +time([[Config for telescope.nvim]], false) +-- Load plugins in order defined by `after` +time([[Sequenced loading]], true) +vim.cmd [[ packadd mason-lspconfig.nvim ]] +vim.cmd [[ packadd mason.nvim ]] + +-- Config for: mason.nvim +try_loadstring("\27LJ\2\n-\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\18plugins.mason\frequire\0", "config", "mason.nvim") + +vim.cmd [[ packadd telescope-fzf-native.nvim ]] + +-- Config for: telescope-fzf-native.nvim +try_loadstring("\27LJ\2\nH\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\1K\0\1\0\bfzf\19load_extension\14telescope\frequire\0", "config", "telescope-fzf-native.nvim") + +vim.cmd [[ packadd cmp-path ]] +vim.cmd [[ packadd vim-vsnip ]] +vim.cmd [[ packadd rust-tools.nvim ]] + +-- Config for: rust-tools.nvim +try_loadstring("\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins.rust-tools\frequire\0", "config", "rust-tools.nvim") + +vim.cmd [[ packadd cmp-nvim-lsp ]] +vim.cmd [[ packadd cmp-buffer ]] +vim.cmd [[ packadd cmp-vsnip ]] +time([[Sequenced loading]], false) +vim.cmd [[augroup packer_load_aucmds]] +vim.cmd [[au!]] + -- Event lazy-loads +time([[Defining lazy-load event autocommands]], true) +vim.cmd [[au InsertCharPre * ++once lua require("packer.load")({'nvim-autopairs'}, { event = "InsertCharPre *" }, _G.packer_plugins)]] +vim.cmd [[au BufEnter * ++once lua require("packer.load")({'gitsigns.nvim', 'Comment.nvim', 'lualine.nvim', 'nvim-treesitter'}, { event = "BufEnter *" }, _G.packer_plugins)]] +time([[Defining lazy-load event autocommands]], false) +vim.cmd("augroup END") + +_G._packer.inside_compile = false +if _G._packer.needs_bufread == true then + vim.cmd("doautocmd BufRead") +end +_G._packer.needs_bufread = false + +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end -- cgit v1.2.3