vim.g.mapleader = "," -- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("config") .. "/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 lazy.nvim require("lazy").setup({ spec = { { 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons' } }, { 'vimwiki/vimwiki', -- Use `init`, NOT `config`, to set globals before load. init = function() vim.g.vimwiki_ext2syntax = { ['.Rmd'] = 'markdown', ['.rmd'] = 'markdown', ['.md'] = 'markdown', ['.markdown'] = 'markdown', ['.mdown'] = 'markdown' } vim.g.vimwiki_list = { { path = '~/.local/share/vimwiki', syntax = 'markdown', ext = '.md' }, { path = '~/.local/share/vimwiki/Finance', syntax = 'markdown', ext = '.md' }, { path = '~/.local/share/vimwiki/Finance/Fundamentals', syntax = 'markdown', ext = '.md' }, { path = '~/.local/share/vimwiki/Finance/Research', syntax = 'markdown', ext = '.md' }, { path = '~/.local/share/vimwiki/Finance/Research/Tickers', syntax = 'markdown', ext = '.md' }, { path = '~/.local/share/vimwiki/cs', syntax = 'markdown', ext = '.md' }, { path = '~/.local/share/vimwiki/cs/Gentoo', syntax = 'markdown', ext = '.md' }, { path = '~/.local/share/vimwiki/arcana', syntax = 'markdown', ext = '.md' }, { path = '~/.local/share/Cuisine', syntax = 'markdown', ext = '.md' }, } vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c' end, -- Optionally, you can lazy-load Vimwiki only for specific filetypes or via keymaps: -- event = "BufEnter *.md", -- keys = { "ww"}, }, { 'michal-h21/vimwiki-sync', init = function() vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c' end, }, { 'MeanderingProgrammer/render-markdown.nvim', dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, ---@module 'render-markdown' ---@type render.md.UserConfig opts = {}, } }, -- automatically check for plugin updates checker = { enabled = true }, }) -- General settings vim.opt.title = true vim.opt.mouse = "a" vim.opt.clipboard:append("unnamedplus") vim.opt.showmode = false vim.opt.ruler = false vim.opt.laststatus = 0 vim.opt.showcmd = false vim.opt.scrolloff = 7 vim.opt.swapfile = false vim.opt.backup = false vim.cmd('colorscheme bloomberg') --vim.cmd('hi Normal ctermbg=NONE') --vim.cmd('hi NonText ctermbg=NONE') -- --require("pyrepl").setup({ -- url = "http://localhost:5000/execute" --}) --vim.keymap.set('v', 'p', function() -- require('pyrepl').run_selected_lines() -- end, { desc = "Run selected lines" }) --require ............ require('lualine').setup() --ensure render-markdown also render vimwiki vim.treesitter.language.register('markdown', 'vimwiki') -- Basics vim.keymap.set('n', 'c', '"_c') vim.cmd('filetype plugin on') vim.cmd('syntax on') vim.opt.encoding = "utf-8" vim.opt.number = true vim.opt.relativenumber = true -- Enable autocmpletion: vim.opt.wildmode = "longest,list,full" -- Disable automatic commenting on new line vim.opt.formatoptions:remove({'c', 'r', 'o'}) -- Splits open at the bottom and right, which is non-retarded, unlike vim defaults. vim.opt.splitbelow = true vim.opt.splitright = true -- Autocommands -- Automatically deletes all trailing whitespace and newlines at end of file on save & reset cursor position. vim.api.nvim_create_augroup('Format', {clear = true}) vim.api.nvim_create_autocmd('BufWritePre', { group = 'Format', pattern = '*', callback = function() local pos = vim.fn.getpos('.') vim.cmd([[silent! keeppatterns %s/\s\+$//e]]) vim.cmd([[silent! keeppatterns %s/\n\+\%$//e]]) local fname = vim.fn.expand('%') if fname:match('%.c$') or fname:match('%.h$') then vim.cmd([[silent! keeppatterns %s/\%$/\r/e]]) end if fname:match('neomutt') then vim.cmd([[silent! keeppatterns %s/^--$/-- /e]]) end vim.fn.cursor(pos[2], pos[3]) end }) -- When shortcut files are updated, renew configs with new material: vim.api.nvim_create_autocmd("BufWritePost", { pattern = { "bm-files", "bm-dirs" }, command = "!shortcuts" }) -- Run xrdb whenever Xdefaults or Xresources are updated. vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, command = "set filetype=xdefaults" }) vim.api.nvim_create_autocmd("BufWritePost", { pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, command = "!xrdb %" }) -- Vimwiki configuration --vim.g.vimwiki_ext2syntax = {['.Rmd'] = 'markdown', ['.rmd'] = 'markdown', ['.md'] = 'markdown', ['.markdown'] = 'markdown', ['.mdown'] = 'markdown'} --vim.g.vimwiki_list = { -- {path = '~/.local/share/vimwiki', syntax = 'markdown', ext = '.md'}, -- {path = '~/.local/share/vimwiki/Finance', syntax = 'markdown', ext = '.md'}, -- {path = '~/.local/share/vimwiki/Finance/Fundamentals', syntax = 'markdown', ext = '.md'}, -- {path = '~/.local/share/vimwiki/Finance/Research', syntax = 'markdown', ext = '.md'}, -- {path = '~/.local/share/vimwiki/Finance/Research/Tickers', syntax = 'markdown', ext = '.md'}, -- {path = '~/.local/share/vimwiki/cs', syntax = 'markdown', ext = '.md'}, -- {path = '~/.local/share/vimwiki/cs/Gentoo', syntax = 'markdown', ext = '.md'}, -- {path = '~/.local/share/vimwiki/arcana', syntax = 'markdown', ext = '.md'}, -- {path = '~/.local/share/Cuisine', syntax = 'markdown', ext = '.md'} --} --vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c' vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "/tmp/calcurse*", "~/.calcurse/notes/*" }, command = "set filetype=markdown" }) vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "*.ms", "*.me", "*.mom", "*.man" }, command = "set filetype=groff" }) vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = "*.tex", command = "set filetype=tex" }) -- Runs a script that cleans out tex build files whenever I close out of a .tex file. vim.api.nvim_create_autocmd("VimLeave", { pattern = "*.tex", command = "!texclear %" }) -- Save file as sudo on files that require root permission vim.cmd([[cabbrev w!! execute 'silent! write !sudo tee % >/dev/null' \| edit!]]) -- Bindings -- Spell-check set to o, 'o' for 'orthography' vim.keymap.set("n", "o", ":setlocal spell! spelllang=en_us", { desc = "Toggle spell-check (en_us)" }) -- Compile document, be it groff/LaTeX/markdown/etc. vim.keymap.set("n", "c", ':w! | !compiler "%"', { desc = "Compile document, be it groff/LaTeX/markdown/etc." }) -- Open corresponding .pdf/.html or preview --vim.keymap.set("n", "p", ':!opout "%"', { desc = "Open PDF/HTML/preview for current file" }) vim.keymap.set('v', 'p', function() require('pyrepl').run_selected_lines() end, { desc = "Run selected lines" })