diff --git a/nvim/init.lua.old b/nvim/init.lua.old deleted file mode 100644 index df110be..0000000 --- a/nvim/init.lua.old +++ /dev/null @@ -1,672 +0,0 @@ --- some basic options -local vim = vim -local fn = vim.fn - --- nvim tree said to disable netrw -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 - -vim.opt.tabstop = 4 -vim.opt.shiftwidth = 4 -vim.opt.softtabstop = 2 -vim.opt.expandtab = true -vim.opt.termguicolors = true -vim.opt.autoindent = true -vim.opt.smartindent = true -vim.opt.smarttab = true -vim.opt.number = true -vim.o.hidden = true -vim.o.signcolumn = 'auto' --- vim.o.breakindent = false -- I think this looks bad -vim.o.errorbells = true -vim.o.clipboard = "unnamedplus" -vim.g.noswapfile = true -vim.cmd [[set mouse=a]] -- enable mouse -vim.wo.cursorline = true -vim.opt.hlsearch = false -vim.opt.wrap = true -vim.opt.linebreak = true -vim.opt.showmatch = true -vim.opt.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' } -vim.opt.shortmess = vim.opt.shortmess + "c" -vim.opt.autochdir = true - -vim.o.laststatus = 3 -vim.o.cmdheight = 0 -- hides commandbar when not in use, looks ok - -vim.opt.spelllang = 'en_us' - -vim.g.python3_host_prog = fn.exepath("python3") -vim.api.nvim_create_user_command('W', 'write', {}) - -vim.opt.foldmethod = "expr" -vim.opt.foldexpr = "nvim_treesitter#foldexpr()" --- hit zc to enable folding -vim.o.foldenable = false - -vim.g.neomake_open_list = 2 - -function map(mode, shortcut, command) - vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true }) -end - --- normal mode map -function nmap(shortcut, command) - map('n', shortcut, command) -end - --- insert mode map -function imap(shortcut, command) - map('i', shortcut, command) -end - -vim.opt.guifont = "Hack Nerd Font:h12" -if vim.g.neovide then - vim.g.neovide_refresh_rate = 140 - -- change to whatever font you prefer - -- can check font with fc-cache on linux - vim.g.neovide_hide_mouse_when_typing = true - vim.g.neovide_refresh_rate_idle = 140 - vim.g.neovide_scale_factor = 1.0 - -- zoom with CTRL - and CTRL + - local change_scale_factor = function(delta) - vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta - end - vim.keymap.set("n", "", function() - change_scale_factor(1.25) - end) - vim.keymap.set("n", "", function() - change_scale_factor(1 / 1.25) - end) -end - - --- is leader key; default is \ -nmap("v", "NvimTreeToggle") -nmap("ec", "e ~/.config/nvim/init.lua") -nmap("sc", "source ~/.config/nvim/init.luaPackerCleanPackerCompile") - --- buffer commands -nmap("b", "BufferLineCyclePrev") -nmap("n", "BufferLineCycleNext") -nmap("gb", "BufferLinePick") -nmap("w", "bdelete!") -nmap("f", "Telescope live_grep") --- toggle terminal in both modes -nmap("t", "FloatermToggle") -map("t", "t", "FloatermToggle") - -nmap("dd", " lua vim.diagnostic.open_float() ") - -vim.keymap.set("n", "", function() - require("dial.map").manipulate("increment", "normal") -end) -vim.keymap.set("n", "", function() - require("dial.map").manipulate("decrement", "normal") -end) - -local augroup = vim.api.nvim_create_augroup("Lspformatting", {}) - --- lsp on_attach mappings -local on_attach = function(client, bufnr) - if (not bufnr) then - return - end - -- Enable completion triggered by - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'f', 'lua vim.lsp.buf.format({ async = true })', bufopts) - - -- require "coq".lsp_ensure_capabilities {} - require 'illuminate'.on_attach(client) - - -- format on save does not work for python for some reason - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - vim.lsp.buf.format({ - bufnr = bufnr, - }) - end - }) - end -end - -local lsp = require "lspconfig" -local lsp_defaults = lsp.util.default_config -local capabilities = require('cmp_nvim_lsp').default_capabilities() -capabilities.offsetEncoding = { "utf-16" } - -lsp.clangd.setup { on_attach = on_attach, capabilities = capabilities } -lsp.ts_ls.setup { on_attach = on_attach, capabilities = capabilities } -lsp.hls.setup { on_attach = on_attach, capabilities = capabilities } -- haskell language server --- lsp.pyright.setup { on_attach = on_attach, capabilities = capabilities } -lsp.ruff.setup { on_attach = on_attach, capabilities = capabilities } -lsp.svelte.setup { on_attach = on_attach, capabilities = capabilities } -lsp.marksman.setup { on_attach = on_attach, capabilities = capabilities } -lsp.rust_analyzer.setup { on_attach = on_attach, - capabilities = capabilities, - settings = { - ["rust-analyzer"] = { - checkOnSave = true, - check = { - enable = true, - command = "clippy", - features = "all" - } - } - } -} -lsp.lua_ls.setup { on_attach = on_attach, - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = { 'vim' } - } - } - } -} - -lsp.tailwindcss.setup { on_attach = on_attach, - capabilities = capabilities -} - -lsp.julials.setup { - capabilities = capabilities, - on_new_config = function(new_config, _) - local julia = vim.fn.expand("~/.julia/environments/nvim-lspconfig/bin/julia") - if lsp.util.path.is_file(julia) then - vim.notify("running julials") - new_config.cmd[1] = julia - end - end, - on_attach = on_attach -} - --- kill eslint_d on exit -local on_leave_group = vim.api.nvim_create_augroup("OnLeaveGroup", {}) -vim.api.nvim_create_autocmd("VimLeave", { - group = on_leave_group, - command = "silent !killall -q eslint_d", -}) - ---[[ local vertical_help = vim.api.nvim_create_augroup("vertical_help", {}) -vim.api.nvim_create_autocmd("FileType", { - pattern = 'help', - group = vertical_help, - command = ":windcmd L" -}) -]] - --- packer boilerplate -local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' -if fn.empty(fn.glob(install_path)) > 0 then - packer_bootstrap = fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', - install_path }) -end - -vim.cmd("colorscheme carbonfox") - -return require('packer').startup(function(use) - use 'wbthomason/packer.nvim' - use 'nvim-lua/plenary.nvim' - use 'neovim/nvim-lspconfig' - use { - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate', - config = function() - require('nvim-treesitter.configs').setup { - highlight = { - enable = true - }, - } - end - } - use { - 'echasnovski/mini.icons' - } - use { - 'nvim-tree/nvim-web-devicons', - } - use { - 'nvim-tree/nvim-tree.lua', - after = "nvim-web-devicons", - requires = "nvim-tree/nvim-web-devicons", - config = function() - require('nvim-tree').setup { - hijack_cursor = true, - disable_netrw = true, - select_prompts = true, - renderer = { - add_trailing = true, - hidden_display = "all", - highlight_opened_files = "icon" - } - } - end - } - use { - "hrsh7th/nvim-cmp", - requires = { - "hrsh7th/cmp-buffer", "hrsh7th/cmp-nvim-lsp", - "L3MON4D3/LuaSnip", "rafamadriz/friendly-snippets", - 'hrsh7th/cmp-nvim-lua', 'hrsh7th/cmp-path', - 'hrsh7th/cmp-calc', 'hrsh7th/cmp-cmdline', 'f3fora/cmp-spell', - }, - config = function() - local cmp = require("cmp") - local luasnip = require('luasnip') - - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end - }, - sources = { - { name = 'path' }, - { name = 'nvim_lsp', keyword_length = 1 }, - { name = 'buffer', keyword_length = 3 }, - { name = 'luasnip', keyword_length = 2 }, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered() - }, - formatting = { - fields = { 'menu', 'abbr', 'kind' }, - format = function(entry, item) - local menu_icon = { - nvim_lsp = 'λ', - luasnip = '⋗', - buffer = 'Ω', - path = '🖫', - } - - item.menu = menu_icon[entry.source.name] - return item - end, - }, - mapping = { - [''] = cmp.mapping.select_prev_item(select_opts), - [''] = cmp.mapping.select_next_item(select_opts), - - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.confirm({ select = false }), - - [''] = cmp.mapping(function(fallback) - if luasnip.jumpable(1) then - luasnip.jump(1) - else - fallback() - end - end, { 'i', 's' }), - - [''] = cmp.mapping(function(fallback) - if luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - } - }) - - cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } - }) - - -- to select something in the cmdline need to use - cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }), - matching = { disallow_symbol_nonprefix_matching = false } - }) - end, - } - use { - 'nvimtools/none-ls.nvim', - config = function() - local null_ls = require("null-ls") - local lsp_conf = require("lspconfig") - - -- util.root_pattern returns a function - local find_pyproject = lsp_conf.util.root_pattern('pyproject.toml') - local black = null_ls.builtins.formatting.black - - local eslint_format = require("none-ls.formatting.eslint_d").with({ - extra_filetypes = { "svelte" }, - }) - - local eslint_diag = require("none-ls.diagnostics.eslint_d").with({ - extra_filetypes = { "svelte" }, - }) - - local eslint_code_actions = require("none-ls.code_actions.eslint_d").with({ - extra_filetypes = { "svelte" }, - }) - - local spellcheck = null_ls.builtins.completion.spell.with({ - filetypes = { "markdown" } - }) - - null_ls.setup { - on_attach = on_attach, - sources = { - eslint_format, - eslint_diag, - eslint_code_actions, - null_ls.builtins.code_actions.gitsigns, - null_ls.builtins.completion.luasnip, - null_ls.builtins.completion.tags, - spellcheck, - --flake8, - --isort, - black, - --flake8 - } - } - end, - requires = { "nvim-lua/plenary.nvim", - "nvimtools/none-ls-extras.nvim" - }, - } - use { - 'folke/trouble.nvim', - config = function() - require("trouble").setup { - nmap("xx", "Trouble"), - } - end - } - use { - "hedyhli/outline.nvim", - config = function() - nmap("o", "Outline") - require("outline").setup { - -- Your setup opts here (leave empty to use defaults) - } - end, - } - use { - 'akinsho/bufferline.nvim', - tag = "*", - requires = 'nvim-tree/nvim-web-devicons', - config = function() - require("bufferline").setup { - options = { - offsets = { - { - filetype = "NvimTree", - text = "Neovim - Files", - highlight = "Directory", - separator = true - }, - }, - separator_style = "slope", - diagnostics = "nvim_lsp", - } - } - end - } - use { - "nvim-lualine/lualine.nvim", - event = "VimEnter", - config = function() - require("lualine").setup { - extensions = { 'nvim-tree', 'fzf', 'symbols-outline' }, - options = { - component_separators = '', - section_separators = { left = '', right = '' }, - theme = 'iceberg_dark', - globalstatus = true, - }, - sections = { - -- would be nice to open code actions but w/e - lualine_b = { - { - 'diff', - }, - }, - lualine_c = { - { - 'diagnostics', - sources = { 'nvim_diagnostic', 'nvim_lsp' }, - sections = { 'hint', 'warn', 'error' }, - colored = true, - update_in_insert = true, - always_visible = false, - on_click = function() - require("trouble").toggle("diagnostics") - end - } - }, - lualine_x = { 'filetype' } - } - } - end, - requires = { 'nvim-tree/nvim-web-devicons', opt = true } - } - use { - "startup-nvim/startup.nvim", - after = "nvim-web-devicons", - requires = { - "nvim-tree/nvim-web-devicons", - "nvim-telescope/telescope.nvim", - "nvim-lua/plenary.nvim" - }, - config = function() - local startup = require("startup") - local headers = require("startup.headers") - local start_fn = require("startup.functions") - startup.setup({ - banner = { - type = "text", - align = "center", - title = "Header", - content = headers.hydra_header, - highlight = "Statement", - }, - quote = { - type = "text", - align = "center", - fold_section = false, - title = "Quote", - margin = 5, - content = require("startup.functions").quote(), - highlight = "Constant", - default_color = "", - }, - body = { - type = "mapping", - align = "center", - fold_section = false, - title = "Basic Commands", - margin = 5, - content = { - { " New File", "lua require'startup'.new_file()", "nf" }, - { " Recent Files", "Telescope oldfiles", "of" }, - { " Find File", "Telescope find_files", "ff" }, - }, - highlight = "String", - default_color = "", - }, - plugin_info = { - type = "text", - content = require("startup.functions").packer_plugins(), - align = "center", - fold_section = false, - title = "", - margin = 5, - highlight = "TSString", - default_color = "#FFFFFF", - }, - options = { - mapping_keys = true, - }, - parts = { "banner", "quote", "body", "plugin_info" } - }) - end - } - use 'RRethy/vim-illuminate' - use { - 'nvim-telescope/telescope.nvim', - requires = { 'nvim-lua/plenary.nvim' }, - config = function() - require("telescope").setup {} - end - } - use { - 'j-hui/fidget.nvim', - config = function() - require('fidget').setup {} - end - } - use 'voldikss/vim-floaterm' - use { 'norcalli/nvim-colorizer.lua', - config = function() - require('colorizer').setup { - 'css', - 'scss', - 'javascript', - 'toml' - } - end, - } - use { 'lewis6991/gitsigns.nvim', - config = function() - require('gitsigns').setup { - on_attach = function() - nmap('hd', 'Gitsigns diffthis') - nmap('hr', 'Gitsigns reset_hunk') - nmap('td', 'Gitsigns toggle_deleted') - end - } - end - } - use { 'sudormrfbin/cheatsheet.nvim', - -- default toggle is ? - requires = { - { 'nvim-telescope/telescope.nvim' }, - { 'nvim-lua/popup.nvim' }, - { 'nvim-lua/plenary.nvim' }, - } - } - use { 'stevearc/dressing.nvim' } - if packer_bootstrap then - require('packer').sync() - end - use { - "danymat/neogen", - config = function() - local neogen = require('neogen') - neogen.setup({ - snippet_engine = "luasnip", - placeholders_hl = "None", -- fixes weird bug where the entire page gets colored with this color - languages = { - python = { - template = { - annotation_convention = "google_docstrings" - } - } - } - }) - nmap('d', ":lua require('neogen').generate()") - end - } - use { - "folke/which-key.nvim", - config = function() - local which_key = require('which-key') - which_key.setup({ - preset = "modern" - }) - end - , - } - use { - 'numToStr/Comment.nvim', - config = function() - require('Comment').setup() - end - } - use({ - "kylechui/nvim-surround", - tag = "*", -- Use for stability; omit to use `main` branch for the latest features - config = function() - require("nvim-surround").setup({ - -- Configuration here, or leave empty to use defaults - }) - end - }) - use { - 'pwntester/octo.nvim', - requires = { - 'nvim-lua/plenary.nvim', - 'nvim-telescope/telescope.nvim', - 'nvim-tree/nvim-web-devicons', - }, - config = function() - require "octo".setup() - end - } - use { - "monaqa/dial.nvim", - config = function() - local augend = require("dial.augend") - local dial = require("dial.config") - local d_map = require("dial.map") - - dial.augends:register_group { - default = { - augend.integer.alias.decimal, - augend.date.alias["%m/%d"], - augend.constant.alias.alpha, - } - } - end - } - use "EdenEast/nightfox.nvim" - --[[ use { - "benlubas/molten-nvim", - requires = { "3rd/image.nvim" }, - config = function() - vim.g.molten_image_provider = "image.nvim" - vim.g.molten_output_win_max_height = 20 - nmap("q", "MoltenEvaluateLine") - nmap("os", "MoltenEnterOutput") - end, - } ]] -end) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index f232cdc..5f3caaa 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,6 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "LuaSnip": { "branch": "master", "commit": "b3104910bb5ebf40492aadffae18f2528fa757d9" }, + "LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "cheatsheet.nvim": { "branch": "master", "commit": "9716f9aaa94dd1fd6ce59b5aae0e5f25e2a463ef" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, @@ -13,21 +13,21 @@ "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" }, + "gitsigns.nvim": { "branch": "main", "commit": "0c6826374f47fcbb2b53053986ccc59c115044ff" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, - "mini.icons": { "branch": "main", "commit": "f9a177c11daa7829389b7b6eaaec8b8a5c47052d" }, + "mini.icons": { "branch": "main", "commit": "e8fae66cb400744daeedf6e387347df50271c252" }, "neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" }, "nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" }, - "none-ls-extras.nvim": { "branch": "main", "commit": "974bf1cd73fa3f0291211212ad60f8fe6fdd68d7" }, - "none-ls.nvim": { "branch": "main", "commit": "78111a97cebed3dfda8157af8141bf1915cfc327" }, + "none-ls-extras.nvim": { "branch": "main", "commit": "d29ccbdf83b5baa402ee959cede13a8bf0230f57" }, + "none-ls.nvim": { "branch": "main", "commit": "5cf63841461b49989972d35bf886e076a1ab3649" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-colorizer.lua": { "branch": "master", "commit": "51cf7c995ed1eb6642aecf19067ee634fa1b6ba2" }, - "nvim-lspconfig": { "branch": "master", "commit": "b3cce1419ca67871ae782b3e529652f8a016f0de" }, + "nvim-lspconfig": { "branch": "master", "commit": "ff9165f06c6be4a5c68dbed35a6ab98bc5693596" }, "nvim-surround": { "branch": "main", "commit": "75de1782c781961e392efcca57601bf436f4d550" }, - "nvim-tree.lua": { "branch": "master", "commit": "e179ad2f83b5955ab0af653069a493a1828c2697" }, + "nvim-tree.lua": { "branch": "master", "commit": "87d096a39cb2d5d43e6771563575ff042a79f48b" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" }, + "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, "outline.nvim": { "branch": "main", "commit": "6b62f73a6bf317531d15a7ae1b724e85485d8148" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },