From 26694e09e8f5bf2262737312e7ad217118db20de Mon Sep 17 00:00:00 2001 From: joott Date: Wed, 30 Jul 2025 15:53:29 -0400 Subject: switching to yadm --- .config/nvim/lua/commands.lua | 28 +++++++++++ .config/nvim/lua/keymaps.lua | 96 +++++++++++++++++++++++++++++++++++ .config/nvim/lua/luasnip-helpers.lua | 41 +++++++++++++++ .config/nvim/lua/luasnip-nodes.lua | 31 ++++++++++++ .config/nvim/lua/options.lua | 35 +++++++++++++ .config/nvim/lua/plugins.lua | 97 ++++++++++++++++++++++++++++++++++++ 6 files changed, 328 insertions(+) create mode 100644 .config/nvim/lua/commands.lua create mode 100644 .config/nvim/lua/keymaps.lua create mode 100644 .config/nvim/lua/luasnip-helpers.lua create mode 100644 .config/nvim/lua/luasnip-nodes.lua create mode 100644 .config/nvim/lua/options.lua create mode 100644 .config/nvim/lua/plugins.lua (limited to '.config/nvim/lua') diff --git a/.config/nvim/lua/commands.lua b/.config/nvim/lua/commands.lua new file mode 100644 index 0000000..45b674f --- /dev/null +++ b/.config/nvim/lua/commands.lua @@ -0,0 +1,28 @@ +vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "*", + callback = function() + package.loaded["feline"] = nil + package.loaded["neopywal.theme.plugins.feline"] = nil + require("feline").setup({ + components = require("neopywal.theme.plugins.feline").get(), + }) + end, +}) + +vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, { + pattern = '*.jl', + callback = function(ev) + vim.keymap.set('n', 'js', 'lua _jlrepl_open()', { noremap = true, silent = true , buffer = true }) + end +}) + +vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, { + pattern = '*.tex', + callback = function(ev) + vim.keymap.set('i', '', [[: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/"':w]], { buffer = true}) + vim.keymap.set('n', '', [[: silent exec '!inkscape-figures edit "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &':redraw!]], { buffer = true}) + + vim.keymap.set('i', '', [[: silent exec '.!xoppdog shake "'.getline('.').'" "'.b:vimtex.root.'/figures/"':w]], { buffer = true}) + vim.keymap.set('n', '', [[: silent exec '!xoppdog fetch "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &':redraw!]], { buffer = true}) + end +}) diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua new file mode 100644 index 0000000..519b336 --- /dev/null +++ b/.config/nvim/lua/keymaps.lua @@ -0,0 +1,96 @@ +local function map(m, k, v) + vim.keymap.set(m, k, v, { noremap = true, silent = true }) +end +local builtin = require('telescope.builtin') + +map('', '', 'gk') +map('', '', 'gj') +map('n', 'J', 'mzJ`z') + +map('', 'o', 'o') +map('', 'O', 'O') + +map('t', '', [[]]) + +map('n', 'W', 'set wrap!') + +-- telescope +map('n', 'pf', builtin.find_files, {}) +map('n', 'pg', function() + -- If the directory is not a git repository, fallback to regular find_files. + if pcall(builtin.git_files) then + else + pcall(builtin.find_files) + end +end, {}) +map('n', 'fs', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) +end, {}) + +-- mini +map('n', '-', 'lua MiniFiles.open()') +map('n', 'wt', 'lua MiniTrailspace.trim()') + +-- toggleterm +map('n', 'g', 'lua _lazygit_toggle()') + +-- misc plugin keymaps +map('n', 'u', vim.cmd.UndotreeToggle) + +map('n', '', vim.cmd.HopWord) + +map('n', 'vv', vim.cmd.VimtexCompile) +map('n', 'vc', 'VimtexClean!') + +map('n', 'tw', 'Twilight') + +map('n', 'o', 'Outline') + +-- buffers +map('n', '', 'bnext') +map('n', '', 'bprevious') +map('n', 'br', 'BufferClose') +map('n', 'Q', 'BufferClose!') +map('n', 'bn', 'BufferOrderByBufferNumber') +map('n', 'U', 'bufdo bd') --close all +map('n', 'vs', 'vsplitbnext') --ver split + open next buffer + +-- buffer position nav + reorder +map('n', '', 'BufferMovePrevious') +map('n', '', 'BufferMoveNext') +map('n', '', 'BufferGoto 1') +map('n', '', 'BufferGoto 2') +map('n', '', 'BufferGoto 3') +map('n', '', 'BufferGoto 4') +map('n', '', 'BufferGoto 5') +map('n', '', 'BufferGoto 6') +map('n', '', 'BufferGoto 7') +map('n', '', 'BufferGoto 8') +map('n', '', 'BufferGoto 9') +map('n', '', 'BufferLast') +map('n', '', 'BufferPin') + +-- window resizing +map('n', '', ':vertical resize -2') +map('n', '', ':vertical resize +2') +map('n', '', ':resize +2') +map('n', '', ':resize -2') + +-- clipboard management +map('x', 'p', '\"_dP') + +map('n', 'y', '\"+y') +map('v', 'y', '\"+y') +map('n', 'Y', '\"+Y') + +map('n', 'd', '\"+d') +map('v', 'd', '\"+d') + +-- luasnip +vim.cmd([[ +imap luasnip#expand_or_jumpable() ? 'luasnip-expand-or-jump' : '' +inoremap lua require'luasnip'.jump(-1) + +snoremap lua require('luasnip').jump(1) +snoremap lua require('luasnip').jump(-1) +]]) diff --git a/.config/nvim/lua/luasnip-helpers.lua b/.config/nvim/lua/luasnip-helpers.lua new file mode 100644 index 0000000..e912046 --- /dev/null +++ b/.config/nvim/lua/luasnip-helpers.lua @@ -0,0 +1,41 @@ +local n = require("luasnip-nodes") +local utils = {} + +utils.get_visual = function(args, parent) + if (#parent.snippet.env.LS_SELECT_RAW > 0) then + return n.sn(nil, n.i(1, parent.snippet.env.LS_SELECT_RAW)) + else -- If LS_SELECT_RAW is empty, return a blank insert node + return n.sn(nil, n.i(1)) + end +end + +utils.in_mathzone = function() -- math context detection + return vim.fn['vimtex#syntax#in_mathzone']() == 1 +end +utils.in_text = function() + return not utils.in_mathzone() +end +utils.in_comment = function() -- comment detection + return vim.fn['vimtex#syntax#in_comment']() == 1 +end +utils.in_env = function(name) -- generic environment detection + local is_inside = vim.fn['vimtex#env#is_inside'](name) + return (is_inside[1] > 0 and is_inside[2] > 0) +end +-- A few concrete environments---adapt as needed +utils.in_equation = function() -- equation environment detection + return utils.in_env('equation') +end +utils.in_itemize = function() -- itemize environment detection + return utils.in_env('itemize') +end +utils.in_enumerate = function() -- itemize environment detection + return utils.in_env('enumerate') +end +utils.in_tikz = function() -- TikZ picture environment detection + return utils.in_env('tikzpicture') +end + +utils.line_begin = require("luasnip.extras.expand_conditions").line_begin + +return utils diff --git a/.config/nvim/lua/luasnip-nodes.lua b/.config/nvim/lua/luasnip-nodes.lua new file mode 100644 index 0000000..1b48f00 --- /dev/null +++ b/.config/nvim/lua/luasnip-nodes.lua @@ -0,0 +1,31 @@ +local nodes = {} + +local ls = require("luasnip") +local extras = require("luasnip.extras") + +nodes.s = ls.snippet +nodes.sn = ls.snippet_node +nodes.isn = ls.indent_snippet_node +nodes.t = ls.text_node +nodes.i = ls.insert_node +nodes.f = ls.function_node +nodes.c = ls.choice_node +nodes.d = ls.dynamic_node +nodes.r = ls.restore_node +nodes.events = require("luasnip.util.events") +nodes.ai = require("luasnip.nodes.absolute_indexer") +nodes.l = extras.lambda +nodes.rep = extras.rep +nodes.p = extras.partial +nodes.m = extras.match +nodes.n = extras.nonempty +nodes.dl = extras.dynamic_lambda +nodes.fmt = require("luasnip.extras.fmt").fmt +nodes.fmta = require("luasnip.extras.fmt").fmta +nodes.conds = require("luasnip.extras.expand_conditions") +nodes.postfix = require("luasnip.extras.postfix").postfix +nodes.types = require("luasnip.util.types") +nodes.parse = require("luasnip.util.parser").parse_snippet +nodes.ms = ls.multi_snippet + +return nodes diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua new file mode 100644 index 0000000..cd293f4 --- /dev/null +++ b/.config/nvim/lua/options.lua @@ -0,0 +1,35 @@ +vim.cmd "set undofile" +-- vim.opt.isfname:append("@-@") +vim.g.mapleader = ' ' + +local options = { + nu = true, + relativenumber = true, + + tabstop = 4, + softtabstop = 4, + shiftwidth = 4, + expandtab = true, + + smartindent = false, + autoindent = true, + + wrap = true, + + hlsearch = false, + incsearch = true, + + scrolloff = 8, + signcolumn = "no", + cursorline = true, + cursorlineopt = "number", + + ignorecase = true, + smartcase = true, + + showmode = false, +} + +for k, v in pairs(options) do + vim.opt[k] = v +end diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..8ddca61 --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -0,0 +1,97 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + "nvim-tree/nvim-web-devicons", + "mbbill/undotree", + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "neovim/nvim-lspconfig", + 'hrsh7th/nvim-cmp', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'saadparwaiz1/cmp_luasnip', + 'feline-nvim/feline.nvim', + 'lervag/vimtex', + 'MeanderingProgrammer/render-markdown.nvim', + 'sitiom/nvim-numbertoggle', + 'folke/twilight.nvim', + 'lewis6991/gitsigns.nvim', + { 'akinsho/toggleterm.nvim', version = "*", config = true }, + { 'echasnovski/mini.files', version = '*' }, + { 'echasnovski/mini.trailspace', version = '*' }, + { 'echasnovski/mini.move', version = '*' }, + { 'numToStr/Comment.nvim', lazy = false, }, + { + "goolord/alpha-nvim", + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + local startify = require("alpha.themes.startify") + startify.file_icons.provider = "devicons" + require("alpha").setup( + startify.config + ) + end, + }, + { + 'nvim-telescope/telescope.nvim', branch = '0.1.x', + dependencies = { 'nvim-lua/plenary.nvim' } + }, + { + "nvim-treesitter/nvim-treesitter", + build = function() + require("nvim-treesitter.install").update({ with_sync = true }) + end, + }, + { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp" + }, + { + "smoka7/hop.nvim", + version = "*", + config = function() + require("hop").setup({ keys = "tnseridhaofuwyplcqxz" }) + end, + }, + { + 'romgrk/barbar.nvim', + init = function() vim.g.barbar_auto_setup = false end, + opts = { + sidebar_filetypes = { + undotree = { + text = 'undotree', + align = 'center', + }, + }, + }, + }, + { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true + }, + { + 'RedsXDD/neopywal.nvim', + name = "neopywal", + lazy = false, + priority = 1000, + }, + { + 'hedyhli/outline.nvim', + config = function() require("outline").setup() end, + }, +}) -- cgit v1.3