From c9553d36a3b089a3cfdd4390c625ae5051ee15c2 Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Tue, 17 Dec 2024 10:36:34 -0600 Subject: [PATCH 01/12] switch to Packer --- lua/user/cmp.lua | 131 ++++++++++++++++++++ lua/user/colorscheme.lua | 7 ++ lua/user/keymaps.lua | 108 ++++++++++++++++ lua/user/lsp/handlers.lua | 91 ++++++++++++++ lua/user/lsp/init.lua | 9 ++ lua/user/lsp/mason.lua | 52 ++++++++ lua/user/lsp/null-ls.lua | 19 +++ lua/user/lsp/settings/jsonls.lua | 197 ++++++++++++++++++++++++++++++ lua/user/lsp/settings/lua_ls.lua | 16 +++ lua/user/lsp/settings/pyright.lua | 9 ++ lua/user/options.lua | 46 +++++++ lua/user/plugins.lua | 81 ++++++++++++ lua/user/telescope.lua | 136 +++++++++++++++++++++ 13 files changed, 902 insertions(+) create mode 100644 lua/user/cmp.lua create mode 100644 lua/user/colorscheme.lua create mode 100644 lua/user/keymaps.lua create mode 100644 lua/user/lsp/handlers.lua create mode 100644 lua/user/lsp/init.lua create mode 100644 lua/user/lsp/mason.lua create mode 100644 lua/user/lsp/null-ls.lua create mode 100644 lua/user/lsp/settings/jsonls.lua create mode 100644 lua/user/lsp/settings/lua_ls.lua create mode 100644 lua/user/lsp/settings/pyright.lua create mode 100644 lua/user/options.lua create mode 100644 lua/user/plugins.lua create mode 100644 lua/user/telescope.lua diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua new file mode 100644 index 00000000000..2da236c4c28 --- /dev/null +++ b/lua/user/cmp.lua @@ -0,0 +1,131 @@ +local cmp_status_ok, cmp = pcall(require, "cmp") +if not cmp_status_ok then + return +end + +local snip_status_ok, luasnip = pcall(require, "luasnip") +if not snip_status_ok then + return +end + +require("luasnip/loaders/from_vscode").lazy_load() + +local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" +end + +--   פּ ﯟ   some other good icons +local kind_icons = { + Text = "", + Method = "m", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", +} +-- find more here: https://www.nerdfonts.com/cheat-sheet + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [""] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping.confirm { select = true }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + -- Kind icons + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind + vim_item.menu = ({ + nvim_lsp = "[LSP]", + nvim_lua = "[NVIM_LUA]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + window = { + documentation = cmp.config.window.bordered() + }, + experimental = { + ghost_text = false, + native_menu = false, + }, +} diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua new file mode 100644 index 00000000000..e180a953aa9 --- /dev/null +++ b/lua/user/colorscheme.lua @@ -0,0 +1,7 @@ +local colorscheme = 'default' + +local status_ok, _ = pcall(vim.cmd, 'colorscheme ' .. colorscheme) +if not status_ok then + vim.notify('colorscheme ' .. colorscheme .. ' not found!') + return +end diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua new file mode 100644 index 00000000000..ec910283346 --- /dev/null +++ b/lua/user/keymaps.lua @@ -0,0 +1,108 @@ +local opts = { noremap = true, silent = true } + +local term_opts = { silent = true } + +-- Shorten function name +local keymap = vim.api.nvim_set_keymap + +--Remap space as leader key +keymap('', '', '', opts) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- Modes +-- normal_mode = "n", +-- insert_mode = "i", +-- visual_mode = "v", +-- visual_block_mode = "x", +-- term_mode = "t", +-- command_mode = "c", + +-- Normal -- +-- Better window navigation +keymap('n', '', 'h', opts) +keymap('n', '', 'j', opts) +keymap('n', '', 'k', opts) +keymap('n', '', 'l', opts) + +keymap('n', 'e', ':Lex 30', opts) -- hit again to close + +-- Resize with arrows +keymap('n', '', ':resize +2', opts) +keymap('n', '', ':resize -2', opts) +keymap('n', '', ':vertical resize -2', opts) +keymap('n', '', ':vertical resize +2', opts) + +-- Navigate buffers +keymap('n', '', ':bnext', opts) +keymap('n', '', ':bprevious', opts) + +-- Insert -- +-- Press jk fast to enter +keymap('i', 'jk', '', opts) + +-- Visual -- +-- Stay in indent mode +keymap('v', '<', '', '>gv', opts) + +-- Move text up and down +keymap('v', '', ':m .+1==', opts) +keymap('v', '', ':m .-2==', opts) +keymap('v', 'p', '"_dP', opts) + +-- Visual Block -- +-- Move text up and down +keymap('x', 'J', ":move '>+1gv-gv", opts) +keymap('x', 'K', ":move '<-2gv-gv", opts) +keymap('x', '', ":move '>+1gv-gv", opts) +keymap('x', '', ":move '<-2gv-gv", opts) + +-- Terminal -- +-- Better terminal navigation +keymap('t', '', 'h', term_opts) +keymap('t', '', 'j', term_opts) +keymap('t', '', 'k', term_opts) +keymap('t', '', 'l', term_opts) + + +-- keymap("n", "f", "Telescope find_files", opts) +keymap("n", "f", "lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))", opts) +keymap("n", "", "Telescope live_grep", opts) +-- +-- See `:help telescope.builtin` +local builtin = require 'telescope.builtin' +vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) +vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) +vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) +vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) +vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) +vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) +vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + +-- Slightly advanced example of overriding default behavior and theme +vim.keymap.set('n', '/', function() + -- You can pass additional configuration to Telescope to change the theme, layout, etc. + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) +end, { desc = '[/] Fuzzily search in current buffer' }) + +-- It's also possible to pass additional configuration options. +-- See `:help telescope.builtin.live_grep()` for information about particular keys +-- vim.keymap.set('n', 's/', function() +-- builtin.live_grep { +-- grep_open_files = true, +-- prompt_title = 'Live Grep in Open Files', +-- } +-- end, { desc = '[S]earch [/] in Open Files' }) + +-- Shortcut for searching your Neovim configuration files +vim.keymap.set('n', 'sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } +end, { desc = '[S]earch [N]eovim files' }) + diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua new file mode 100644 index 00000000000..b540d09bf40 --- /dev/null +++ b/lua/user/lsp/handlers.lua @@ -0,0 +1,91 @@ +local M = {} + +local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") +if not status_cmp_ok then + return +end + +M.capabilities = vim.lsp.protocol.make_client_capabilities() +M.capabilities.textDocument.completion.completionItem.snippetSupport = true +M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities) + +M.setup = function() + local signs = { + + { name = "DiagnosticSignError", text = "" }, + { name = "DiagnosticSignWarn", text = "" }, + { name = "DiagnosticSignHint", text = "" }, + { name = "DiagnosticSignInfo", text = "" }, + } + + for _, sign in ipairs(signs) do + vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) + end + + local config = { + virtual_text = false, -- disable virtual text + signs = { + active = signs, -- show signs + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = true, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + } + + vim.diagnostic.config(config) + + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "rounded", + }) + + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "rounded", + }) +end + +local function lsp_keymaps(bufnr) + local opts = { noremap = true, silent = true } + local keymap = vim.api.nvim_buf_set_keymap + keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) + keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) + keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) + keymap(bufnr, "n", "gI", "lua vim.lsp.buf.implementation()", opts) + keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) + keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", opts) + keymap(bufnr, "n", "lf", "lua vim.lsp.buf.format{ async = true }", opts) + keymap(bufnr, "n", "li", "LspInfo", opts) + keymap(bufnr, "n", "lI", "LspInstallInfo", opts) + keymap(bufnr, "n", "la", "lua vim.lsp.buf.code_action()", opts) + keymap(bufnr, "n", "lj", "lua vim.diagnostic.goto_next({buffer=0})", opts) + keymap(bufnr, "n", "lk", "lua vim.diagnostic.goto_prev({buffer=0})", opts) + keymap(bufnr, "n", "lr", "lua vim.lsp.buf.rename()", opts) + keymap(bufnr, "n", "ls", "lua vim.lsp.buf.signature_help()", opts) + keymap(bufnr, "n", "lq", "lua vim.diagnostic.setloclist()", opts) +end + +M.on_attach = function(client, bufnr) + if client.name == "tsserver" then + client.server_capabilities.documentFormattingProvider = false + end + + if client.name == "sumneko_lua" then + client.server_capabilities.documentFormattingProvider = false + end + + lsp_keymaps(bufnr) + local status_ok, illuminate = pcall(require, "illuminate") + if not status_ok then + return + end + illuminate.on_attach(client) +end + +return M diff --git a/lua/user/lsp/init.lua b/lua/user/lsp/init.lua new file mode 100644 index 00000000000..0cc7120d24f --- /dev/null +++ b/lua/user/lsp/init.lua @@ -0,0 +1,9 @@ +local status_ok, _ = pcall(require, "lspconfig") +if not status_ok then + return +end + +require "user.lsp.mason" +require("user.lsp.handlers").setup() +require "user.lsp.null-ls" + diff --git a/lua/user/lsp/mason.lua b/lua/user/lsp/mason.lua new file mode 100644 index 00000000000..6bdd03d562d --- /dev/null +++ b/lua/user/lsp/mason.lua @@ -0,0 +1,52 @@ +local servers = { + "lua_ls", + -- "cssls", + -- "html", + -- "tsserver", + "pyright", + -- "bashls", + "jsonls", + -- "yamlls", +} + +local settings = { + ui = { + border = "none", + icons = { + package_installed = "◍", + package_pending = "◍", + package_uninstalled = "◍", + }, + }, + log_level = vim.log.levels.INFO, + max_concurrent_installers = 4, +} + +require("mason").setup(settings) +require("mason-lspconfig").setup({ + ensure_installed = servers, + automatic_installation = true, +}) + +local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") +if not lspconfig_status_ok then + return +end + +local opts = {} + +for _, server in pairs(servers) do + opts = { + on_attach = require("user.lsp.handlers").on_attach, + capabilities = require("user.lsp.handlers").capabilities, + } + + server = vim.split(server, "@")[1] + + local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server) + if require_ok then + opts = vim.tbl_deep_extend("force", conf_opts, opts) + end + + lspconfig[server].setup(opts) +end diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua new file mode 100644 index 00000000000..874e19c532a --- /dev/null +++ b/lua/user/lsp/null-ls.lua @@ -0,0 +1,19 @@ +local null_ls_status_ok, null_ls = pcall(require, "null-ls") +if not null_ls_status_ok then + return +end + +-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting +local formatting = null_ls.builtins.formatting +-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics +local diagnostics = null_ls.builtins.diagnostics + +null_ls.setup({ + debug = false, + sources = { + formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), + formatting.black.with({ extra_args = { "--fast" } }), + formatting.stylua, + -- diagnostics.flake8 + }, +}) diff --git a/lua/user/lsp/settings/jsonls.lua b/lua/user/lsp/settings/jsonls.lua new file mode 100644 index 00000000000..e202e1e1d9b --- /dev/null +++ b/lua/user/lsp/settings/jsonls.lua @@ -0,0 +1,197 @@ +local default_schemas = nil +local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls") +if status_ok then + default_schemas = jsonls_settings.get_default_schemas() +end + +local schemas = { + { + description = "TypeScript compiler configuration file", + fileMatch = { + "tsconfig.json", + "tsconfig.*.json", + }, + url = "https://json.schemastore.org/tsconfig.json", + }, + { + description = "Lerna config", + fileMatch = { "lerna.json" }, + url = "https://json.schemastore.org/lerna.json", + }, + { + description = "Babel configuration", + fileMatch = { + ".babelrc.json", + ".babelrc", + "babel.config.json", + }, + url = "https://json.schemastore.org/babelrc.json", + }, + { + description = "ESLint config", + fileMatch = { + ".eslintrc.json", + ".eslintrc", + }, + url = "https://json.schemastore.org/eslintrc.json", + }, + { + description = "Bucklescript config", + fileMatch = { "bsconfig.json" }, + url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json", + }, + { + description = "Prettier config", + fileMatch = { + ".prettierrc", + ".prettierrc.json", + "prettier.config.json", + }, + url = "https://json.schemastore.org/prettierrc", + }, + { + description = "Vercel Now config", + fileMatch = { "now.json" }, + url = "https://json.schemastore.org/now", + }, + { + description = "Stylelint config", + fileMatch = { + ".stylelintrc", + ".stylelintrc.json", + "stylelint.config.json", + }, + url = "https://json.schemastore.org/stylelintrc", + }, + { + description = "A JSON schema for the ASP.NET LaunchSettings.json files", + fileMatch = { "launchsettings.json" }, + url = "https://json.schemastore.org/launchsettings.json", + }, + { + description = "Schema for CMake Presets", + fileMatch = { + "CMakePresets.json", + "CMakeUserPresets.json", + }, + url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json", + }, + { + description = "Configuration file as an alternative for configuring your repository in the settings page.", + fileMatch = { + ".codeclimate.json", + }, + url = "https://json.schemastore.org/codeclimate.json", + }, + { + description = "LLVM compilation database", + fileMatch = { + "compile_commands.json", + }, + url = "https://json.schemastore.org/compile-commands.json", + }, + { + description = "Config file for Command Task Runner", + fileMatch = { + "commands.json", + }, + url = "https://json.schemastore.org/commands.json", + }, + { + description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.", + fileMatch = { + "*.cf.json", + "cloudformation.json", + }, + url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json", + }, + { + description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.", + fileMatch = { + "serverless.template", + "*.sam.json", + "sam.json", + }, + url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json", + }, + { + description = "Json schema for properties json file for a GitHub Workflow template", + fileMatch = { + ".github/workflow-templates/**.properties.json", + }, + url = "https://json.schemastore.org/github-workflow-template-properties.json", + }, + { + description = "golangci-lint configuration file", + fileMatch = { + ".golangci.toml", + ".golangci.json", + }, + url = "https://json.schemastore.org/golangci-lint.json", + }, + { + description = "JSON schema for the JSON Feed format", + fileMatch = { + "feed.json", + }, + url = "https://json.schemastore.org/feed.json", + versions = { + ["1"] = "https://json.schemastore.org/feed-1.json", + ["1.1"] = "https://json.schemastore.org/feed.json", + }, + }, + { + description = "Packer template JSON configuration", + fileMatch = { + "packer.json", + }, + url = "https://json.schemastore.org/packer.json", + }, + { + description = "NPM configuration file", + fileMatch = { + "package.json", + }, + url = "https://json.schemastore.org/package.json", + }, + { + description = "JSON schema for Visual Studio component configuration files", + fileMatch = { + "*.vsconfig", + }, + url = "https://json.schemastore.org/vsconfig.json", + }, + { + description = "Resume json", + fileMatch = { "resume.json" }, + url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json", + }, +} + +local function extend(tab1, tab2) + for _, value in ipairs(tab2 or {}) do + table.insert(tab1, value) + end + return tab1 +end + +local extended_schemas = extend(schemas, default_schemas) + +local opts = { + settings = { + json = { + schemas = extended_schemas, + }, + }, + setup = { + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) + end, + }, + }, + }, +} + +return opts diff --git a/lua/user/lsp/settings/lua_ls.lua b/lua/user/lsp/settings/lua_ls.lua new file mode 100644 index 00000000000..0ac454a7202 --- /dev/null +++ b/lua/user/lsp/settings/lua_ls.lua @@ -0,0 +1,16 @@ +return { + settings = { + + Lua = { + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, +} diff --git a/lua/user/lsp/settings/pyright.lua b/lua/user/lsp/settings/pyright.lua new file mode 100644 index 00000000000..c2a518dba1c --- /dev/null +++ b/lua/user/lsp/settings/pyright.lua @@ -0,0 +1,9 @@ +return { + settings = { + python = { + analysis = { + typeCheckingMode = "off", + }, + }, + }, +} diff --git a/lua/user/options.lua b/lua/user/options.lua new file mode 100644 index 00000000000..68636b6e781 --- /dev/null +++ b/lua/user/options.lua @@ -0,0 +1,46 @@ +local options = { + backup = false, -- creates a backup file + clipboard = 'unnamedplus', -- allows neovim to access the system clipboard + cmdheight = 2, -- more space in the neovim command line for displaying messages + completeopt = { 'menuone', 'noselect' }, -- mostly just for cmp + conceallevel = 0, -- so that `` is visible in markdown files + fileencoding = 'utf-8', -- the encoding written to a file + hlsearch = true, -- highlight all matches on previous search pattern + ignorecase = true, -- ignore case in search patterns + mouse = 'a', -- allow the mouse to be used in neovim + pumheight = 10, -- pop up menu height + showmode = false, -- we don't need to see things like -- INSERT -- anymore + showtabline = 2, -- always show tabs + smartcase = true, -- smart case + smartindent = true, -- make indenting smarter again + splitbelow = true, -- force all horizontal splits to go below current window + splitright = true, -- force all vertical splits to go to the right of current window + swapfile = false, -- creates a swapfile + termguicolors = true, -- set term gui colors (most terminals support this) + timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) + undofile = true, -- enable persistent undo + updatetime = 300, -- faster completion (4000ms default) + writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited + expandtab = true, -- convert tabs to spaces + shiftwidth = 2, -- the number of spaces inserted for each indentation + tabstop = 2, -- insert 2 spaces for a tab + cursorline = true, -- highlight the current line + number = true, -- set numbered lines + relativenumber = false, -- set relative numbered lines + numberwidth = 4, -- set number column width to 2 {default 4} + signcolumn = 'yes', -- always show the sign column, otherwise it would shift the text each time + wrap = false, -- display lines as one long line + scrolloff = 8, -- is one of my fav + sidescrolloff = 8, + guifont = 'monospace:h17', -- the font used in graphical neovim applications +} + +vim.opt.shortmess:append 'c' + +for k, v in pairs(options) do + vim.opt[k] = v +end + +vim.cmd 'set whichwrap+=<,>,[,],h,l' +vim.cmd [[set iskeyword+=-]] +vim.cmd [[set formatoptions-=cro]] -- TODO: this doesn't seem to work diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua new file mode 100644 index 00000000000..9bfec7cfb21 --- /dev/null +++ b/lua/user/plugins.lua @@ -0,0 +1,81 @@ +local fn = vim.fn + +-- Automatically install packer +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, + } + print "Installing packer close and reopen Neovim..." + vim.cmd [[packadd packer.nvim]] +end + +-- Autocommand that reloads neovim whenever you save the plugins.lua file +vim.cmd [[ + augroup packer_user_config + autocmd! + autocmd BufWritePost plugins.lua source | PackerSync + augroup end +]] + +-- Use a protected call so we don't error out on first use +local status_ok, packer = pcall(require, "packer") +if not status_ok then + return +end + +-- Have packer use a popup window +packer.init { + display = { + open_fn = function() + return require("packer.util").float { border = "rounded" } + end, + }, +} + +-- Install your plugins here +return packer.startup(function(use) + -- My plugins here + use "wbthomason/packer.nvim" -- Have packer manage itself + use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim + use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins + + -- Colorschemes + -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out + use "lunarvim/darkplus.nvim" + + -- cmp plugins + use "hrsh7th/nvim-cmp" -- The completion plugin + use "hrsh7th/cmp-buffer" -- buffer completions + use "hrsh7th/cmp-path" -- path completions + use "hrsh7th/cmp-cmdline" -- cmdline completions + use "saadparwaiz1/cmp_luasnip" -- snippet completions + use "hrsh7th/cmp-nvim-lsp" + + -- snippets + use "L3MON4D3/LuaSnip" --snippet engine + use "rafamadriz/friendly-snippets" -- a bunch of snippets to use + + -- LSP + use "neovim/nvim-lspconfig" -- enable LSP + use "williamboman/mason.nvim" -- simple to use language server installer + use "williamboman/mason-lspconfig.nvim" -- simple to use language server installer + + -- Telescope + use { + 'nvim-telescope/telescope.nvim', + requires = { {'nvim-lua/plenary.nvim'} } + } + use "nvim-telescope/telescope-media-files.nvim" + + -- Automatically set up your configuration after cloning packer.nvim + -- Put this at the end after all plugins + if PACKER_BOOTSTRAP then + require("packer").sync() + end +end) diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua new file mode 100644 index 00000000000..e36adec8b98 --- /dev/null +++ b/lua/user/telescope.lua @@ -0,0 +1,136 @@ +local status_ok, telescope = pcall(require, "telescope") +if not status_ok then + return +end + +telescope.load_extension('media_files') + +local actions = require "telescope.actions" +local builtin = require 'telescope.builtin' + +-- -- Enable Telescope extensions if they are installed +-- pcall(require('telescope').load_extension, 'fzf') +-- pcall(require('telescope').load_extension, 'ui-select') +-- +-- +-- -- Slightly advanced example of overriding default behavior and theme +-- vim.keymap.set('n', '/', function() +-- -- You can pass additional configuration to Telescope to change the theme, layout, etc. +-- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { +-- winblend = 10, +-- previewer = false, +-- }) +-- end, { desc = '[/] Fuzzily search in current buffer' }) +-- +-- -- It's also possible to pass additional configuration options. +-- -- See `:help telescope.builtin.live_grep()` for information about particular keys +-- vim.keymap.set('n', 's/', function() +-- builtin.live_grep { +-- grep_open_files = true, +-- prompt_title = 'Live Grep in Open Files', +-- } +-- end, { desc = '[S]earch [/] in Open Files' }) +-- +-- -- Shortcut for searching your Neovim configuration files +-- vim.keymap.set('n', 'sn', function() +-- builtin.find_files { cwd = vim.fn.stdpath 'config' } +-- end, { desc = '[S]earch [N]eovim files' }) +-- end, +-- }, +-- + +telescope.setup { + defaults = { + + prompt_prefix = " ", + selection_caret = " ", + path_display = { "smart" }, + + mappings = { + i = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.close, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.complete_tag, + [""] = actions.which_key, -- keys from pressing + }, + + n = { + [""] = actions.close, + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + + ["j"] = actions.move_selection_next, + ["k"] = actions.move_selection_previous, + ["H"] = actions.move_to_top, + ["M"] = actions.move_to_middle, + ["L"] = actions.move_to_bottom, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + ["gg"] = actions.move_to_top, + ["G"] = actions.move_to_bottom, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + ["?"] = actions.which_key, + + }, + }, + }, + pickers = { + -- Default configuration for builtin pickers goes here: + -- picker_name = { + -- picker_config_key = value, + -- ... + -- } + -- Now the picker_config_key will be applied every time you call this + -- builtin picker + planets = { + show_pluto = true, + }, + }, + extensions = { + media_files = { + -- filetypes whitelist + -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} + filetypes = {"png", "webp", "jpg", "jpeg"}, + -- find command (defaults to `fd`) + find_cmd = "rg" + } + }, +} From e6f34faa53b5af7cbc497ab535ec3eefe0dd099c Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Mon, 23 Dec 2024 17:19:39 -0600 Subject: [PATCH 02/12] added bufferline and others --- lua/user/autopairs.lua | 33 ++++++++ lua/user/bufferline.lua | 167 +++++++++++++++++++++++++++++++++++++++ lua/user/colorscheme.lua | 5 +- lua/user/keymaps.lua | 3 + lua/user/nvim-tree.lua | 80 +++++++++++++++++++ lua/user/options.lua | 2 +- lua/user/plugins.lua | 15 +++- lua/user/telescope.lua | 31 -------- lua/user/treesitter.lua | 23 ++++++ 9 files changed, 323 insertions(+), 36 deletions(-) create mode 100644 lua/user/autopairs.lua create mode 100644 lua/user/bufferline.lua create mode 100644 lua/user/nvim-tree.lua create mode 100644 lua/user/treesitter.lua diff --git a/lua/user/autopairs.lua b/lua/user/autopairs.lua new file mode 100644 index 00000000000..577e571e20a --- /dev/null +++ b/lua/user/autopairs.lua @@ -0,0 +1,33 @@ +-- Setup nvim-cmp. +local status_ok, npairs = pcall(require, "nvim-autopairs") +if not status_ok then + return +end + +npairs.setup { + check_ts = true, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + fast_wrap = { + map = "", + chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, -- Offset from pattern match + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "PmenuSel", + highlight_grey = "LineNr", + }, +} + +local cmp_autopairs = require "nvim-autopairs.completion.cmp" +local cmp_status_ok, cmp = pcall(require, "cmp") +if not cmp_status_ok then + return +end +cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } }) diff --git a/lua/user/bufferline.lua b/lua/user/bufferline.lua new file mode 100644 index 00000000000..7d98cf072be --- /dev/null +++ b/lua/user/bufferline.lua @@ -0,0 +1,167 @@ +local status_ok, bufferline = pcall(require, "bufferline") +if not status_ok then + return +end + +bufferline.setup { + options = { + numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, + close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + -- NOTE: this plugin is designed with this icon in mind, + -- and so changing this is NOT recommended, this is intended + -- as an escape hatch for people who cannot bear it for whatever reason + indicator_icon = "▎", + buffer_close_icon = "", + -- buffer_close_icon = '', + modified_icon = "●", + close_icon = "", + -- close_icon = '', + left_trunc_marker = "", + right_trunc_marker = "", + --- name_formatter can be used to change the buffer's label in the bufferline. + --- Please note some names can/will break the + --- bufferline so use this at your discretion knowing that it has + --- some limitations that will *NOT* be fixed. + -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" + -- -- remove extension from markdown files for example + -- if buf.name:match('%.md') then + -- return vim.fn.fnamemodify(buf.name, ':t:r') + -- end + -- end, + max_name_length = 30, + max_prefix_length = 30, -- prefix used when a buffer is de-duplicated + tab_size = 21, + diagnostics = false, -- | "nvim_lsp" | "coc", + diagnostics_update_in_insert = false, + -- diagnostics_indicator = function(count, level, diagnostics_dict, context) + -- return "("..count..")" + -- end, + -- NOTE: this will be called a lot so don't do any heavy processing here + -- custom_filter = function(buf_number) + -- -- filter out filetypes you don't want to see + -- if vim.bo[buf_number].filetype ~= "" then + -- return true + -- end + -- -- filter out by buffer name + -- if vim.fn.bufname(buf_number) ~= "" then + -- return true + -- end + -- -- filter out based on arbitrary rules + -- -- e.g. filter out vim wiki buffer from tabline in your work repo + -- if vim.fn.getcwd() == "" and vim.bo[buf_number].filetype ~= "wiki" then + -- return true + -- end + -- end, + offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_close_icon = true, + show_tab_indicators = true, + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + -- can also be a table containing 2 custom separators + -- [focused and unfocused]. eg: { '|', '|' } + separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, + enforce_regular_tabs = true, + always_show_bufferline = true, + -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) + -- -- add custom logic + -- return buffer_a.modified > buffer_b.modified + -- end + }, + highlights = { + fill = { + guifg = { attribute = "fg", highlight = "#ff0000" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + background = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + -- buffer_selected = { + -- guifg = {attribute='fg',highlight='#ff0000'}, + -- guibg = {attribute='bg',highlight='#0000ff'}, + -- gui = 'none' + -- }, + buffer_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + close_button = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + close_button_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + -- close_button_selected = { + -- guifg = {attribute='fg',highlight='TabLineSel'}, + -- guibg ={attribute='bg',highlight='TabLineSel'} + -- }, + + tab_selected = { + guifg = { attribute = "fg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + tab = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + tab_close = { + -- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, + guifg = { attribute = "fg", highlight = "TabLineSel" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + + duplicate_selected = { + guifg = { attribute = "fg", highlight = "TabLineSel" }, + guibg = { attribute = "bg", highlight = "TabLineSel" }, + gui = "italic", + }, + duplicate_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + gui = "italic", + }, + duplicate = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + gui = "italic", + }, + + modified = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + modified_selected = { + guifg = { attribute = "fg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + modified_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + separator = { + guifg = { attribute = "bg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + separator_selected = { + guifg = { attribute = "bg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + -- separator_visible = { + -- guifg = {attribute='bg',highlight='TabLine'}, + -- guibg = {attribute='bg',highlight='TabLine'} + -- }, + indicator_selected = { + guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + }, +} diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index e180a953aa9..64832a44696 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -1,7 +1,6 @@ -local colorscheme = 'default' +local colorscheme = "tokyonight" -local status_ok, _ = pcall(vim.cmd, 'colorscheme ' .. colorscheme) +local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) if not status_ok then - vim.notify('colorscheme ' .. colorscheme .. ' not found!') return end diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index ec910283346..27e6d708a00 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -106,3 +106,6 @@ vim.keymap.set('n', 'sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' }) +-- Nvimtree +keymap("n", "e", ":NvimTreeToggle", opts) +keymap("n", "f", ":Format", opts) diff --git a/lua/user/nvim-tree.lua b/lua/user/nvim-tree.lua new file mode 100644 index 00000000000..4fbe99e548e --- /dev/null +++ b/lua/user/nvim-tree.lua @@ -0,0 +1,80 @@ +local status_ok, nvim_tree = pcall(require, "nvim-tree") +if not status_ok then + return +end + +local function my_on_attach(bufnr) + local api = require "nvim-tree.api" + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + -- custom mappings + vim.keymap.set("n", "", api.tree.change_root_to_parent, opts("Up")) + vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help")) + vim.keymap.set("n", "l", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "h", api.node.navigate.parent_close, opts("close_node")) +end + + +-- set termguicolors to enable highlight groups +vim.opt.termguicolors = true + +-- OR setup with some options +nvim_tree.setup({ + on_attach = my_on_attach, + sort_by = "case_sensitive", + view = { + adaptive_size = true, + }, + hijack_cursor = true, + renderer = { + highlight_git = true, + root_folder_modifier = ":t", + icons = { + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + }, + glyphs = { + default = "", + symlink = "", + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "U", + ignored = "◌", + }, + folder = { + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + }, + } + } + }, + filters = { + dotfiles = true, + }, + update_cwd = true, + diagnostics = { + enable = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, +}) diff --git a/lua/user/options.lua b/lua/user/options.lua index 68636b6e781..98db1d4cb99 100644 --- a/lua/user/options.lua +++ b/lua/user/options.lua @@ -16,7 +16,7 @@ local options = { splitbelow = true, -- force all horizontal splits to go below current window splitright = true, -- force all vertical splits to go to the right of current window swapfile = false, -- creates a swapfile - termguicolors = true, -- set term gui colors (most terminals support this) + termguicolors = true, -- set term gui colors (most terminals support this) timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) undofile = true, -- enable persistent undo updatetime = 300, -- faster completion (4000ms default) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 9bfec7cfb21..3309b6c95d7 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -44,10 +44,15 @@ return packer.startup(function(use) use "wbthomason/packer.nvim" -- Have packer manage itself use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins - + use "windwp/nvim-autopairs" -- Autopairs + -- use "numToStr/Comment.nvim" -- Easily comment stuff + use 'kyazdani42/nvim-web-devicons' + use 'kyazdani42/nvim-tree.lua' -- Colorschemes -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out use "lunarvim/darkplus.nvim" + use "akinsho/bufferline.nvim" + use "moll/vim-bbye" -- cmp plugins use "hrsh7th/nvim-cmp" -- The completion plugin @@ -73,6 +78,14 @@ return packer.startup(function(use) } use "nvim-telescope/telescope-media-files.nvim" + -- Treesitter + use { + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + } +-- use "p00f/nvim-ts-rainbow" +-- use "nvim-treesitter/playground" + -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if PACKER_BOOTSTRAP then diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua index e36adec8b98..07c6d523429 100644 --- a/lua/user/telescope.lua +++ b/lua/user/telescope.lua @@ -8,37 +8,6 @@ telescope.load_extension('media_files') local actions = require "telescope.actions" local builtin = require 'telescope.builtin' --- -- Enable Telescope extensions if they are installed --- pcall(require('telescope').load_extension, 'fzf') --- pcall(require('telescope').load_extension, 'ui-select') --- --- --- -- Slightly advanced example of overriding default behavior and theme --- vim.keymap.set('n', '/', function() --- -- You can pass additional configuration to Telescope to change the theme, layout, etc. --- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { --- winblend = 10, --- previewer = false, --- }) --- end, { desc = '[/] Fuzzily search in current buffer' }) --- --- -- It's also possible to pass additional configuration options. --- -- See `:help telescope.builtin.live_grep()` for information about particular keys --- vim.keymap.set('n', 's/', function() --- builtin.live_grep { --- grep_open_files = true, --- prompt_title = 'Live Grep in Open Files', --- } --- end, { desc = '[S]earch [/] in Open Files' }) --- --- -- Shortcut for searching your Neovim configuration files --- vim.keymap.set('n', 'sn', function() --- builtin.find_files { cwd = vim.fn.stdpath 'config' } --- end, { desc = '[S]earch [N]eovim files' }) --- end, --- }, --- - telescope.setup { defaults = { diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua new file mode 100644 index 00000000000..adffb3f60d7 --- /dev/null +++ b/lua/user/treesitter.lua @@ -0,0 +1,23 @@ +local status_ok, configs = pcall(require, "nvim-treesitter.configs") +if not status_ok then + return +end + +configs.setup { + ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages + sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) + ignore_install = { "" }, -- List of parsers to ignore installing + autopairs = { + enable = true, + }, + highlight = { + enable = true, -- false will disable the whole extension + disable = { "" }, -- list of language that will be disabled + additional_vim_regex_highlighting = true, + }, + indent = { enable = true, disable = { "yaml" } }, + context_commentstring = { + enable = true, + enable_autocmd = false, + }, +} From a5207c9491c03c6f9407b674ff25da2906d818ed Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Tue, 13 May 2025 09:34:36 -0500 Subject: [PATCH 03/12] latest --- init.lua | 985 +------------------------------------ oldinit.lua | 891 +++++++++++++++++++++++++++++++++ plugin/packer_compiled.lua | 209 ++++++++ 3 files changed, 1115 insertions(+), 970 deletions(-) create mode 100644 oldinit.lua create mode 100644 plugin/packer_compiled.lua diff --git a/init.lua b/init.lua index 08717d537e6..5d4891d9af4 100644 --- a/init.lua +++ b/init.lua @@ -1,970 +1,15 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving Kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know the Neovim basics, you can skip this step.) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. - - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help you understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your Neovim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) ---]] - --- Set as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - --- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false - --- [[ Setting options ]] --- See `:help vim.opt` --- NOTE: You can change these options as you wish! --- For more options, you can see `:help option-list` - --- Make line numbers default -vim.opt.number = true --- You can also add relative line numbers, to help with jumping. --- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true - --- Enable mouse mode, can be useful for resizing splits for example! -vim.opt.mouse = 'a' - --- Don't show the mode, since it's already in the status line -vim.opt.showmode = false - --- Sync clipboard between OS and Neovim. --- Schedule the setting after `UiEnter` because it can increase startup-time. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' -end) - --- Enable break indent -vim.opt.breakindent = true - --- Save undo history -vim.opt.undofile = true - --- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.opt.ignorecase = true -vim.opt.smartcase = true - --- Keep signcolumn on by default -vim.opt.signcolumn = 'yes' - --- Decrease update time -vim.opt.updatetime = 250 - --- Decrease mapped sequence wait time --- Displays which-key popup sooner -vim.opt.timeoutlen = 300 - --- Configure how new splits should be opened -vim.opt.splitright = true -vim.opt.splitbelow = true - --- Sets how neovim will display certain whitespace characters in the editor. --- See `:help 'list'` --- and `:help 'listchars'` -vim.opt.list = true -vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } - --- Preview substitutions live, as you type! -vim.opt.inccommand = 'split' - --- Show which line your cursor is on -vim.opt.cursorline = true - --- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 10 - --- [[ Basic Keymaps ]] --- See `:help vim.keymap.set()` - --- Clear highlights on search when pressing in normal mode --- See `:help hlsearch` -vim.keymap.set('n', '', 'nohlsearch') - --- Diagnostic keymaps -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) - --- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier --- for people to discover. Otherwise, you normally need to press , which --- is not what someone will guess without a bit more experience. --- --- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping --- or just use to exit terminal mode -vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) - --- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') - --- Keybinds to make split navigation easier. --- Use CTRL+ to switch between windows --- --- See `:help wincmd` for a list of all window commands -vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) - --- [[ Basic Autocommands ]] --- See `:help lua-guide-autocommands` - --- Highlight when yanking (copying) text --- Try it with `yap` in normal mode --- See `:help vim.highlight.on_yank()` -vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight when yanking (copying) text', - group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) - --- [[ Install `lazy.nvim` plugin manager ]] --- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info -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 - error('Error cloning lazy.nvim:\n' .. out) - end -end ---@diagnostic disable-next-line: undefined-field -vim.opt.rtp:prepend(lazypath) - --- [[ Configure and install plugins ]] --- --- To check the current status of your plugins, run --- :Lazy --- --- You can press `?` in this menu for help. Use `:q` to close the window --- --- To update plugins you can run --- :Lazy update --- --- NOTE: Here is where you install your plugins. -require('lazy').setup({ - -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). - 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - - -- NOTE: Plugins can also be added by using a table, - -- with the first argument being the link and the following - -- keys can be used to configure plugin behavior/loading/etc. - -- - -- Use `opts = {}` to force a plugin to be loaded. - -- - - -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. This is equivalent to the following Lua: - -- require('gitsigns').setup({ ... }) - -- - -- See `:help gitsigns` to understand what the configuration keys do - { -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - }, - }, - - -- NOTE: Plugins can also be configured to run Lua code when they are loaded. - -- - -- This is often very useful to both group configuration, as well as handle - -- lazy loading plugins that don't need to be loaded immediately at startup. - -- - -- For example, in the following configuration, we use: - -- event = 'VimEnter' - -- - -- which loads which-key before all the UI elements are loaded. Events can be - -- normal autocommands events (`:help autocmd-events`). - -- - -- Then, because we use the `config` key, the configuration only runs - -- after the plugin has been loaded: - -- config = function() ... end - - { -- Useful plugin to show you pending keybinds. - 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - opts = { - icons = { - -- set icon mappings to true if you have a Nerd Font - mappings = vim.g.have_nerd_font, - -- If you are using a Nerd Font: set icons.keys to an empty table which will use the - -- default which-key.nvim defined Nerd Font icons, otherwise define a string table - keys = vim.g.have_nerd_font and {} or { - Up = ' ', - Down = ' ', - Left = ' ', - Right = ' ', - C = ' ', - M = ' ', - D = ' ', - S = ' ', - CR = ' ', - Esc = ' ', - ScrollWheelDown = ' ', - ScrollWheelUp = ' ', - NL = ' ', - BS = ' ', - Space = ' ', - Tab = ' ', - F1 = '', - F2 = '', - F3 = '', - F4 = '', - F5 = '', - F6 = '', - F7 = '', - F8 = '', - F9 = '', - F10 = '', - F11 = '', - F12 = '', - }, - }, - - -- Document existing key chains - spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { 'd', group = '[D]ocument' }, - { 'r', group = '[R]ename' }, - { 's', group = '[S]earch' }, - { 'w', group = '[W]orkspace' }, - { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - }, - }, - }, - - -- NOTE: Plugins can specify dependencies. - -- - -- The dependencies are proper plugin specifications as well - anything - -- you do for a plugin at the top level, you can do for a dependency. - -- - -- Use the `dependencies` key to specify the dependencies of a particular plugin - - { -- Fuzzy Finder (files, lsp, etc) - 'nvim-telescope/telescope.nvim', - event = 'VimEnter', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions - 'nvim-telescope/telescope-fzf-native.nvim', - - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. - build = 'make', - - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - -- Telescope is a fuzzy finder that comes with a lot of different things that - -- it can fuzzy find! It's more than just a "file finder", it can search - -- many different aspects of Neovim, your workspace, LSP, and more! - -- - -- The easiest way to use Telescope, is to start by doing something like: - -- :Telescope help_tags - -- - -- After running this command, a window will open up and you're able to - -- type in the prompt window. You'll see a list of `help_tags` options and - -- a corresponding preview of the help. - -- - -- Two important keymaps to use while in Telescope are: - -- - Insert mode: - -- - Normal mode: ? - -- - -- This opens a window that shows you all of the keymaps for the current - -- Telescope picker. This is really useful to discover what Telescope can - -- do as well as how to actually do it! - - -- [[ Configure Telescope ]] - -- See `:help telescope` and `:help telescope.setup()` - require('telescope').setup { - -- You can put your default mappings / updates / etc. in here - -- All the info you're looking for is in `:help telescope.setup()` - -- - -- defaults = { - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - -- }, - -- pickers = {} - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - }, - } - - -- Enable Telescope extensions if they are installed - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') - - -- See `:help telescope.builtin` - local builtin = require 'telescope.builtin' - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - - -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set('n', '/', function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) - - -- It's also possible to pass additional configuration options. - -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set('n', 's/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) - - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'sn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[S]earch [N]eovim files' }) - end, - }, - - -- LSP Plugins - { - -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { - -- Load luvit types when the `vim.uv` word is found - { path = 'luvit-meta/library', words = { 'vim%.uv' } }, - }, - }, - }, - { 'Bilal2453/luvit-meta', lazy = true }, - { - -- Main LSP Configuration - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim - { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants - 'williamboman/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', - - -- Useful status updates for LSP. - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, - - -- Allows extra capabilities provided by nvim-cmp - 'hrsh7th/cmp-nvim-lsp', - }, - config = function() - -- Brief aside: **What is LSP?** - -- - -- LSP is an initialism you've probably heard, but might not understand what it is. - -- - -- LSP stands for Language Server Protocol. It's a protocol that helps editors - -- and language tooling communicate in a standardized fashion. - -- - -- In general, you have a "server" which is some tool built to understand a particular - -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers - -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone - -- processes that communicate with some "client" - in this case, Neovim! - -- - -- LSP provides Neovim with features like: - -- - Go to definition - -- - Find references - -- - Autocompletion - -- - Symbol Search - -- - and more! - -- - -- Thus, Language Servers are external tools that must be installed separately from - -- Neovim. This is where `mason` and related plugins come into play. - -- - -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, `:help lsp-vs-treesitter` - - -- This function gets run when an LSP attaches to a particular buffer. - -- That is to say, every time a new file is opened that is associated with - -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this - -- function will be executed to configure the current buffer - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), - callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end - - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - - -- Find references for the word under your cursor. - map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') - - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('rn', vim.lsp.buf.rename, '[R]e[n]ame') - - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) - - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- See `:help CursorHold` for information about when this is executed - -- - -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } - end, - }) - end - - -- The following code creates a keymap to toggle inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end - end, - }) - - -- Change diagnostic symbols in the sign column (gutter) - -- if vim.g.have_nerd_font then - -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } - -- local diagnostic_signs = {} - -- for type, icon in pairs(signs) do - -- diagnostic_signs[vim.diagnostic.severity[type]] = icon - -- end - -- vim.diagnostic.config { signs = { text = diagnostic_signs } } - -- end - - -- LSP servers and clients are able to communicate to each other what features they support. - -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) - - -- Enable the following language servers - -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- Add any additional override configuration in the following tables. Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ - local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, - -- - - lua_ls = { - -- cmd = {...}, - -- filetypes = { ...}, - -- capabilities = {}, - settings = { - Lua = { - completion = { - callSnippet = 'Replace', - }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, - }, - } - - -- Ensure the servers and tools above are installed - -- To check the current status of installed tools and/or manually install - -- other tools, you can run - -- :Mason - -- - -- You can press `g?` for help in this menu. - require('mason').setup() - - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code - }) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } - - require('mason-lspconfig').setup { - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for ts_ls) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } - end, - }, - - { -- Autoformat - 'stevearc/conform.nvim', - event = { 'BufWritePre' }, - cmd = { 'ConformInfo' }, - keys = { - { - 'f', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, - mode = '', - desc = '[F]ormat buffer', - }, - }, - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } - local lsp_format_opt - if disable_filetypes[vim.bo[bufnr].filetype] then - lsp_format_opt = 'never' - else - lsp_format_opt = 'fallback' - end - return { - timeout_ms = 500, - lsp_format = lsp_format_opt, - } - end, - formatters_by_ft = { - lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, - }, - }, - }, - - { -- Autocompletion - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - { - 'L3MON4D3/LuaSnip', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - -- `friendly-snippets` contains a variety of premade snippets. - -- See the README about individual language/framework/plugin snippets: - -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, - }, - }, - 'saadparwaiz1/cmp_luasnip', - - -- Adds other completion capabilities. - -- nvim-cmp does not ship with all sources by default. They are split - -- into multiple repos for maintenance purposes. - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - }, - config = function() - -- See `:help cmp` - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = 'menu,menuone,noinsert' }, - - -- For an understanding of why these mappings were - -- chosen, you will need to read `:help ins-completion` - -- - -- No, but seriously. Please read `:help ins-completion`, it is really good! - mapping = cmp.mapping.preset.insert { - -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), - -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), - - -- Scroll the documentation window [b]ack / [f]orward - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - - -- Accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, - - -- If you prefer more traditional completion keymaps, - -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, - --[''] = cmp.mapping.select_next_item(), - --[''] = cmp.mapping.select_prev_item(), - - -- Manually trigger a completion from nvim-cmp. - -- Generally you don't need this, because nvim-cmp will display - -- completions whenever it has completion options available. - [''] = cmp.mapping.complete {}, - - -- Think of as moving to the right of your snippet expansion. - -- So if you have a snippet that's like: - -- function $name($args) - -- $body - -- end - -- - -- will move you to the right of each of the expansion locations. - -- is similar, except moving you backwards. - [''] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { 'i', 's' }), - - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - sources = { - { - name = 'lazydev', - -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it - group_index = 0, - }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - }, - } - end, - }, - - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - init = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - - -- You can configure highlights by doing something like: - vim.cmd.hi 'Comment gui=none' - end, - }, - - -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, - - { -- Collection of various small independent plugins/modules - 'echasnovski/mini.nvim', - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() - - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin - local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } - - -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we set the section for - -- cursor location to LINE:COLUMN - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return '%2l:%-2v' - end - - -- ... and there is more! - -- Check out: https://github.com/echasnovski/mini.nvim - end, - }, - { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - }, - indent = { enable = true, disable = { 'ruby' } }, - }, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects - }, - - -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the - -- init.lua. If you want these files, they are in the repository, so you can just download them and - -- place them in the correct locations. - - -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart - -- - -- Here are some example plugins that I've included in the Kickstart repository. - -- Uncomment any of the lines below to enable them (you will need to restart nvim). - -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps - - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- This is the easiest way to modularize your config. - -- - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, - -- - -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` - -- Or use telescope! - -- In normal mode type `sh` then write `lazy.nvim-plugin` - -- you can continue same window with `sr` which resumes last telescope search -}, { - ui = { - -- If you are using a Nerd Font: set icons to an empty table which will use the - -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table - icons = vim.g.have_nerd_font and {} or { - cmd = '⌘', - config = '🛠', - event = '📅', - ft = '📂', - init = '⚙', - keys = '🗝', - plugin = '🔌', - runtime = '💻', - require = '🌙', - source = '📄', - start = '🚀', - task = '📌', - lazy = '💤 ', - }, - }, -}) - --- The line beneath this is called `modeline`. See `:help modeline` --- vim: ts=2 sts=2 sw=2 et +-- disable netrw at the very start of your init.lua (strongly advised) +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +require 'user.options' +require 'user.keymaps' +require 'user.plugins' +require 'user.colorscheme' +require 'user.cmp' +require 'user.lsp' +require 'user.telescope' +require 'user.treesitter' +require 'user.autopairs' +require 'user.nvim-tree' +require 'user.bufferline' diff --git a/oldinit.lua b/oldinit.lua new file mode 100644 index 00000000000..1a2f1c05629 --- /dev/null +++ b/oldinit.lua @@ -0,0 +1,891 @@ +--[[ + +===================================================================== +==================== READ THIS BEFORE CONTINUING ==================== +===================================================================== +======== .-----. ======== +======== .----------------------. | === | ======== +======== |.-""""""""""""""""""-.| |-----| ======== +======== || || | === | ======== +======== || KICKSTART.NVIM || |-----| ======== +======== || || | === | ======== +======== || || |-----| ======== +======== ||:Tutor || |:::::| ======== +======== |'-..................-'| |____o| ======== +======== `"")----------------(""` ___________ ======== +======== /::::::::::| |::::::::::\ \ no mouse \ ======== +======== /:::========| |==hjkl==:::\ \ required \ ======== +======== '""""""""""""' '""""""""""""' '""""""""""' ======== +======== ======== +===================================================================== +===================================================================== + +What is Kickstart? + + Kickstart.nvim is *not* a distribution. + + Kickstart.nvim is a starting point for your own configuration. + The goal is that you can read every line of code, top-to-bottom, understand + what your configuration is doing, and modify it to suit your needs. + + Once you've done that, you can start exploring, configuring and tinkering to + make Neovim your own! That might mean leaving Kickstart just the way it is for a while + or immediately breaking it into modular pieces. It's up to you! + + If you don't know anything about Lua, I recommend taking some time to read through + a guide. One possible example which will only take 10-15 minutes: + - https://learnxinyminutes.com/docs/lua/ + + After understanding a bit more about Lua, you can use `:help lua-guide` as a + reference for how Neovim integrates Lua. + - :help lua-guide + - (or HTML version): https://neovim.io/doc/user/lua-guide.html + +Kickstart Guide: + + TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. + +-- Set to true if you have a Nerd Font installed and selected in the terminal + +-- [[ Setting options ]] +-- See `:help vim.opt` +-- For more options, you can see `:help option-list` + +vim.g.have_nerd_font = true +-- Make line numbers default +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' +vim.opt.number = true +vim.opt.relativenumber = true +-- Enable mouse mode, can be useful for resizing splits for example! +vim.opt.mouse = 'a' +-- Don't show the mode, since it's already in the status line +vim.opt.showmode = false +-- Sync clipboard between OS and Neovim. +-- Schedule the setting after `UiEnter` because it can increase startup-time. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.schedule(function() + vim.opt.clipboard = 'unnamedplus' +end) +-- Enable break indent +vim.opt.breakindent = true +-- Save undo history +vim.opt.undofile = true +vim.opt.ignorecase = true +vim.opt.smartcase = true +-- Keep signcolumn on by default +vim.opt.signcolumn = 'yes' +-- Decrease update time +vim.opt.updatetime = 250 +-- Decrease mapped sequence wait time +-- Displays which-key popup sooner +vim.opt.timeoutlen = 300 + +-- Configure how new splits should be opened +vim.opt.splitright = true +vim.opt.splitbelow = true +-- Sets how neovim will display certain whitespace characters in the editor. +-- See `:help 'list'` +-- and `:help 'listchars'` +vim.opt.list = true +vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } +-- Preview substitutions live, as you type! +vim.opt.inccommand = 'split' +-- Show which line your cursor is on +vim.opt.cursorline = true +-- Minimal number of screen lines to keep above and below the cursor. +vim.opt.scrolloff = 8 +-- [[ Basic Keymaps ]] +-- See `:help vim.keymap.set()` +-- Clear highlights on search when pressing in normal mode +-- See `:help hlsearch` +vim.keymap.set('n', '', 'nohlsearch') +-- Diagnostic keymaps +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier +-- for people to discover. Otherwise, you normally need to press , which +-- is not what someone will guess without a bit more experience. +-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping +-- or just use to exit terminal mode +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + +-- Keybinds to make split navigation easier. +-- Use CTRL+ to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) + +-- [[ Basic Autocommands ]] +-- See `:help lua-guide-autocommands` +-- Highlight when yanking (copying) text +-- Try it with `yap` in normal mode +-- See `:help vim.highlight.on_yank()` +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) + +-- [[ Install `lazy.nvim` plugin manager ]] +-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info +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 + error('Error cloning lazy.nvim:\n' .. out) + end +end ---@diagnostic disable-next-line: undefined-field +vim.opt.rtp:prepend(lazypath) + +-- [[ Configure and install plugins ]] +-- To check the current status of your plugins, run +-- :Lazy +-- You can press `?` in this menu for help. Use `:q` to close the window +-- To update plugins you can run +-- :Lazy update +-- NOTE: Here is where you install your plugins. +require('lazy').setup({ + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + + -- NOTE: Plugins can also be added by using a table, + -- with the first argument being the link and the following + -- keys can be used to configure plugin behavior/loading/etc. + -- Use `opts = {}` to force a plugin to be loaded. + + -- Here is a more advanced example where we pass configuration + -- options to `gitsigns.nvim`. This is equivalent to the following Lua: + -- require('gitsigns').setup({ ... }) + -- + -- See `:help gitsigns` to understand what the configuration keys do + { -- Adds git related signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, + }, + + -- NOTE: Plugins can also be configured to run Lua code when they are loaded. + -- + -- This is often very useful to both group configuration, as well as handle + -- lazy loading plugins that don't need to be loaded immediately at startup. + -- + -- For example, in the following configuration, we use: + -- event = 'VimEnter' + -- + -- which loads which-key before all the UI elements are loaded. Events can be + -- normal autocommands events (`:help autocmd-events`). + -- + -- Then, because we use the `config` key, the configuration only runs + -- after the plugin has been loaded: + -- config = function() ... end + + { -- Useful plugin to show you pending keybinds. + 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' + opts = { + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default which-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, + }, + + -- Document existing key chains + spec = { + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + }, + }, + }, + + -- NOTE: Plugins can specify dependencies. + -- + -- The dependencies are proper plugin specifications as well - anything + -- you do for a plugin at the top level, you can do for a dependency. + -- + -- Use the `dependencies` key to specify the dependencies of a particular plugin + + { -- Fuzzy Finder (files, lsp, etc) + 'nvim-telescope/telescope.nvim', + event = 'VimEnter', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + { -- If encountering errors, see telescope-fzf-native README for installation instructions + 'nvim-telescope/telescope-fzf-native.nvim', + + -- `build` is used to run some command when the plugin is installed/updated. + -- This is only run then, not every time Neovim starts up. + build = 'make', + + -- `cond` is a condition used to determine whether this plugin should be + -- installed and loaded. + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + + -- Useful for getting pretty icons, but requires a Nerd Font. + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + }, + config = function() + -- Telescope is a fuzzy finder that comes with a lot of different things that + -- it can fuzzy find! It's more than just a "file finder", it can search + -- many different aspects of Neovim, your workspace, LSP, and more! + -- + -- The easiest way to use Telescope, is to start by doing something like: + -- :Telescope help_tags + -- + -- After running this command, a window will open up and you're able to + -- type in the prompt window. You'll see a list of `help_tags` options and + -- a corresponding preview of the help. + -- + -- Two important keymaps to use while in Telescope are: + -- - Insert mode: + -- - Normal mode: ? + -- + -- This opens a window that shows you all of the keymaps for the current + -- Telescope picker. This is really useful to discover what Telescope can + -- do as well as how to actually do it! + + -- [[ Configure Telescope ]] + -- See `:help telescope` and `:help telescope.setup()` + require('telescope').setup { + -- You can put your default mappings / updates / etc. in here + -- All the info you're looking for is in `:help telescope.setup()` + -- defaults = { + -- mappings = { + -- i = { [''] = 'to_fuzzy_refine' }, + -- }, + -- }, + -- pickers = {} + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + }, + } + + -- Enable Telescope extensions if they are installed + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') + + -- See `:help telescope.builtin` + local builtin = require 'telescope.builtin' + vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + + -- Slightly advanced example of overriding default behavior and theme + vim.keymap.set('n', '/', function() + -- You can pass additional configuration to Telescope to change the theme, layout, etc. + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + + -- It's also possible to pass additional configuration options. + -- See `:help telescope.builtin.live_grep()` for information about particular keys + vim.keymap.set('n', 's/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[S]earch [/] in Open Files' }) + + -- Shortcut for searching your Neovim configuration files + vim.keymap.set('n', 'sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) + end, + }, + + -- LSP Plugins + { + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, + { + -- Main LSP Configuration + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants + 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', + + -- Useful status updates for LSP. + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, + + -- Allows extra capabilities provided by nvim-cmp + 'hrsh7th/cmp-nvim-lsp', + }, + config = function() + -- Brief aside: **What is LSP?** + -- + -- LSP is an initialism you've probably heard, but might not understand what it is. + -- + -- LSP stands for Language Server Protocol. It's a protocol that helps editors + -- and language tooling communicate in a standardized fashion. + -- + -- In general, you have a "server" which is some tool built to understand a particular + -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers + -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone + -- processes that communicate with some "client" - in this case, Neovim! + -- + -- LSP provides Neovim with features like: + -- - Go to definition + -- - Find references + -- - Autocompletion + -- - Symbol Search + -- - and more! + -- + -- Thus, Language Servers are external tools that must be installed separately from + -- Neovim. This is where `mason` and related plugins come into play. + -- + -- If you're wondering about lsp vs treesitter, you can check out the wonderfully + -- and elegantly composed help section, `:help lsp-vs-treesitter` + + -- This function gets run when an LSP attaches to a particular buffer. + -- That is to say, every time a new file is opened that is associated with + -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this + -- function will be executed to configure the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- Find references for the word under your cursor. + map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('rn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } + end, + }) + end + + -- The following code creates a keymap to toggle inlay hints in your + -- code, if the language server you are using supports them + -- + -- This may be unwanted, since they displace some of your code + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, + }) + + -- Change diagnostic symbols in the sign column (gutter) + -- if vim.g.have_nerd_font then + -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } + -- local diagnostic_signs = {} + -- for type, icon in pairs(signs) do + -- diagnostic_signs[vim.diagnostic.severity[type]] = icon + -- end + -- vim.diagnostic.config { signs = { text = diagnostic_signs } } + -- end + + -- LSP servers and clients are able to communicate to each other what features they support. + -- By default, Neovim doesn't support everything that is in the LSP specification. + -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs + -- + -- Some languages (like typescript) have entire language plugins that can be useful: + -- https://github.com/pmizio/typescript-tools.nvim + -- + -- But for many setups, the LSP (`ts_ls`) will work just fine + -- ts_ls = {}, + -- + + lua_ls = { + -- cmd = {...}, + -- filetypes = { ...}, + -- capabilities = {}, + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + } + + -- Ensure the servers and tools above are installed + -- To check the current status of installed tools and/or manually install + -- other tools, you can run + -- :Mason + -- + -- You can press `g?` for help in this menu. + require('mason').setup() + + -- You can add other tools here that you want Mason to install + -- for you, so that they are available from within Neovim. + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + 'stylua', -- Used to format Lua code + }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } + + require('mason-lspconfig').setup { + handlers = { + function(server_name) + local server = servers[server_name] or {} + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for ts_ls) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, + } + end, + }, + + { -- Autoformat + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + keys = { + { + 'f', + function() + require('conform').format { async = true, lsp_format = 'fallback' } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true } + local lsp_format_opt + if disable_filetypes[vim.bo[bufnr].filetype] then + lsp_format_opt = 'never' + else + lsp_format_opt = 'fallback' + end + return { + timeout_ms = 500, + lsp_format = lsp_format_opt, + } + end, + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use 'stop_after_first' to run the first available formatter from the list + -- javascript = { "prettierd", "prettier", stop_after_first = true }, + }, + }, + }, + + { -- Autocompletion + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + { + 'L3MON4D3/LuaSnip', + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end + return 'make install_jsregexp' + end)(), + dependencies = { + -- `friendly-snippets` contains a variety of premade snippets. + -- See the README about individual language/framework/plugin snippets: + -- https://github.com/rafamadriz/friendly-snippets + -- { + -- 'rafamadriz/friendly-snippets', + -- config = function() + -- require('luasnip.loaders.from_vscode').lazy_load() + -- end, + -- }, + }, + }, + 'saadparwaiz1/cmp_luasnip', + + -- Adds other completion capabilities. + -- nvim-cmp does not ship with all sources by default. They are split + -- into multiple repos for maintenance purposes. + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + }, + config = function() + -- See `:help cmp` + local cmp = require 'cmp' + local luasnip = require 'luasnip' + luasnip.config.setup {} + + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { completeopt = 'menu,menuone,noinsert' }, + + -- For an understanding of why these mappings were + -- chosen, you will need to read `:help ins-completion` + -- + -- No, but seriously. Please read `:help ins-completion`, it is really good! + mapping = cmp.mapping.preset.insert { + -- Select the [n]ext item + [''] = cmp.mapping.select_next_item(), + -- Select the [p]revious item + [''] = cmp.mapping.select_prev_item(), + + -- Scroll the documentation window [b]ack / [f]orward + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + + -- Accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + [''] = cmp.mapping.confirm { select = true }, + + -- If you prefer more traditional completion keymaps, + -- you can uncomment the following lines + --[''] = cmp.mapping.confirm { select = true }, + --[''] = cmp.mapping.select_next_item(), + --[''] = cmp.mapping.select_prev_item(), + + -- Manually trigger a completion from nvim-cmp. + -- Generally you don't need this, because nvim-cmp will display + -- completions whenever it has completion options available. + [''] = cmp.mapping.complete {}, + + -- Think of as moving to the right of your snippet expansion. + -- So if you have a snippet that's like: + -- function $name($args) + -- $body + -- end + -- + -- will move you to the right of each of the expansion locations. + -- is similar, except moving you backwards. + [''] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { 'i', 's' }), + + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + }, + sources = { + { + name = 'lazydev', + -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it + group_index = 0, + }, + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + }, + } + end, + }, + + { -- You can easily change to a different colorscheme. + -- Change the name of the colorscheme plugin below, and then + -- change the command in the config to whatever the name of that colorscheme is. + -- + -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. + 'folke/tokyonight.nvim', + priority = 1000, -- Make sure to load this before all the other start plugins. + init = function() + -- Load the colorscheme here. + -- Like many other themes, this one has different styles, and you could load + -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. + vim.cmd.colorscheme 'tokyonight-night' + + -- You can configure highlights by doing something like: + vim.cmd.hi 'Comment gui=none' + end, + }, + + -- Highlight todo, notes, etc in comments + { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, + + { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + require('mini.surround').setup() + + -- Simple and easy statusline. + -- You could remove this setup call if you don't like it, + -- and try some other statusline plugin + local statusline = require 'mini.statusline' + -- set use_icons to true if you have a Nerd Font + statusline.setup { use_icons = vim.g.have_nerd_font } + + -- You can configure sections in the statusline by overriding their + -- default behavior. For example, here we set the section for + -- cursor location to LINE:COLUMN + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '%2l:%-2v' + end + + -- ... and there is more! + -- Check out: https://github.com/echasnovski/mini.nvim + end, + }, + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + main = 'nvim-treesitter.configs', -- Sets main module to use for opts + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + opts = { + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + additional_vim_regex_highlighting = { 'ruby' }, + }, + indent = { enable = true, disable = { 'ruby' } }, + }, + -- There are additional nvim-treesitter modules that you can use to interact + -- with nvim-treesitter. You should go explore a few and see what interests you: + -- + -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` + -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context + -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + }, + + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the + -- init.lua. If you want these files, they are in the repository, so you can just download them and + -- place them in the correct locations. + + -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart + -- + -- Here are some example plugins that I've included in the Kickstart repository. + -- Uncomment any of the lines below to enable them (you will need to restart nvim). + -- + -- require 'kickstart.plugins.debug', + -- require 'kickstart.plugins.indent_line', + -- require 'kickstart.plugins.lint', + -- require 'kickstart.plugins.autopairs', + -- require 'kickstart.plugins.neo-tree', + -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- This is the easiest way to modularize your config. + -- + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- { import = 'custom.plugins' }, + -- + -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` + -- Or use telescope! + -- In normal mode type `sh` then write `lazy.nvim-plugin` + -- you can continue same window with `sr` which resumes last telescope search +}, { + ui = { + -- If you are using a Nerd Font: set icons to an empty table which will use the + -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table + icons = vim.g.have_nerd_font and {} or { + cmd = '⌘', + config = '🛠', + event = '📅', + ft = '📂', + init = '⚙', + keys = '🗝', + plugin = '🔌', + runtime = '💻', + require = '🌙', + source = '📄', + start = '🚀', + task = '📌', + lazy = '💤 ', + }, + }, +}) + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua new file mode 100644 index 00000000000..1d9f3a7f68f --- /dev/null +++ b/plugin/packer_compiled.lua @@ -0,0 +1,209 @@ +-- 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 = "/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/share/lua/5.1/?.lua;/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/share/lua/5.1/?/init.lua;/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/lib/luarocks/rocks-5.1/?.lua;/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/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 = { + LuaSnip = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, + ["bufferline.nvim"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-cmdline"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp-cmdline", + url = "https://github.com/hrsh7th/cmp-cmdline" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-path"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + cmp_luasnip = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" + }, + ["darkplus.nvim"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/darkplus.nvim", + url = "https://github.com/lunarvim/darkplus.nvim" + }, + ["friendly-snippets"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/friendly-snippets", + url = "https://github.com/rafamadriz/friendly-snippets" + }, + ["mason-lspconfig.nvim"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", + url = "https://github.com/williamboman/mason-lspconfig.nvim" + }, + ["mason.nvim"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/mason.nvim", + url = "https://github.com/williamboman/mason.nvim" + }, + ["nvim-autopairs"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-autopairs", + url = "https://github.com/windwp/nvim-autopairs" + }, + ["nvim-cmp"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-tree.lua"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["popup.nvim"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/popup.nvim", + url = "https://github.com/nvim-lua/popup.nvim" + }, + ["telescope-media-files.nvim"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/telescope-media-files.nvim", + url = "https://github.com/nvim-telescope/telescope-media-files.nvim" + }, + ["telescope.nvim"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["vim-bbye"] = { + loaded = true, + path = "/Users/ds/.local/share/nvim/site/pack/packer/start/vim-bbye", + url = "https://github.com/moll/vim-bbye" + } +} + +time([[Defining packer_plugins]], false) + +_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 From e0e949f2e6ee481cbcb3da3fb09296e254fe5ecf Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Wed, 14 May 2025 09:52:13 -0500 Subject: [PATCH 04/12] better buffer shortcuts --- init.lua | 2 +- lua/user/autocmds.lua | 13 +++++++++++++ lua/user/bufferline.lua | 4 ++-- lua/user/keymaps.lua | 29 +++++++++++++++++++++++++---- lua/user/lsp/init.lua | 2 +- lua/user/lsp/mason.lua | 8 ++++---- lua/user/options.lua | 4 ++-- lua/user/plugins.lua | 1 - tester.py | 5 +++++ 9 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 lua/user/autocmds.lua create mode 100644 tester.py diff --git a/init.lua b/init.lua index 5d4891d9af4..b73eca2e831 100644 --- a/init.lua +++ b/init.lua @@ -7,8 +7,8 @@ require 'user.keymaps' require 'user.plugins' require 'user.colorscheme' require 'user.cmp' -require 'user.lsp' require 'user.telescope' +require 'user.lsp' require 'user.treesitter' require 'user.autopairs' require 'user.nvim-tree' diff --git a/lua/user/autocmds.lua b/lua/user/autocmds.lua new file mode 100644 index 00000000000..63331da8e07 --- /dev/null +++ b/lua/user/autocmds.lua @@ -0,0 +1,13 @@ +-- [[ Basic Autocommands ]] +-- See `:help lua-guide-autocommands` +-- Highlight when yanking (copying) text +-- Try it with `yap` in normal mode +-- See `:help vim.highlight.on_yank()` +-- +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/lua/user/bufferline.lua b/lua/user/bufferline.lua index 7d98cf072be..8082d057c0a 100644 --- a/lua/user/bufferline.lua +++ b/lua/user/bufferline.lua @@ -33,7 +33,7 @@ bufferline.setup { -- end, max_name_length = 30, max_prefix_length = 30, -- prefix used when a buffer is de-duplicated - tab_size = 21, + tab_size = 16, diagnostics = false, -- | "nvim_lsp" | "coc", diagnostics_update_in_insert = false, -- diagnostics_indicator = function(count, level, diagnostics_dict, context) @@ -73,7 +73,7 @@ bufferline.setup { }, highlights = { fill = { - guifg = { attribute = "fg", highlight = "#ff0000" }, + guifg = { attribute = "fg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" }, }, background = { diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 27e6d708a00..9e116cdda57 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -35,12 +35,17 @@ keymap('n', '', ':vertical resize +2', opts) -- Navigate buffers keymap('n', '', ':bnext', opts) +keymap("n", "n", ":bnext", opts) keymap('n', '', ':bprevious', opts) +keymap("n", "p", ":bprev", opts) -- Insert -- --- Press jk fast to enter +-- Press fast to exit keymap('i', 'jk', '', opts) +-- Jump to beginning of line +keymap('n', 'h', '^', opts) + -- Visual -- -- Stay in indent mode keymap('v', '<', '', '>gv', opts) -- Move text up and down keymap('v', '', ':m .+1==', opts) keymap('v', '', ':m .-2==', opts) -keymap('v', 'p', '"_dP', opts) +-- paste over currently selected text without yanking it +keymap('v', 'p', '"_dp', opts) +keymap('v', 'P', '"_dP', opts) -- Visual Block -- -- Move text up and down @@ -83,7 +90,6 @@ vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' } vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) --- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { @@ -108,4 +114,19 @@ end, { desc = '[S]earch [N]eovim files' }) -- Nvimtree keymap("n", "e", ":NvimTreeToggle", opts) -keymap("n", "f", ":Format", opts) +-- keymap("n", "f", ":Format", opts) +keymap("n", "w", ":w", opts) +keymap("n", "q", ":q", opts) +keymap("n", "d", ":bdelete", opts) + +keymap("n", "", "zz", opts) +keymap("n", "", "zz", opts) + +-- Move line on the screen rather than by line in the file +vim.keymap.set("n", "j", "gj", opts) +vim.keymap.set("n", "k", "gk", opts) + +-- Select all +vim.keymap.set("n", "", "ggVG", opts) + +vim.keymap.set("n", "YY", "va{Vy", opts) diff --git a/lua/user/lsp/init.lua b/lua/user/lsp/init.lua index 0cc7120d24f..d183b43e585 100644 --- a/lua/user/lsp/init.lua +++ b/lua/user/lsp/init.lua @@ -4,6 +4,6 @@ if not status_ok then end require "user.lsp.mason" -require("user.lsp.handlers").setup() +-- require("user.lsp.handlers").setup() require "user.lsp.null-ls" diff --git a/lua/user/lsp/mason.lua b/lua/user/lsp/mason.lua index 6bdd03d562d..48e02aed977 100644 --- a/lua/user/lsp/mason.lua +++ b/lua/user/lsp/mason.lua @@ -23,10 +23,10 @@ local settings = { } require("mason").setup(settings) -require("mason-lspconfig").setup({ - ensure_installed = servers, - automatic_installation = true, -}) +-- require("mason-lspconfig").setup({ +-- ensure_installed = servers, +-- automatic_installation = true, +-- }) local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") if not lspconfig_status_ok then diff --git a/lua/user/options.lua b/lua/user/options.lua index 98db1d4cb99..f3ccd40ad5b 100644 --- a/lua/user/options.lua +++ b/lua/user/options.lua @@ -5,7 +5,7 @@ local options = { completeopt = { 'menuone', 'noselect' }, -- mostly just for cmp conceallevel = 0, -- so that `` is visible in markdown files fileencoding = 'utf-8', -- the encoding written to a file - hlsearch = true, -- highlight all matches on previous search pattern + hlsearch = false, -- highlight all matches on previous search pattern ignorecase = true, -- ignore case in search patterns mouse = 'a', -- allow the mouse to be used in neovim pumheight = 10, -- pop up menu height @@ -26,7 +26,7 @@ local options = { tabstop = 2, -- insert 2 spaces for a tab cursorline = true, -- highlight the current line number = true, -- set numbered lines - relativenumber = false, -- set relative numbered lines + relativenumber = true, -- set relative numbered lines numberwidth = 4, -- set number column width to 2 {default 4} signcolumn = 'yes', -- always show the sign column, otherwise it would shift the text each time wrap = false, -- display lines as one long line diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 3309b6c95d7..94506c108d9 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -53,7 +53,6 @@ return packer.startup(function(use) use "lunarvim/darkplus.nvim" use "akinsho/bufferline.nvim" use "moll/vim-bbye" - -- cmp plugins use "hrsh7th/nvim-cmp" -- The completion plugin use "hrsh7th/cmp-buffer" -- buffer completions diff --git a/tester.py b/tester.py new file mode 100644 index 00000000000..e392f2f4e1c --- /dev/null +++ b/tester.py @@ -0,0 +1,5 @@ +x = [1, 2, 3] + +for item in x: + print(item) +# print(type(mydict)) From 6e636ad325953d1a0460de8c5869f7136a57ffcd Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Fri, 16 May 2025 10:30:46 -0500 Subject: [PATCH 05/12] switching to Lazy --- lua/user/telescope.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua index 07c6d523429..e1dc156a901 100644 --- a/lua/user/telescope.lua +++ b/lua/user/telescope.lua @@ -82,17 +82,20 @@ telescope.setup { }, }, pickers = { + -- find_files = { theme = 'dropdown'}, -- Default configuration for builtin pickers goes here: -- picker_name = { -- picker_config_key = value, -- ... - -- } + -- }, -- Now the picker_config_key will be applied every time you call this -- builtin picker planets = { show_pluto = true, + show_moon = true, }, }, + extensions = { media_files = { -- filetypes whitelist From 6f06ad0baa058702028996f1baa4345456c63d49 Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Fri, 16 May 2025 13:05:57 -0500 Subject: [PATCH 06/12] telescope/nvim-tree migrated --- init.lua | 37 +++- lua/{user => Saved}/autopairs.lua | 0 lua/{user => Saved}/bufferline.lua | 0 lua/{user => Saved}/cmp.lua | 0 lua/Saved/lazy.lua | 37 ++++ lua/{user => Saved}/lsp/handlers.lua | 0 lua/{user => Saved}/lsp/init.lua | 0 lua/{user => Saved}/lsp/mason.lua | 0 lua/{user => Saved}/lsp/null-ls.lua | 0 lua/{user => Saved}/lsp/settings/jsonls.lua | 0 lua/{user => Saved}/lsp/settings/lua_ls.lua | 0 lua/{user => Saved}/lsp/settings/pyright.lua | 0 lua/{user => Saved}/treesitter.lua | 0 lua/custom/plugins/init.lua | 5 - lua/plugins.lua | 41 ++++ lua/plugins/nvim-tree.lua | 147 +++++++++++++ lua/plugins/telescope.lua | 115 ++++++++++ lua/user/nvim-tree.lua | 80 ------- lua/user/plugins.lua | 93 --------- lua/user/telescope.lua | 108 ---------- plugin/packer_compiled.lua | 209 ------------------- 21 files changed, 368 insertions(+), 504 deletions(-) rename lua/{user => Saved}/autopairs.lua (100%) rename lua/{user => Saved}/bufferline.lua (100%) rename lua/{user => Saved}/cmp.lua (100%) create mode 100644 lua/Saved/lazy.lua rename lua/{user => Saved}/lsp/handlers.lua (100%) rename lua/{user => Saved}/lsp/init.lua (100%) rename lua/{user => Saved}/lsp/mason.lua (100%) rename lua/{user => Saved}/lsp/null-ls.lua (100%) rename lua/{user => Saved}/lsp/settings/jsonls.lua (100%) rename lua/{user => Saved}/lsp/settings/lua_ls.lua (100%) rename lua/{user => Saved}/lsp/settings/pyright.lua (100%) rename lua/{user => Saved}/treesitter.lua (100%) delete mode 100644 lua/custom/plugins/init.lua create mode 100644 lua/plugins.lua create mode 100644 lua/plugins/nvim-tree.lua create mode 100644 lua/plugins/telescope.lua delete mode 100644 lua/user/nvim-tree.lua delete mode 100644 lua/user/plugins.lua delete mode 100644 lua/user/telescope.lua delete mode 100644 plugin/packer_compiled.lua diff --git a/init.lua b/init.lua index b73eca2e831..6a03df82597 100644 --- a/init.lua +++ b/init.lua @@ -1,15 +1,34 @@ --- disable netrw at the very start of your init.lua (strongly advised) vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +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("plugins", { + change_detection = { + notify = false, + }, +}) require 'user.options' require 'user.keymaps' -require 'user.plugins' require 'user.colorscheme' -require 'user.cmp' -require 'user.telescope' -require 'user.lsp' -require 'user.treesitter' -require 'user.autopairs' -require 'user.nvim-tree' -require 'user.bufferline' +-- require 'user.cmp' +-- require 'user.lsp' +-- require 'user.treesitter' +-- require 'user.autopairs' +-- require 'user.nvim-tree' +-- require 'user.bufferline' diff --git a/lua/user/autopairs.lua b/lua/Saved/autopairs.lua similarity index 100% rename from lua/user/autopairs.lua rename to lua/Saved/autopairs.lua diff --git a/lua/user/bufferline.lua b/lua/Saved/bufferline.lua similarity index 100% rename from lua/user/bufferline.lua rename to lua/Saved/bufferline.lua diff --git a/lua/user/cmp.lua b/lua/Saved/cmp.lua similarity index 100% rename from lua/user/cmp.lua rename to lua/Saved/cmp.lua diff --git a/lua/Saved/lazy.lua b/lua/Saved/lazy.lua new file mode 100644 index 00000000000..efda595ec3c --- /dev/null +++ b/lua/Saved/lazy.lua @@ -0,0 +1,37 @@ +-- 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) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- My plugins here + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "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/user/lsp/handlers.lua b/lua/Saved/lsp/handlers.lua similarity index 100% rename from lua/user/lsp/handlers.lua rename to lua/Saved/lsp/handlers.lua diff --git a/lua/user/lsp/init.lua b/lua/Saved/lsp/init.lua similarity index 100% rename from lua/user/lsp/init.lua rename to lua/Saved/lsp/init.lua diff --git a/lua/user/lsp/mason.lua b/lua/Saved/lsp/mason.lua similarity index 100% rename from lua/user/lsp/mason.lua rename to lua/Saved/lsp/mason.lua diff --git a/lua/user/lsp/null-ls.lua b/lua/Saved/lsp/null-ls.lua similarity index 100% rename from lua/user/lsp/null-ls.lua rename to lua/Saved/lsp/null-ls.lua diff --git a/lua/user/lsp/settings/jsonls.lua b/lua/Saved/lsp/settings/jsonls.lua similarity index 100% rename from lua/user/lsp/settings/jsonls.lua rename to lua/Saved/lsp/settings/jsonls.lua diff --git a/lua/user/lsp/settings/lua_ls.lua b/lua/Saved/lsp/settings/lua_ls.lua similarity index 100% rename from lua/user/lsp/settings/lua_ls.lua rename to lua/Saved/lsp/settings/lua_ls.lua diff --git a/lua/user/lsp/settings/pyright.lua b/lua/Saved/lsp/settings/pyright.lua similarity index 100% rename from lua/user/lsp/settings/pyright.lua rename to lua/Saved/lsp/settings/pyright.lua diff --git a/lua/user/treesitter.lua b/lua/Saved/treesitter.lua similarity index 100% rename from lua/user/treesitter.lua rename to lua/Saved/treesitter.lua diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index be0eb9d8d7a..00000000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,5 +0,0 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information -return {} diff --git a/lua/plugins.lua b/lua/plugins.lua new file mode 100644 index 00000000000..1472c354ae7 --- /dev/null +++ b/lua/plugins.lua @@ -0,0 +1,41 @@ +return { + { "wbthomason/packer.nvim" }, -- Have packer manage itself + { "nvim-lua/popup.nvim" }, -- An implementation of the Popup API from vim in Neovim + { "nvim-lua/plenary.nvim" }, -- Useful lua functions used ny lots of plugins + { "windwp/nvim-autopairs" }, -- Autopairs + -- "numToStr/Comment.nvim" -- Easily comment stuff + { 'kyazdani42/nvim-web-devicons' }, + { 'kyazdani42/nvim-tree.lua' }, + -- Colorschemes + -- "lunarvim/colorschemes" -- A bunch of colorschemes you can try out + { "lunarvim/darkplus.nvim" }, + { "akinsho/bufferline.nvim" }, + { "moll/vim-bbye" }, + -- cmp plugins + { "hrsh7th/nvim-cmp" }, -- The completion plugin + { "hrsh7th/cmp-buffer" }, -- buffer completions + { "hrsh7th/cmp-path" }, -- path completions + { "hrsh7th/cmp-cmdline" }, -- cmdline completions + { "saadparwaiz1/cmp_luasnip" }, -- snippet completions + { "hrsh7th/cmp-nvim-lsp" }, + + -- snippets + { "L3MON4D3/LuaSnip" }, --snippet engine + { "rafamadriz/friendly-snippets" }, -- a bunch of snippets to use + + -- LSP + { "neovim/nvim-lspconfig" }, -- enable LSP + { "williamboman/mason.nvim" }, -- simple to use language server installer + { "williamboman/mason-lspconfig.nvim" }, -- simple to use language server installer + + -- Telescope + { "nvim-telescope/telescope-media-files.nvim" }, + + -- Treesitter + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, + -- "p00f/nvim-ts-rainbow" + -- "nvim-treesitter/playground" +} \ No newline at end of file diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua new file mode 100644 index 00000000000..51db910cf4d --- /dev/null +++ b/lua/plugins/nvim-tree.lua @@ -0,0 +1,147 @@ +return { + { + "nvim-tree/nvim-tree.lua", + version = "*", + cmd = { "NvimTreeToggle", "NvimTreeFocus" }, + keys = { + { "e", "NvimTreeToggle", desc = "Toggle NvimTree" }, + { "fe", "NvimTreeFocus", desc = "Focus NvimTree" }, + }, + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", -- optional icons + }, + opts = function() + local api = require("nvim-tree.api") + + return { + -- disable_netrw = false, + -- hiack_netrw = true, + view = { + width = 35, + side = "left", + preserve_window_proportions = true, + }, + hijack_cursor = true, + view = { + adaptive_size = true, + }, + renderer = { + highlight_git = true, + highlight_opened_files = "name", + indent_markers = { + enable = true, + }, + icons = { + show = { + git = true, + folder = true, + file = true, + folder_arrow = true, + }, + }, + }, + git = { + enable = true, + ignore = false, + }, + actions = { + open_file = { + quit_on_open = true, + }, + }, + on_attach = function(bufnr) + api.config.mappings.default_on_attach(bufnr) + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + local map = vim.keymap.set + map("n", "", api.node.open.edit, opts("Open")) + map("n", "l", api.node.open.edit, opts("Open")) + map("n", "o", api.node.open.edit, opts("Open")) + map("n", "v", api.node.open.vertical, opts("Open Vertical")) + map("n", "s", api.node.open.horizontal, opts("Open Horizontal")) + map("n", "a", api.fs.create, opts("Create")) + map("n", "d", api.fs.remove, opts("Delete")) + map("n", "r", api.fs.rename, opts("Rename")) + map("n", "x", api.fs.cut, opts("Cut")) + map("n", "y", api.fs.copy.node, opts("Copy")) + map("n", "p", api.fs.paste, opts("Paste")) + map("n", "q", api.tree.close, opts("Close")) + + map("n", "?", api.tree.toggle_help, opts("Help")) + map("n", "", api.tree.change_root_to_parent, opts("Up")) + map("n", "h", api.node.navigate.parent_close, opts("close_node")) + end, + } + end, + } +} + + +-- local function opts(desc) +-- return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } +-- end + +-- -- default mappings +-- api.config.mappings.default_on_attach(bufnr) + +-- -- custom mappings +-- end + + +-- -- set termguicolors to enable highlight groups +-- vim.opt.termguicolors = true + +-- -- OR setup with some options +-- nvim_tree.setup({ +-- on_attach = my_on_attach, +-- sort_by = "case_sensitive", +-- renderer = { +-- highlight_git = true, +-- root_folder_modifier = ":t", +-- icons = { +-- show = { +-- file = true, +-- folder = true, +-- folder_arrow = true, +-- git = true, +-- }, +-- glyphs = { +-- default = "", +-- symlink = "", +-- git = { +-- unstaged = "", +-- staged = "S", +-- unmerged = "", +-- renamed = "➜", +-- deleted = "", +-- untracked = "U", +-- ignored = "◌", +-- }, +-- folder = { +-- default = "", +-- open = "", +-- empty = "", +-- empty_open = "", +-- symlink = "", +-- }, +-- } +-- } +-- }, +-- filters = { +-- dotfiles = true, +-- }, +-- update_cwd = true, +-- diagnostics = { +-- enable = true, +-- icons = { +-- hint = "", +-- info = "", +-- warning = "", +-- error = "", +-- }, +-- }, +-- }) +-- } \ No newline at end of file diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 00000000000..cc34cd0b3e9 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,115 @@ +return { + 'nvim-telescope/telescope.nvim', + dependencies = { {'nvim-lua/plenary.nvim'} }, + opts = function() + local actions = require "telescope.actions" + local builtin = require "telescope.builtin" + return { + defaults = { + prompt_prefix = ">> ", + selection_caret = "$ ", + path_display = { "smart" }, + + mappings = { + i = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.close, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.complete_tag, + [""] = actions.which_key, -- keys from pressing + }, + + n = { + [""] = actions.close, + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + + ["j"] = actions.move_selection_next, + ["k"] = actions.move_selection_previous, + ["H"] = actions.move_to_top, + ["M"] = actions.move_to_middle, + ["L"] = actions.move_to_bottom, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + ["gg"] = actions.move_to_top, + ["G"] = actions.move_to_bottom, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + ["?"] = actions.which_key, + + }, + }, + }, + } + end, +} + +-- local status_ok, telescope = pcall(require, "telescope") +-- if not status_ok then +-- return +-- end +-- telescope.load_extension('media_files') + + +-- telescope.setup { +-- pickers = { +-- -- find_files = { theme = 'dropdown'}, +-- -- Default configuration for builtin pickers goes here: +-- -- picker_name = { +-- -- picker_config_key = value, +-- -- ... +-- -- }, +-- -- Now the picker_config_key will be applied every time you call this +-- -- builtin picker +-- planets = { +-- show_pluto = true, +-- show_moon = true, +-- }, +-- }, + +-- extensions = { +-- media_files = { +-- -- filetypes whitelist +-- -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} +-- filetypes = {"png", "webp", "jpg", "jpeg"}, +-- -- find command (defaults to `fd`) +-- find_cmd = "rg" +-- } +-- }, +-- } diff --git a/lua/user/nvim-tree.lua b/lua/user/nvim-tree.lua deleted file mode 100644 index 4fbe99e548e..00000000000 --- a/lua/user/nvim-tree.lua +++ /dev/null @@ -1,80 +0,0 @@ -local status_ok, nvim_tree = pcall(require, "nvim-tree") -if not status_ok then - return -end - -local function my_on_attach(bufnr) - local api = require "nvim-tree.api" - - local function opts(desc) - return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } - end - - -- default mappings - api.config.mappings.default_on_attach(bufnr) - - -- custom mappings - vim.keymap.set("n", "", api.tree.change_root_to_parent, opts("Up")) - vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help")) - vim.keymap.set("n", "l", api.node.open.edit, opts("Open")) - vim.keymap.set("n", "h", api.node.navigate.parent_close, opts("close_node")) -end - - --- set termguicolors to enable highlight groups -vim.opt.termguicolors = true - --- OR setup with some options -nvim_tree.setup({ - on_attach = my_on_attach, - sort_by = "case_sensitive", - view = { - adaptive_size = true, - }, - hijack_cursor = true, - renderer = { - highlight_git = true, - root_folder_modifier = ":t", - icons = { - show = { - file = true, - folder = true, - folder_arrow = true, - git = true, - }, - glyphs = { - default = "", - symlink = "", - git = { - unstaged = "", - staged = "S", - unmerged = "", - renamed = "➜", - deleted = "", - untracked = "U", - ignored = "◌", - }, - folder = { - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "", - }, - } - } - }, - filters = { - dotfiles = true, - }, - update_cwd = true, - diagnostics = { - enable = true, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, -}) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua deleted file mode 100644 index 94506c108d9..00000000000 --- a/lua/user/plugins.lua +++ /dev/null @@ -1,93 +0,0 @@ -local fn = vim.fn - --- Automatically install packer -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, - } - print "Installing packer close and reopen Neovim..." - vim.cmd [[packadd packer.nvim]] -end - --- Autocommand that reloads neovim whenever you save the plugins.lua file -vim.cmd [[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins.lua source | PackerSync - augroup end -]] - --- Use a protected call so we don't error out on first use -local status_ok, packer = pcall(require, "packer") -if not status_ok then - return -end - --- Have packer use a popup window -packer.init { - display = { - open_fn = function() - return require("packer.util").float { border = "rounded" } - end, - }, -} - --- Install your plugins here -return packer.startup(function(use) - -- My plugins here - use "wbthomason/packer.nvim" -- Have packer manage itself - use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim - use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins - use "windwp/nvim-autopairs" -- Autopairs - -- use "numToStr/Comment.nvim" -- Easily comment stuff - use 'kyazdani42/nvim-web-devicons' - use 'kyazdani42/nvim-tree.lua' - -- Colorschemes - -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out - use "lunarvim/darkplus.nvim" - use "akinsho/bufferline.nvim" - use "moll/vim-bbye" - -- cmp plugins - use "hrsh7th/nvim-cmp" -- The completion plugin - use "hrsh7th/cmp-buffer" -- buffer completions - use "hrsh7th/cmp-path" -- path completions - use "hrsh7th/cmp-cmdline" -- cmdline completions - use "saadparwaiz1/cmp_luasnip" -- snippet completions - use "hrsh7th/cmp-nvim-lsp" - - -- snippets - use "L3MON4D3/LuaSnip" --snippet engine - use "rafamadriz/friendly-snippets" -- a bunch of snippets to use - - -- LSP - use "neovim/nvim-lspconfig" -- enable LSP - use "williamboman/mason.nvim" -- simple to use language server installer - use "williamboman/mason-lspconfig.nvim" -- simple to use language server installer - - -- Telescope - use { - 'nvim-telescope/telescope.nvim', - requires = { {'nvim-lua/plenary.nvim'} } - } - use "nvim-telescope/telescope-media-files.nvim" - - -- Treesitter - use { - "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", - } --- use "p00f/nvim-ts-rainbow" --- use "nvim-treesitter/playground" - - -- Automatically set up your configuration after cloning packer.nvim - -- Put this at the end after all plugins - if PACKER_BOOTSTRAP then - require("packer").sync() - end -end) diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua deleted file mode 100644 index e1dc156a901..00000000000 --- a/lua/user/telescope.lua +++ /dev/null @@ -1,108 +0,0 @@ -local status_ok, telescope = pcall(require, "telescope") -if not status_ok then - return -end - -telescope.load_extension('media_files') - -local actions = require "telescope.actions" -local builtin = require 'telescope.builtin' - -telescope.setup { - defaults = { - - prompt_prefix = " ", - selection_caret = " ", - path_display = { "smart" }, - - mappings = { - i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.close, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - [""] = actions.complete_tag, - [""] = actions.which_key, -- keys from pressing - }, - - n = { - [""] = actions.close, - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - - ["j"] = actions.move_selection_next, - ["k"] = actions.move_selection_previous, - ["H"] = actions.move_to_top, - ["M"] = actions.move_to_middle, - ["L"] = actions.move_to_bottom, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - ["gg"] = actions.move_to_top, - ["G"] = actions.move_to_bottom, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - ["?"] = actions.which_key, - - }, - }, - }, - pickers = { - -- find_files = { theme = 'dropdown'}, - -- Default configuration for builtin pickers goes here: - -- picker_name = { - -- picker_config_key = value, - -- ... - -- }, - -- Now the picker_config_key will be applied every time you call this - -- builtin picker - planets = { - show_pluto = true, - show_moon = true, - }, - }, - - extensions = { - media_files = { - -- filetypes whitelist - -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} - filetypes = {"png", "webp", "jpg", "jpeg"}, - -- find command (defaults to `fd`) - find_cmd = "rg" - } - }, -} diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua deleted file mode 100644 index 1d9f3a7f68f..00000000000 --- a/plugin/packer_compiled.lua +++ /dev/null @@ -1,209 +0,0 @@ --- 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 = "/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/share/lua/5.1/?.lua;/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/share/lua/5.1/?/init.lua;/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/lib/luarocks/rocks-5.1/?.lua;/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/Users/ds/.cache/nvim/packer_hererocks/2.1.1732813678/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 = { - LuaSnip = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/LuaSnip", - url = "https://github.com/L3MON4D3/LuaSnip" - }, - ["bufferline.nvim"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/bufferline.nvim", - url = "https://github.com/akinsho/bufferline.nvim" - }, - ["cmp-buffer"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp-buffer", - url = "https://github.com/hrsh7th/cmp-buffer" - }, - ["cmp-cmdline"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp-cmdline", - url = "https://github.com/hrsh7th/cmp-cmdline" - }, - ["cmp-nvim-lsp"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", - url = "https://github.com/hrsh7th/cmp-nvim-lsp" - }, - ["cmp-path"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp-path", - url = "https://github.com/hrsh7th/cmp-path" - }, - cmp_luasnip = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/cmp_luasnip", - url = "https://github.com/saadparwaiz1/cmp_luasnip" - }, - ["darkplus.nvim"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/darkplus.nvim", - url = "https://github.com/lunarvim/darkplus.nvim" - }, - ["friendly-snippets"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/friendly-snippets", - url = "https://github.com/rafamadriz/friendly-snippets" - }, - ["mason-lspconfig.nvim"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", - url = "https://github.com/williamboman/mason-lspconfig.nvim" - }, - ["mason.nvim"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/mason.nvim", - url = "https://github.com/williamboman/mason.nvim" - }, - ["nvim-autopairs"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-autopairs", - url = "https://github.com/windwp/nvim-autopairs" - }, - ["nvim-cmp"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-cmp", - url = "https://github.com/hrsh7th/nvim-cmp" - }, - ["nvim-lspconfig"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", - url = "https://github.com/neovim/nvim-lspconfig" - }, - ["nvim-tree.lua"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", - url = "https://github.com/kyazdani42/nvim-tree.lua" - }, - ["nvim-treesitter"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-treesitter", - url = "https://github.com/nvim-treesitter/nvim-treesitter" - }, - ["nvim-web-devicons"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", - url = "https://github.com/kyazdani42/nvim-web-devicons" - }, - ["packer.nvim"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/packer.nvim", - url = "https://github.com/wbthomason/packer.nvim" - }, - ["plenary.nvim"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/plenary.nvim", - url = "https://github.com/nvim-lua/plenary.nvim" - }, - ["popup.nvim"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/popup.nvim", - url = "https://github.com/nvim-lua/popup.nvim" - }, - ["telescope-media-files.nvim"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/telescope-media-files.nvim", - url = "https://github.com/nvim-telescope/telescope-media-files.nvim" - }, - ["telescope.nvim"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/telescope.nvim", - url = "https://github.com/nvim-telescope/telescope.nvim" - }, - ["vim-bbye"] = { - loaded = true, - path = "/Users/ds/.local/share/nvim/site/pack/packer/start/vim-bbye", - url = "https://github.com/moll/vim-bbye" - } -} - -time([[Defining packer_plugins]], false) - -_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 From e34b835fbf690d30ac276fad7565772fc9831cc1 Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Fri, 16 May 2025 22:03:34 -0500 Subject: [PATCH 07/12] dashboard configured --- {lua/Saved => Saved}/autopairs.lua | 0 {lua/Saved => Saved}/bufferline.lua | 0 {lua/Saved => Saved}/cmp.lua | 0 {lua/Saved => Saved}/lazy.lua | 0 {lua/Saved => Saved}/lsp/handlers.lua | 0 {lua/Saved => Saved}/lsp/init.lua | 0 {lua/Saved => Saved}/lsp/mason.lua | 0 {lua/Saved => Saved}/lsp/null-ls.lua | 0 {lua/Saved => Saved}/lsp/settings/jsonls.lua | 0 {lua/Saved => Saved}/lsp/settings/lua_ls.lua | 0 {lua/Saved => Saved}/lsp/settings/pyright.lua | 0 Saved/snacks.lua | 50 +++++++++++++++++++ {lua/Saved => Saved}/treesitter.lua | 0 init.lua | 7 +++ {lua/kickstart => kickstart}/health.lua | 0 .../plugins/autopairs.lua | 0 .../kickstart => kickstart}/plugins/debug.lua | 0 .../plugins/gitsigns.lua | 0 .../plugins/indent_line.lua | 0 {lua/kickstart => kickstart}/plugins/lint.lua | 0 .../plugins/neo-tree.lua | 0 lua/plugins.lua | 37 +++++++------- lua/plugins/dashboard.lua | 44 ++++++++++++++++ 23 files changed, 119 insertions(+), 19 deletions(-) rename {lua/Saved => Saved}/autopairs.lua (100%) rename {lua/Saved => Saved}/bufferline.lua (100%) rename {lua/Saved => Saved}/cmp.lua (100%) rename {lua/Saved => Saved}/lazy.lua (100%) rename {lua/Saved => Saved}/lsp/handlers.lua (100%) rename {lua/Saved => Saved}/lsp/init.lua (100%) rename {lua/Saved => Saved}/lsp/mason.lua (100%) rename {lua/Saved => Saved}/lsp/null-ls.lua (100%) rename {lua/Saved => Saved}/lsp/settings/jsonls.lua (100%) rename {lua/Saved => Saved}/lsp/settings/lua_ls.lua (100%) rename {lua/Saved => Saved}/lsp/settings/pyright.lua (100%) create mode 100644 Saved/snacks.lua rename {lua/Saved => Saved}/treesitter.lua (100%) rename {lua/kickstart => kickstart}/health.lua (100%) rename {lua/kickstart => kickstart}/plugins/autopairs.lua (100%) rename {lua/kickstart => kickstart}/plugins/debug.lua (100%) rename {lua/kickstart => kickstart}/plugins/gitsigns.lua (100%) rename {lua/kickstart => kickstart}/plugins/indent_line.lua (100%) rename {lua/kickstart => kickstart}/plugins/lint.lua (100%) rename {lua/kickstart => kickstart}/plugins/neo-tree.lua (100%) create mode 100644 lua/plugins/dashboard.lua diff --git a/lua/Saved/autopairs.lua b/Saved/autopairs.lua similarity index 100% rename from lua/Saved/autopairs.lua rename to Saved/autopairs.lua diff --git a/lua/Saved/bufferline.lua b/Saved/bufferline.lua similarity index 100% rename from lua/Saved/bufferline.lua rename to Saved/bufferline.lua diff --git a/lua/Saved/cmp.lua b/Saved/cmp.lua similarity index 100% rename from lua/Saved/cmp.lua rename to Saved/cmp.lua diff --git a/lua/Saved/lazy.lua b/Saved/lazy.lua similarity index 100% rename from lua/Saved/lazy.lua rename to Saved/lazy.lua diff --git a/lua/Saved/lsp/handlers.lua b/Saved/lsp/handlers.lua similarity index 100% rename from lua/Saved/lsp/handlers.lua rename to Saved/lsp/handlers.lua diff --git a/lua/Saved/lsp/init.lua b/Saved/lsp/init.lua similarity index 100% rename from lua/Saved/lsp/init.lua rename to Saved/lsp/init.lua diff --git a/lua/Saved/lsp/mason.lua b/Saved/lsp/mason.lua similarity index 100% rename from lua/Saved/lsp/mason.lua rename to Saved/lsp/mason.lua diff --git a/lua/Saved/lsp/null-ls.lua b/Saved/lsp/null-ls.lua similarity index 100% rename from lua/Saved/lsp/null-ls.lua rename to Saved/lsp/null-ls.lua diff --git a/lua/Saved/lsp/settings/jsonls.lua b/Saved/lsp/settings/jsonls.lua similarity index 100% rename from lua/Saved/lsp/settings/jsonls.lua rename to Saved/lsp/settings/jsonls.lua diff --git a/lua/Saved/lsp/settings/lua_ls.lua b/Saved/lsp/settings/lua_ls.lua similarity index 100% rename from lua/Saved/lsp/settings/lua_ls.lua rename to Saved/lsp/settings/lua_ls.lua diff --git a/lua/Saved/lsp/settings/pyright.lua b/Saved/lsp/settings/pyright.lua similarity index 100% rename from lua/Saved/lsp/settings/pyright.lua rename to Saved/lsp/settings/pyright.lua diff --git a/Saved/snacks.lua b/Saved/snacks.lua new file mode 100644 index 00000000000..0a3407400a9 --- /dev/null +++ b/Saved/snacks.lua @@ -0,0 +1,50 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + bigfile = { enabled = true }, + dashboard = { + preset = { + -- pick = function(cmd, opts) + -- return LazyVim.pick(cmd, opts)() + -- end, + header = [[ + ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]], + -- stylua: ignore + ---@type snacks.dashboard.Item[] + keys = { + -- { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" }, + { icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" }, + { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" }, + { icon = " ", key = "s", desc = "Restore Session", section = "session" }, + { icon = " ", key = "x", desc = "Lazy Extras", action = ":LazyExtras" }, + { icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy" }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + }, + }, + -- explorer = { enabled = true }, + -- indent = { enabled = true }, + -- input = { enabled = true }, + picker = { enabled = false }, + -- notifier = { enabled = true }, + -- quickfile = { enabled = true }, + -- scope = { enabled = true }, + -- scroll = { enabled = true }, + -- statuscolumn = { enabled = true }, + -- words = { enabled = true }, + }, +} diff --git a/lua/Saved/treesitter.lua b/Saved/treesitter.lua similarity index 100% rename from lua/Saved/treesitter.lua rename to Saved/treesitter.lua diff --git a/init.lua b/init.lua index 6a03df82597..1960a05839e 100644 --- a/init.lua +++ b/init.lua @@ -32,3 +32,10 @@ require 'user.colorscheme' -- require 'user.autopairs' -- require 'user.nvim-tree' -- require 'user.bufferline' +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/lua/kickstart/health.lua b/kickstart/health.lua similarity index 100% rename from lua/kickstart/health.lua rename to kickstart/health.lua diff --git a/lua/kickstart/plugins/autopairs.lua b/kickstart/plugins/autopairs.lua similarity index 100% rename from lua/kickstart/plugins/autopairs.lua rename to kickstart/plugins/autopairs.lua diff --git a/lua/kickstart/plugins/debug.lua b/kickstart/plugins/debug.lua similarity index 100% rename from lua/kickstart/plugins/debug.lua rename to kickstart/plugins/debug.lua diff --git a/lua/kickstart/plugins/gitsigns.lua b/kickstart/plugins/gitsigns.lua similarity index 100% rename from lua/kickstart/plugins/gitsigns.lua rename to kickstart/plugins/gitsigns.lua diff --git a/lua/kickstart/plugins/indent_line.lua b/kickstart/plugins/indent_line.lua similarity index 100% rename from lua/kickstart/plugins/indent_line.lua rename to kickstart/plugins/indent_line.lua diff --git a/lua/kickstart/plugins/lint.lua b/kickstart/plugins/lint.lua similarity index 100% rename from lua/kickstart/plugins/lint.lua rename to kickstart/plugins/lint.lua diff --git a/lua/kickstart/plugins/neo-tree.lua b/kickstart/plugins/neo-tree.lua similarity index 100% rename from lua/kickstart/plugins/neo-tree.lua rename to kickstart/plugins/neo-tree.lua diff --git a/lua/plugins.lua b/lua/plugins.lua index 1472c354ae7..30b4c7a86fd 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,5 +1,4 @@ return { - { "wbthomason/packer.nvim" }, -- Have packer manage itself { "nvim-lua/popup.nvim" }, -- An implementation of the Popup API from vim in Neovim { "nvim-lua/plenary.nvim" }, -- Useful lua functions used ny lots of plugins { "windwp/nvim-autopairs" }, -- Autopairs @@ -10,26 +9,26 @@ return { -- "lunarvim/colorschemes" -- A bunch of colorschemes you can try out { "lunarvim/darkplus.nvim" }, { "akinsho/bufferline.nvim" }, - { "moll/vim-bbye" }, - -- cmp plugins - { "hrsh7th/nvim-cmp" }, -- The completion plugin - { "hrsh7th/cmp-buffer" }, -- buffer completions - { "hrsh7th/cmp-path" }, -- path completions - { "hrsh7th/cmp-cmdline" }, -- cmdline completions - { "saadparwaiz1/cmp_luasnip" }, -- snippet completions - { "hrsh7th/cmp-nvim-lsp" }, + { "moll/vim-bbye" }, +-- cmp plugins + { "hrsh7th/nvim-cmp" }, -- The completion plugin + { "hrsh7th/cmp-buffer" }, -- buffer completions + { "hrsh7th/cmp-path" }, -- path completions + { "hrsh7th/cmp-cmdline" }, -- cmdline completions + { "saadparwaiz1/cmp_luasnip" }, -- snippet completions + { "hrsh7th/cmp-nvim-lsp" }, - -- snippets - { "L3MON4D3/LuaSnip" }, --snippet engine - { "rafamadriz/friendly-snippets" }, -- a bunch of snippets to use +-- snippets + { "L3MON4D3/LuaSnip" }, --snippet engine + { "rafamadriz/friendly-snippets" }, -- a bunch of snippets to use - -- LSP - { "neovim/nvim-lspconfig" }, -- enable LSP - { "williamboman/mason.nvim" }, -- simple to use language server installer - { "williamboman/mason-lspconfig.nvim" }, -- simple to use language server installer +-- LSP + { "neovim/nvim-lspconfig" }, -- enable LSP + { "williamboman/mason.nvim" }, -- simple to use language server installer + { "williamboman/mason-lspconfig.nvim" }, -- simple to use language server installer - -- Telescope - { "nvim-telescope/telescope-media-files.nvim" }, +-- Telescope + { "nvim-telescope/telescope-media-files.nvim" }, -- Treesitter { @@ -38,4 +37,4 @@ return { }, -- "p00f/nvim-ts-rainbow" -- "nvim-treesitter/playground" -} \ No newline at end of file +} diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua new file mode 100644 index 00000000000..c5aaeb3ee65 --- /dev/null +++ b/lua/plugins/dashboard.lua @@ -0,0 +1,44 @@ +return { + "folke/snacks.nvim", + priority = 9999, + lazy = false, + opts = { + notifier = { enabled = true }, + dashboard = { + preset = { + pick = nil, + ---@type snacks.dashboard.Item[] + keys = { + { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" }, + { icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" }, + { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" }, + { icon = " ", key = "s", desc = "Restore Session", section = "session" }, + { icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + header = [[ +  + ████ ██████ █████ ██ + ███████████ █████  + █████████ ███████████████████ ███ ███████████ + █████████ ███ █████████████ █████ ██████████████ + █████████ ██████████ █████████ █████ █████ ████ █████ + ███████████ ███ ███ █████████ █████ █████ ████ █████ + ██████ █████████████████████ ████ █████ █████ ████ ██████ + ]], + }, + sections = { + { section = 'header' }, + { + section = "keys", + indent = 1, + padding = 1, + }, + { section = 'recent_files', icon = ' ', title = 'Recent Files', indent = 3, padding = 2 }, + { section = "startup" }, + }, + }, + }, +} From 9331121a9fe056ea84ed3262b434b05bcf4ce318 Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Sun, 18 May 2025 11:39:24 -0500 Subject: [PATCH 08/12] lualine/bufferline ui --- Saved/bufferline.lua | 167 ------------------------------------- lua/plugins.lua | 1 - lua/plugins/bufferline.lua | 150 +++++++++++++++++++++++++++++++++ lua/plugins/lualine.lua | 13 +++ lua/plugins/nvim-tree.lua | 71 +--------------- lua/user/keymaps.lua | 1 + tester.py | 7 +- 7 files changed, 168 insertions(+), 242 deletions(-) delete mode 100644 Saved/bufferline.lua create mode 100644 lua/plugins/bufferline.lua create mode 100644 lua/plugins/lualine.lua diff --git a/Saved/bufferline.lua b/Saved/bufferline.lua deleted file mode 100644 index 8082d057c0a..00000000000 --- a/Saved/bufferline.lua +++ /dev/null @@ -1,167 +0,0 @@ -local status_ok, bufferline = pcall(require, "bufferline") -if not status_ok then - return -end - -bufferline.setup { - options = { - numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, - close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" - right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" - left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" - middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" - -- NOTE: this plugin is designed with this icon in mind, - -- and so changing this is NOT recommended, this is intended - -- as an escape hatch for people who cannot bear it for whatever reason - indicator_icon = "▎", - buffer_close_icon = "", - -- buffer_close_icon = '', - modified_icon = "●", - close_icon = "", - -- close_icon = '', - left_trunc_marker = "", - right_trunc_marker = "", - --- name_formatter can be used to change the buffer's label in the bufferline. - --- Please note some names can/will break the - --- bufferline so use this at your discretion knowing that it has - --- some limitations that will *NOT* be fixed. - -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" - -- -- remove extension from markdown files for example - -- if buf.name:match('%.md') then - -- return vim.fn.fnamemodify(buf.name, ':t:r') - -- end - -- end, - max_name_length = 30, - max_prefix_length = 30, -- prefix used when a buffer is de-duplicated - tab_size = 16, - diagnostics = false, -- | "nvim_lsp" | "coc", - diagnostics_update_in_insert = false, - -- diagnostics_indicator = function(count, level, diagnostics_dict, context) - -- return "("..count..")" - -- end, - -- NOTE: this will be called a lot so don't do any heavy processing here - -- custom_filter = function(buf_number) - -- -- filter out filetypes you don't want to see - -- if vim.bo[buf_number].filetype ~= "" then - -- return true - -- end - -- -- filter out by buffer name - -- if vim.fn.bufname(buf_number) ~= "" then - -- return true - -- end - -- -- filter out based on arbitrary rules - -- -- e.g. filter out vim wiki buffer from tabline in your work repo - -- if vim.fn.getcwd() == "" and vim.bo[buf_number].filetype ~= "wiki" then - -- return true - -- end - -- end, - offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, - show_buffer_icons = true, - show_buffer_close_icons = true, - show_close_icon = true, - show_tab_indicators = true, - persist_buffer_sort = true, -- whether or not custom sorted buffers should persist - -- can also be a table containing 2 custom separators - -- [focused and unfocused]. eg: { '|', '|' } - separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, - enforce_regular_tabs = true, - always_show_bufferline = true, - -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) - -- -- add custom logic - -- return buffer_a.modified > buffer_b.modified - -- end - }, - highlights = { - fill = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - }, - background = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - }, - - -- buffer_selected = { - -- guifg = {attribute='fg',highlight='#ff0000'}, - -- guibg = {attribute='bg',highlight='#0000ff'}, - -- gui = 'none' - -- }, - buffer_visible = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - }, - - close_button = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - }, - close_button_visible = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - }, - -- close_button_selected = { - -- guifg = {attribute='fg',highlight='TabLineSel'}, - -- guibg ={attribute='bg',highlight='TabLineSel'} - -- }, - - tab_selected = { - guifg = { attribute = "fg", highlight = "Normal" }, - guibg = { attribute = "bg", highlight = "Normal" }, - }, - tab = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - }, - tab_close = { - -- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "Normal" }, - }, - - duplicate_selected = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, - gui = "italic", - }, - duplicate_visible = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - gui = "italic", - }, - duplicate = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - gui = "italic", - }, - - modified = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - }, - modified_selected = { - guifg = { attribute = "fg", highlight = "Normal" }, - guibg = { attribute = "bg", highlight = "Normal" }, - }, - modified_visible = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - }, - - separator = { - guifg = { attribute = "bg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - }, - separator_selected = { - guifg = { attribute = "bg", highlight = "Normal" }, - guibg = { attribute = "bg", highlight = "Normal" }, - }, - -- separator_visible = { - -- guifg = {attribute='bg',highlight='TabLine'}, - -- guibg = {attribute='bg',highlight='TabLine'} - -- }, - indicator_selected = { - guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, - guibg = { attribute = "bg", highlight = "Normal" }, - }, - }, -} diff --git a/lua/plugins.lua b/lua/plugins.lua index 30b4c7a86fd..62d53c51e9d 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -4,7 +4,6 @@ return { { "windwp/nvim-autopairs" }, -- Autopairs -- "numToStr/Comment.nvim" -- Easily comment stuff { 'kyazdani42/nvim-web-devicons' }, - { 'kyazdani42/nvim-tree.lua' }, -- Colorschemes -- "lunarvim/colorschemes" -- A bunch of colorschemes you can try out { "lunarvim/darkplus.nvim" }, diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua new file mode 100644 index 00000000000..46b70b14504 --- /dev/null +++ b/lua/plugins/bufferline.lua @@ -0,0 +1,150 @@ +return { + "akinsho/bufferline.nvim", + version = "*", + dependencies = 'nvim-tree/nvim-web-devicons', + opts = { + options = { + numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, + close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + -- NOTE: this plugin is designed with this icon in mind, + -- and so changing this is NOT recommended, this is intended + -- as an escape hatch for people who cannot bear it for whatever reason + indicator_icon = "▎", + buffer_close_icon = "", + -- buffer_close_icon = '', + modified_icon = "●", + close_icon = "", + -- close_icon = '', + left_trunc_marker = "", + right_trunc_marker = "", + --- name_formatter can be used to change the buffer's label in the bufferline. + --- Please note some names can/will break the + --- bufferline so use this at your discretion knowing that it has + --- some limitations that will *NOT* be fixed. + -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" + -- -- remove extension from markdown files for example + -- if buf.name:match('%.md') then + -- return vim.fn.fnamemodify(buf.name, ':t:r') + -- end + -- end, + max_name_length = 30, + max_prefix_length = 30, -- prefix used when a buffer is de-duplicated + tab_size = 16, + diagnostics = false, -- | "nvim_lsp" | "coc", + diagnostics_update_in_insert = false, + offsets = { + { + filetype = "NvimTree", + text = "File Explorer", + text_align = "left", + separator = true, + } + }, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_close_icon = true, + show_tab_indicators = true, + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + -- can also be a table containing 2 custom separators + -- [focused and unfocused]. eg: { '|', '|' } + separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, + enforce_regular_tabs = true, + always_show_bufferline = true, + -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) + -- -- add custom logic + -- return buffer_a.modified > buffer_b.modified + -- end + highlights = { + fill = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + background = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + buffer_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + close_button = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + close_button_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + -- close_button_selected = { + -- guifg = {attribute='fg',highlight='TabLineSel'}, + -- guibg ={attribute='bg',highlight='TabLineSel'} + -- }, + + tab_selected = { + guifg = { attribute = "fg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + tab = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + tab_close = { + -- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, + guifg = { attribute = "fg", highlight = "TabLineSel" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + + duplicate_selected = { + guifg = { attribute = "fg", highlight = "TabLineSel" }, + guibg = { attribute = "bg", highlight = "TabLineSel" }, + gui = "italic", + }, + duplicate_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + gui = "italic", + }, + duplicate = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + gui = "italic", + }, + + modified = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + modified_selected = { + guifg = { attribute = "fg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + modified_visible = { + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + + separator = { + guifg = { attribute = "bg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, + }, + separator_selected = { + guifg = { attribute = "bg", highlight = "Normal" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + -- separator_visible = { + -- guifg = {attribute='bg',highlight='TabLine'}, + -- guibg = {attribute='bg',highlight='TabLine'} + -- }, + indicator_selected = { + guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, + guibg = { attribute = "bg", highlight = "Normal" }, + }, + } + } + } +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 00000000000..e84f6e1a48e --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,13 @@ + +-- Using opts (recommended when no custom logic is needed) +return { + "nvim-lualine/lualine.nvim", + dependencies = { 'nvim-tree/nvim-web-devicons' }, + opts = { + options = { + theme = "dracula", + section_separators = "", + component_separators = "", + }, + }, +} diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua index 51db910cf4d..29078ac4cef 100644 --- a/lua/plugins/nvim-tree.lua +++ b/lua/plugins/nvim-tree.lua @@ -15,11 +15,9 @@ return { local api = require("nvim-tree.api") return { - -- disable_netrw = false, - -- hiack_netrw = true, view = { width = 35, - side = "left", + side = "right", preserve_window_proportions = true, }, hijack_cursor = true, @@ -78,70 +76,3 @@ return { end, } } - - --- local function opts(desc) --- return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } --- end - --- -- default mappings --- api.config.mappings.default_on_attach(bufnr) - --- -- custom mappings --- end - - --- -- set termguicolors to enable highlight groups --- vim.opt.termguicolors = true - --- -- OR setup with some options --- nvim_tree.setup({ --- on_attach = my_on_attach, --- sort_by = "case_sensitive", --- renderer = { --- highlight_git = true, --- root_folder_modifier = ":t", --- icons = { --- show = { --- file = true, --- folder = true, --- folder_arrow = true, --- git = true, --- }, --- glyphs = { --- default = "", --- symlink = "", --- git = { --- unstaged = "", --- staged = "S", --- unmerged = "", --- renamed = "➜", --- deleted = "", --- untracked = "U", --- ignored = "◌", --- }, --- folder = { --- default = "", --- open = "", --- empty = "", --- empty_open = "", --- symlink = "", --- }, --- } --- } --- }, --- filters = { --- dotfiles = true, --- }, --- update_cwd = true, --- diagnostics = { --- enable = true, --- icons = { --- hint = "", --- info = "", --- warning = "", --- error = "", --- }, --- }, --- }) --- } \ No newline at end of file diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 9e116cdda57..315186d6e6c 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -130,3 +130,4 @@ vim.keymap.set("n", "k", "gk", opts) vim.keymap.set("n", "", "ggVG", opts) vim.keymap.set("n", "YY", "va{Vy", opts) +vim.keymap.set("n", "r", ":w:!python3 %", { noremap = true, silent = true }) diff --git a/tester.py b/tester.py index e392f2f4e1c..8f178cda066 100644 --- a/tester.py +++ b/tester.py @@ -1,5 +1,4 @@ -x = [1, 2, 3] +items = [1, 2, 3] -for item in x: - print(item) -# print(type(mydict)) +print([x**2 for x in items]) +print(items*2) From 5c937dc1c831d309921190d143db89c75b1e2d73 Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Thu, 22 May 2025 14:10:59 -0500 Subject: [PATCH 09/12] lualine config edits --- Saved/completions.lua | 42 ++++++++++++++++++++ Saved/lsp/init.lua | 2 +- Saved/treesitter.lua | 23 ----------- init.lua | 33 ++++++---------- kickstart/plugins/autopairs.lua | 16 -------- learn/learning.lua | 2 + learn/main.lua | 5 +++ lua/plugins.lua | 15 ++++---- lua/plugins/autopairs.lua | 39 +++++++++++++++++++ lua/plugins/dashboard.lua | 3 +- lua/plugins/lspconfig.lua | 24 ++++++++++++ lua/plugins/lualine.lua | 11 ++++++ lua/plugins/nvim-cmp.lua | 68 +++++++++++++++++++++++++++++++++ lua/plugins/treesitter.lua | 50 ++++++++++++++++++++++++ lua/plugins/which-key.lua | 18 +++++++++ lua/user/autocmds.lua | 6 --- lua/user/keymaps.lua | 4 +- lua/user/options.lua | 10 ++--- tester.py | 13 ++++++- 19 files changed, 301 insertions(+), 83 deletions(-) create mode 100644 Saved/completions.lua delete mode 100644 Saved/treesitter.lua delete mode 100644 kickstart/plugins/autopairs.lua create mode 100644 learn/learning.lua create mode 100644 learn/main.lua create mode 100644 lua/plugins/autopairs.lua create mode 100644 lua/plugins/lspconfig.lua create mode 100644 lua/plugins/nvim-cmp.lua create mode 100644 lua/plugins/treesitter.lua create mode 100644 lua/plugins/which-key.lua diff --git a/Saved/completions.lua b/Saved/completions.lua new file mode 100644 index 00000000000..c9307360519 --- /dev/null +++ b/Saved/completions.lua @@ -0,0 +1,42 @@ +return { + { + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + dependencies = { 'rafamadriz/friendly-snippets' }, + + -- use a release tag to download pre-built binaries + version = '1.*', + opts = { + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = 'default' }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono' + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" } + }, + opts_extend = { "sources.default" } + } +} diff --git a/Saved/lsp/init.lua b/Saved/lsp/init.lua index d183b43e585..0cc7120d24f 100644 --- a/Saved/lsp/init.lua +++ b/Saved/lsp/init.lua @@ -4,6 +4,6 @@ if not status_ok then end require "user.lsp.mason" --- require("user.lsp.handlers").setup() +require("user.lsp.handlers").setup() require "user.lsp.null-ls" diff --git a/Saved/treesitter.lua b/Saved/treesitter.lua deleted file mode 100644 index adffb3f60d7..00000000000 --- a/Saved/treesitter.lua +++ /dev/null @@ -1,23 +0,0 @@ -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end - -configs.setup { - ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages - sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) - ignore_install = { "" }, -- List of parsers to ignore installing - autopairs = { - enable = true, - }, - highlight = { - enable = true, -- false will disable the whole extension - disable = { "" }, -- list of language that will be disabled - additional_vim_regex_highlighting = true, - }, - indent = { enable = true, disable = { "yaml" } }, - context_commentstring = { - enable = true, - enable_autocmd = false, - }, -} diff --git a/init.lua b/init.lua index 1960a05839e..70948602794 100644 --- a/init.lua +++ b/init.lua @@ -1,23 +1,22 @@ vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 -vim.g.mapleader = " " -vim.g.maplocalleader = " " +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +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 + 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("plugins", { +require('lazy').setup('plugins', { change_detection = { notify = false, }, @@ -26,16 +25,8 @@ require("lazy").setup("plugins", { require 'user.options' require 'user.keymaps' require 'user.colorscheme' +require 'user.autocmds' -- require 'user.cmp' -- require 'user.lsp' -- require 'user.treesitter' -- require 'user.autopairs' --- require 'user.nvim-tree' --- require 'user.bufferline' -vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight when yanking (copying) text', - group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) diff --git a/kickstart/plugins/autopairs.lua b/kickstart/plugins/autopairs.lua deleted file mode 100644 index 87a7e5ffa2e..00000000000 --- a/kickstart/plugins/autopairs.lua +++ /dev/null @@ -1,16 +0,0 @@ --- autopairs --- https://github.com/windwp/nvim-autopairs - -return { - 'windwp/nvim-autopairs', - event = 'InsertEnter', - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, - config = function() - require('nvim-autopairs').setup {} - -- If you want to automatically add `(` after selecting a function or method - local cmp_autopairs = require 'nvim-autopairs.completion.cmp' - local cmp = require 'cmp' - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) - end, -} diff --git a/learn/learning.lua b/learn/learning.lua new file mode 100644 index 00000000000..91e502a1b51 --- /dev/null +++ b/learn/learning.lua @@ -0,0 +1,2 @@ +local names = { "Norsh", "Dan", "Bisc", "Ella"} +return names diff --git a/learn/main.lua b/learn/main.lua new file mode 100644 index 00000000000..ccd410abf20 --- /dev/null +++ b/learn/main.lua @@ -0,0 +1,5 @@ +local fam = require('learn.learning') +print(fam[1]) +-- for i, v in ipairs(fam) do +-- print(i, v) +-- end diff --git a/lua/plugins.lua b/lua/plugins.lua index 62d53c51e9d..28c1b624c62 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,4 +1,5 @@ return { + {'folke/tokyonight.nvim'}, { "nvim-lua/popup.nvim" }, -- An implementation of the Popup API from vim in Neovim { "nvim-lua/plenary.nvim" }, -- Useful lua functions used ny lots of plugins { "windwp/nvim-autopairs" }, -- Autopairs @@ -7,15 +8,15 @@ return { -- Colorschemes -- "lunarvim/colorschemes" -- A bunch of colorschemes you can try out { "lunarvim/darkplus.nvim" }, - { "akinsho/bufferline.nvim" }, { "moll/vim-bbye" }, -- cmp plugins - { "hrsh7th/nvim-cmp" }, -- The completion plugin - { "hrsh7th/cmp-buffer" }, -- buffer completions - { "hrsh7th/cmp-path" }, -- path completions - { "hrsh7th/cmp-cmdline" }, -- cmdline completions - { "saadparwaiz1/cmp_luasnip" }, -- snippet completions - { "hrsh7th/cmp-nvim-lsp" }, + -- { "hrsh7th/nvim-cmp" }, -- The completion plugin + -- { "hrsh7th/cmp-buffer" }, -- buffer completions + -- { "hrsh7th/cmp-path" }, -- path completions + -- { "hrsh7th/cmp-nvim-lua" }, + -- { "hrsh7th/cmp-cmdline" }, -- cmdline completions + -- { "saadparwaiz1/cmp_luasnip" }, -- snippet completions + -- { "hrsh7th/cmp-nvim-lsp" }, -- snippets { "L3MON4D3/LuaSnip" }, --snippet engine diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua new file mode 100644 index 00000000000..683fef2e59d --- /dev/null +++ b/lua/plugins/autopairs.lua @@ -0,0 +1,39 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", -- Load when entering insert mode + config = function() + local autopairs = require("nvim-autopairs") + + autopairs.setup({ + disable_filetype = { "TelescopePrompt", "vim" }, + check_ts = true, -- Use Treesitter to check for pairs + ts_config = { + lua = { "string" }, -- don't add pairs in lua string nodes + javascript = { "template_string" }, + java = false, -- disable treesitter check for Java + }, + fast_wrap = { + map = "", -- Alt+e to trigger fast wrap + chars = { "{", "[", "(", '"', "'" }, + pattern = [=[[%'%"%>%]%)%}%,]]=], + end_key = "$", + before_key = "h", + after_key = "l", + cursor_pos_before = true, + keys = "qwertyuiopzxcvbnmasdfghjkl", + manual_position = true, + highlight = "Search", + highlight_grey = "Comment" + }, + enable_check_bracket_line = true, -- Don't add a pair if the closing bracket is already on the same line + ignored_next_char = "[%w%.]", -- Will ignore alphanumeric and `.` after the pair + }) + + -- Optional: Integration with nvim-cmp for auto completion pairing + local cmp_status_ok, cmp = pcall(require, "cmp") + if cmp_status_ok then + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end + end, +} diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua index c5aaeb3ee65..2c05299c891 100644 --- a/lua/plugins/dashboard.lua +++ b/lua/plugins/dashboard.lua @@ -1,7 +1,5 @@ return { "folke/snacks.nvim", - priority = 9999, - lazy = false, opts = { notifier = { enabled = true }, dashboard = { @@ -42,3 +40,4 @@ return { }, }, } + diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua new file mode 100644 index 00000000000..1473d15ff0d --- /dev/null +++ b/lua/plugins/lspconfig.lua @@ -0,0 +1,24 @@ +-- ~/.config/nvim/lua/plugins/lspconfig.lua +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile", "BufWritePre" }, + config = function() + local lspconfig = require("lspconfig") + local capabilities = require("cmp_nvim_lsp").default_capabilities() + + -- Example: Python + lspconfig.pyright.setup({ + capabilities = capabilities + }) + + -- Example: Lua + lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { globals = { "vim" } }, + }, + }, + }) + end, +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index e84f6e1a48e..5b273eb02ba 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -9,5 +9,16 @@ return { section_separators = "", component_separators = "", }, + sections = { + lualine_c = { + { + 'filename', + path=1 + }, + }, + lualine_x = {}, + lualine_y = {}, + lualine_z = {}, + }, }, } diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 00000000000..b72654e5e56 --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,68 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + -- Completion sources + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "saadparwaiz1/cmp_luasnip", + + -- Snippet engine + "L3MON4D3/LuaSnip", + + -- Optional: VSCode-style icons + "onsails/lspkind.nvim", + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + local lspkind = require("lspkind") + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.complete(), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + { name = "buffer" }, + }), + formatting = { + format = lspkind.cmp_format({ + mode = "symbol_text", -- "text", "symbol", or "symbol_text" + maxwidth = 50, + ellipsis_char = "...", + }), + }, + }) + + -- Cmdline completion (optional) + cmp.setup.cmdline("/", { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" } + } + }) + + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" } + }, { + { name = "cmdline" } + }) + }) + end, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 00000000000..f1ffbb4266b --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,50 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", -- ensures parsers stay updated + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "python", "javascript", "go" }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = "", + node_decremental = "", + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + move = { + enable = true, + set_jumps = true, + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + }, + }, + }) + end, +} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua new file mode 100644 index 00000000000..9fadb977261 --- /dev/null +++ b/lua/plugins/which-key.lua @@ -0,0 +1,18 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, +} diff --git a/lua/user/autocmds.lua b/lua/user/autocmds.lua index 63331da8e07..a9a4d7ba22d 100644 --- a/lua/user/autocmds.lua +++ b/lua/user/autocmds.lua @@ -1,9 +1,3 @@ --- [[ Basic Autocommands ]] --- See `:help lua-guide-autocommands` --- Highlight when yanking (copying) text --- Try it with `yap` in normal mode --- See `:help vim.highlight.on_yank()` --- vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 315186d6e6c..d90e5a532c6 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -57,7 +57,6 @@ keymap('v', '', ':m .-2==', opts) -- paste over currently selected text without yanking it keymap('v', 'p', '"_dp', opts) keymap('v', 'P', '"_dP', opts) - -- Visual Block -- -- Move text up and down keymap('x', 'J', ":move '>+1gv-gv", opts) @@ -131,3 +130,6 @@ vim.keymap.set("n", "", "ggVG", opts) vim.keymap.set("n", "YY", "va{Vy", opts) vim.keymap.set("n", "r", ":w:!python3 %", { noremap = true, silent = true }) +vim.keymap.set("n", "x", ":source %", opts) +vim.keymap.set("n", "x", ":.lua", opts) +vim.keymap.set("v", "x", ":lua", opts) diff --git a/lua/user/options.lua b/lua/user/options.lua index f3ccd40ad5b..cb579695e63 100644 --- a/lua/user/options.lua +++ b/lua/user/options.lua @@ -16,7 +16,7 @@ local options = { splitbelow = true, -- force all horizontal splits to go below current window splitright = true, -- force all vertical splits to go to the right of current window swapfile = false, -- creates a swapfile - termguicolors = true, -- set term gui colors (most terminals support this) + termguicolors = true, -- set term gui colors (most terminals support this) timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) undofile = true, -- enable persistent undo updatetime = 300, -- faster completion (4000ms default) @@ -35,12 +35,12 @@ local options = { guifont = 'monospace:h17', -- the font used in graphical neovim applications } -vim.opt.shortmess:append 'c' +-- vim.opt.shortmess:append 'c' for k, v in pairs(options) do vim.opt[k] = v end -vim.cmd 'set whichwrap+=<,>,[,],h,l' -vim.cmd [[set iskeyword+=-]] -vim.cmd [[set formatoptions-=cro]] -- TODO: this doesn't seem to work +-- vim.cmd 'set whichwrap+=<,>,[,],h,l' +-- vim.cmd [[set iskeyword+=-]] +-- vim.cmd [[set formatoptions-=cro]] -- TODO: this doesn't seem to work diff --git a/tester.py b/tester.py index 8f178cda066..7c30a2c7c39 100644 --- a/tester.py +++ b/tester.py @@ -1,4 +1,15 @@ items = [1, 2, 3] print([x**2 for x in items]) -print(items*2) +print([x**3 for x in items]) + +for i in items: + print(i) + +def myfunc(): + print("this is my func") + +def myfunc2(): + pass + +myfunc() From 5bd1837e7dd7a190372891d42c59449200f0287d Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Sat, 24 May 2025 09:04:20 -0500 Subject: [PATCH 10/12] lsp setup --- .github/ISSUE_TEMPLATE/bug_report.md | 28 ------ .github/pull_request_template.md | 8 -- .github/workflows/stylua.yml | 21 ----- Saved/snacks.lua | 3 - doc/kickstart.txt | 24 ----- doc/tags | 3 - init.lua | 12 +-- lazyvim.json | 10 +++ learn/learning.lua | 4 +- learn/main.lua | 3 +- lua/plugins.lua | 6 +- lua/plugins/dashboard.lua | 1 - lua/plugins/lsp.lua | 130 +++++++++++++++++++++++++++ lua/plugins/lspconfig.lua | 24 ----- lua/plugins/nvim-cmp.lua | 119 ++++++++++++------------ lua/plugins/nvim-tree.lua | 7 +- lua/plugins/trouble.lua | 37 ++++++++ tester.py | 15 ++-- 18 files changed, 260 insertions(+), 195 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/workflows/stylua.yml delete mode 100644 doc/kickstart.txt delete mode 100644 doc/tags create mode 100644 lazyvim.json create mode 100644 lua/plugins/lsp.lua delete mode 100644 lua/plugins/lspconfig.lua create mode 100644 lua/plugins/trouble.lua diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 2ad4d31ddb0..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - - - -## Describe the bug - - -## To Reproduce - -1. ... - -## Desktop - -- OS: -- Terminal: - -## Neovim Version - - -``` -``` diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index f401c9ffd9c..00000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,8 +0,0 @@ -*************************************************************************** -**NOTE** -Please verify that the `base repository` above has the intended destination! -Github by default opens Pull Requests against the parent of a forked repository. -If this is your personal fork and you didn't intend to open a PR for contribution -to the original project then adjust the `base repository` accordingly. -************************************************************************** - diff --git a/.github/workflows/stylua.yml b/.github/workflows/stylua.yml deleted file mode 100644 index 75db6c3355b..00000000000 --- a/.github/workflows/stylua.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Check Lua Formatting -name: Check Lua Formatting -on: pull_request_target - -jobs: - stylua-check: - if: github.repository == 'nvim-lua/kickstart.nvim' - name: Stylua Check - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Stylua Check - uses: JohnnyMorganz/stylua-action@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - version: latest - args: --check . - diff --git a/Saved/snacks.lua b/Saved/snacks.lua index 0a3407400a9..e2adc87aa27 100644 --- a/Saved/snacks.lua +++ b/Saved/snacks.lua @@ -2,7 +2,6 @@ return { "folke/snacks.nvim", priority = 1000, lazy = false, - ---@type snacks.Config opts = { -- your configuration comes here -- or leave it empty to use the default settings @@ -21,8 +20,6 @@ return { ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], - -- stylua: ignore - ---@type snacks.dashboard.Item[] keys = { -- { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, diff --git a/doc/kickstart.txt b/doc/kickstart.txt deleted file mode 100644 index cb87ac3f1de..00000000000 --- a/doc/kickstart.txt +++ /dev/null @@ -1,24 +0,0 @@ -================================================================================ -INTRODUCTION *kickstart.nvim* - -Kickstart.nvim is a project to help you get started on your neovim journey. - - *kickstart-is-not* -It is not: -- Complete framework for every plugin under the sun -- Place to add every plugin that could ever be useful - - *kickstart-is* -It is: -- Somewhere that has a good start for the most common "IDE" type features: - - autocompletion - - goto-definition - - find references - - fuzzy finding - - and hinting at what more can be done :) -- A place to _kickstart_ your journey. - - You should fork this project and use/modify it so that it matches your - style and preferences. If you don't want to do that, there are probably - other projects that would fit much better for you (and that's great!)! - - vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/tags b/doc/tags deleted file mode 100644 index 687ae7721d9..00000000000 --- a/doc/tags +++ /dev/null @@ -1,3 +0,0 @@ -kickstart-is kickstart.txt /*kickstart-is* -kickstart-is-not kickstart.txt /*kickstart-is-not* -kickstart.nvim kickstart.txt /*kickstart.nvim* diff --git a/init.lua b/init.lua index 70948602794..ef3b323c21b 100644 --- a/init.lua +++ b/init.lua @@ -16,11 +16,10 @@ if not vim.loop.fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) -require('lazy').setup('plugins', { - change_detection = { - notify = false, - }, -}) +require('lazy').setup { + { import = 'plugins' }, + { import = 'plugins.lsp' }, +} require 'user.options' require 'user.keymaps' @@ -30,3 +29,6 @@ require 'user.autocmds' -- require 'user.lsp' -- require 'user.treesitter' -- require 'user.autopairs' + +vim.lsp.enable('pyright') +vim.lsp.enable('lua_ls') diff --git a/lazyvim.json b/lazyvim.json new file mode 100644 index 00000000000..6206f7edcc5 --- /dev/null +++ b/lazyvim.json @@ -0,0 +1,10 @@ +{ + "extras": [ + + ], + "install_version": 8, + "news": { + "NEWS.md": "10960" + }, + "version": 8 +} \ No newline at end of file diff --git a/learn/learning.lua b/learn/learning.lua index 91e502a1b51..39d56a2b80e 100644 --- a/learn/learning.lua +++ b/learn/learning.lua @@ -1,2 +1,4 @@ local names = { "Norsh", "Dan", "Bisc", "Ella"} -return names +local text = 'yuhhh' +return names, text + diff --git a/learn/main.lua b/learn/main.lua index ccd410abf20..01a3968eccc 100644 --- a/learn/main.lua +++ b/learn/main.lua @@ -1,5 +1,6 @@ -local fam = require('learn.learning') +local fam, text = require('learn.learning') print(fam[1]) + -- for i, v in ipairs(fam) do -- print(i, v) -- end diff --git a/lua/plugins.lua b/lua/plugins.lua index 28c1b624c62..9a9ff67f689 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -23,9 +23,9 @@ return { { "rafamadriz/friendly-snippets" }, -- a bunch of snippets to use -- LSP - { "neovim/nvim-lspconfig" }, -- enable LSP - { "williamboman/mason.nvim" }, -- simple to use language server installer - { "williamboman/mason-lspconfig.nvim" }, -- simple to use language server installer + -- { "neovim/nvim-lspconfig" }, -- enable LSP + -- { "williamboman/mason.nvim" }, -- simple to use language server installer + -- { "williamboman/mason-lspconfig.nvim" }, -- simple to use language server installer -- Telescope { "nvim-telescope/telescope-media-files.nvim" }, diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua index 2c05299c891..39dac2ef7eb 100644 --- a/lua/plugins/dashboard.lua +++ b/lua/plugins/dashboard.lua @@ -5,7 +5,6 @@ return { dashboard = { preset = { pick = nil, - ---@type snacks.dashboard.Item[] keys = { { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 00000000000..6f1b581ce11 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,130 @@ +-- return { +-- "mason-org/mason-lspconfig.nvim", +-- opts = { +-- ensure_installed = { "lua_ls", "rust_analyzer", "pyright" }, +-- }, +-- dependencies = { +-- { "mason-org/mason.nvim", opts = {} }, +-- "neovim/nvim-lspconfig", +-- }, +-- } +return { + "VonHeikemen/lsp-zero.nvim", + branch = "v2.x", + dependencies = { + -- LSP Support + { "neovim/nvim-lspconfig" }, -- Required + { -- Optional + "williamboman/mason.nvim", + build = function() + pcall(vim.cmd, "MasonUpdate") + end, + }, + { "williamboman/mason-lspconfig.nvim" }, -- Optional + + -- Autocompletion + { "hrsh7th/nvim-cmp" }, -- Required + { "hrsh7th/cmp-nvim-lsp" }, -- Required + { "L3MON4D3/LuaSnip" }, -- Required + { "rafamadriz/friendly-snippets" }, + { "hrsh7th/cmp-buffer" }, + { "hrsh7th/cmp-path" }, + { "hrsh7th/cmp-cmdline" }, + { "saadparwaiz1/cmp_luasnip" }, + }, + config = function() + local lsp = require("lsp-zero") + + lsp.on_attach(function(client, bufnr) + local opts = { buffer = bufnr, remap = false } + + vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Goto Reference" })) + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Goto Definition" })) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Hover" })) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Workspace Symbol" })) + vim.keymap.set("n", "vd", function() vim.diagnostic.setloclist() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Show Diagnostics" })) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, vim.tbl_deep_extend("force", opts, { desc = "Next Diagnostic" })) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, vim.tbl_deep_extend("force", opts, { desc = "Previous Diagnostic" })) + vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Code Action" })) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, vim.tbl_deep_extend("force", opts, { desc = "LSP References" })) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Rename" })) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Signature Help" })) + end) + + require("mason").setup({}) + require("mason-lspconfig").setup({ + ensure_installed = { + "eslint", + "lua_ls", + "jsonls", + "html", + "tailwindcss", + -- "pylsp", + "dockerls", + "bashls", + "gopls", + "pyright", + }, + handlers = { + lsp.default_setup, + lua_ls = function() + local lua_opts = lsp.nvim_lua_ls() + require("lspconfig").lua_ls.setup(lua_opts) + end, + }, + }) + + local cmp_action = require("lsp-zero").cmp_action() + local cmp = require("cmp") + local cmp_select = { behavior = cmp.SelectBehavior.Select } + + require("luasnip.loaders.from_vscode").lazy_load() + + -- `/` cmdline setup. + cmp.setup.cmdline("/", { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + + -- `:` cmdline setup. + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { + name = "cmdline", + option = { + ignore_cmds = { "Man", "!" }, + }, + }, + }), + }) + + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip", keyword_length = 2 }, + { name = "buffer", keyword_length = 3 }, + { name = "path" }, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(cmp_select), + [""] = cmp.mapping.select_next_item(cmp_select), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + [""] = cmp_action.luasnip_jump_forward(), + [""] = cmp_action.luasnip_jump_backward(), + [""] = cmp_action.luasnip_supertab(), + [""] = cmp_action.luasnip_shift_supertab(), + }), + }) + end, +} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua deleted file mode 100644 index 1473d15ff0d..00000000000 --- a/lua/plugins/lspconfig.lua +++ /dev/null @@ -1,24 +0,0 @@ --- ~/.config/nvim/lua/plugins/lspconfig.lua -return { - "neovim/nvim-lspconfig", - event = { "BufReadPre", "BufNewFile", "BufWritePre" }, - config = function() - local lspconfig = require("lspconfig") - local capabilities = require("cmp_nvim_lsp").default_capabilities() - - -- Example: Python - lspconfig.pyright.setup({ - capabilities = capabilities - }) - - -- Example: Lua - lspconfig.lua_ls.setup({ - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { globals = { "vim" } }, - }, - }, - }) - end, -} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index b72654e5e56..8002641e9b9 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -1,68 +1,61 @@ return { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - -- Completion sources - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "saadparwaiz1/cmp_luasnip", + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", -- Source for text in buffer + "hrsh7th/cmp-path", -- Source for file system paths + { + "L3MON4D3/LuaSnip", -- Snippet Engine + version = "v2.*", + build = "make install_jsregexp", -- Allow lsp-snippet-transformations + }, + "rafamadriz/friendly-snippets", -- Preconfigured snippets for different languages + "onsails/lspkind.nvim", -- VS-Code like pictograms + }, + config = function() + local cmp = require("cmp") + local lspkind = require("lspkind") + local luasnip = require("luasnip") - -- Snippet engine - "L3MON4D3/LuaSnip", + require("luasnip.loaders.from_vscode").lazy_load() -- Required for friendly-snippets to work - -- Optional: VSCode-style icons - "onsails/lspkind.nvim", - }, - config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - local lspkind = require("lspkind") + -- Settings for the appearance of the completion window + vim.api.nvim_set_hl(0, "CmpNormal", { bg = "#000000", fg = "#ffffff" }) + vim.api.nvim_set_hl(0, "CmpSelect", { bg = "#000000", fg = "#b5010f" }) + vim.api.nvim_set_hl(0, "CmpBorder", { bg = "#000000", fg = "#b5010f" }) - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.complete(), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "path" }, - { name = "buffer" }, - }), - formatting = { - format = lspkind.cmp_format({ - mode = "symbol_text", -- "text", "symbol", or "symbol_text" - maxwidth = 50, - ellipsis_char = "...", - }), - }, - }) - - -- Cmdline completion (optional) - cmp.setup.cmdline("/", { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" } - } - }) - - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" } - }, { - { name = "cmdline" } - }) - }) - end, + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }), + window = { + completion = { + border = "rounded", + winhighlight = "Normal:CmpNormal,CursorLine:CmpSelect,FloatBorder:CmpBorder", + } + }, + }) + vim.cmd([[ + set completeopt=menuone,noinsert,noselect + highlight! default link CmpItemKind CmpItemMenuDefault + ]]) + end, } diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua index 29078ac4cef..e13a951896a 100644 --- a/lua/plugins/nvim-tree.lua +++ b/lua/plugins/nvim-tree.lua @@ -13,17 +13,14 @@ return { }, opts = function() local api = require("nvim-tree.api") - return { view = { width = 35, - side = "right", + side = "left", preserve_window_proportions = true, - }, - hijack_cursor = true, - view = { adaptive_size = true, }, + hijack_cursor = true, renderer = { highlight_git = true, highlight_opened_files = "name", diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua new file mode 100644 index 00000000000..3741f30a66a --- /dev/null +++ b/lua/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/tester.py b/tester.py index 7c30a2c7c39..d6a2c41a3bd 100644 --- a/tester.py +++ b/tester.py @@ -1,15 +1,20 @@ items = [1, 2, 3] - print([x**2 for x in items]) print([x**3 for x in items]) for i in items: print(i) -def myfunc(): - print("this is my func") + +def myfunc(x: int) -> str: + 'this is a docstring yuhhh' + return f"this is my num {x}" + def myfunc2(): - pass + pass + +print(myfunc(2)) +print(myfunc(3)) -myfunc() +print(myfunc(5)) From cf673381c55d8cee7fd6bda20ee99edfa00bd632 Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Sun, 25 May 2025 16:00:30 -0500 Subject: [PATCH 11/12] autoformat on save configured --- Saved/lsp/handlers.lua | 91 -------------- Saved/lsp/init.lua | 9 -- Saved/lsp/mason.lua | 52 -------- Saved/lsp/null-ls.lua | 19 --- Saved/lsp/settings/jsonls.lua | 197 ------------------------------ Saved/lsp/settings/lua_ls.lua | 16 --- Saved/lsp/settings/pyright.lua | 9 -- init.lua | 6 +- kickstart/health.lua | 52 -------- kickstart/plugins/debug.lua | 148 ---------------------- kickstart/plugins/gitsigns.lua | 61 --------- kickstart/plugins/indent_line.lua | 9 -- kickstart/plugins/lint.lua | 60 --------- kickstart/plugins/neo-tree.lua | 25 ---- lua/plugins.lua | 43 ++++--- lua/plugins/cmp-settings.lua | 75 ++++++++++++ lua/plugins/formatter.lua | 43 +++++++ lua/plugins/lsp-settings.lua | 69 +++++++++++ lua/plugins/lsp.lua | 130 -------------------- lua/plugins/nvim-cmp.lua | 61 --------- tester.py | 12 +- 21 files changed, 220 insertions(+), 967 deletions(-) delete mode 100644 Saved/lsp/handlers.lua delete mode 100644 Saved/lsp/init.lua delete mode 100644 Saved/lsp/mason.lua delete mode 100644 Saved/lsp/null-ls.lua delete mode 100644 Saved/lsp/settings/jsonls.lua delete mode 100644 Saved/lsp/settings/lua_ls.lua delete mode 100644 Saved/lsp/settings/pyright.lua delete mode 100644 kickstart/health.lua delete mode 100644 kickstart/plugins/debug.lua delete mode 100644 kickstart/plugins/gitsigns.lua delete mode 100644 kickstart/plugins/indent_line.lua delete mode 100644 kickstart/plugins/lint.lua delete mode 100644 kickstart/plugins/neo-tree.lua create mode 100644 lua/plugins/cmp-settings.lua create mode 100644 lua/plugins/formatter.lua create mode 100644 lua/plugins/lsp-settings.lua delete mode 100644 lua/plugins/lsp.lua delete mode 100644 lua/plugins/nvim-cmp.lua diff --git a/Saved/lsp/handlers.lua b/Saved/lsp/handlers.lua deleted file mode 100644 index b540d09bf40..00000000000 --- a/Saved/lsp/handlers.lua +++ /dev/null @@ -1,91 +0,0 @@ -local M = {} - -local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") -if not status_cmp_ok then - return -end - -M.capabilities = vim.lsp.protocol.make_client_capabilities() -M.capabilities.textDocument.completion.completionItem.snippetSupport = true -M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities) - -M.setup = function() - local signs = { - - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, - } - - for _, sign in ipairs(signs) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) - end - - local config = { - virtual_text = false, -- disable virtual text - signs = { - active = signs, -- show signs - }, - update_in_insert = true, - underline = true, - severity_sort = true, - float = { - focusable = true, - style = "minimal", - border = "rounded", - source = "always", - header = "", - prefix = "", - }, - } - - vim.diagnostic.config(config) - - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "rounded", - }) - - vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "rounded", - }) -end - -local function lsp_keymaps(bufnr) - local opts = { noremap = true, silent = true } - local keymap = vim.api.nvim_buf_set_keymap - keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) - keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) - keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) - keymap(bufnr, "n", "gI", "lua vim.lsp.buf.implementation()", opts) - keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) - keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", opts) - keymap(bufnr, "n", "lf", "lua vim.lsp.buf.format{ async = true }", opts) - keymap(bufnr, "n", "li", "LspInfo", opts) - keymap(bufnr, "n", "lI", "LspInstallInfo", opts) - keymap(bufnr, "n", "la", "lua vim.lsp.buf.code_action()", opts) - keymap(bufnr, "n", "lj", "lua vim.diagnostic.goto_next({buffer=0})", opts) - keymap(bufnr, "n", "lk", "lua vim.diagnostic.goto_prev({buffer=0})", opts) - keymap(bufnr, "n", "lr", "lua vim.lsp.buf.rename()", opts) - keymap(bufnr, "n", "ls", "lua vim.lsp.buf.signature_help()", opts) - keymap(bufnr, "n", "lq", "lua vim.diagnostic.setloclist()", opts) -end - -M.on_attach = function(client, bufnr) - if client.name == "tsserver" then - client.server_capabilities.documentFormattingProvider = false - end - - if client.name == "sumneko_lua" then - client.server_capabilities.documentFormattingProvider = false - end - - lsp_keymaps(bufnr) - local status_ok, illuminate = pcall(require, "illuminate") - if not status_ok then - return - end - illuminate.on_attach(client) -end - -return M diff --git a/Saved/lsp/init.lua b/Saved/lsp/init.lua deleted file mode 100644 index 0cc7120d24f..00000000000 --- a/Saved/lsp/init.lua +++ /dev/null @@ -1,9 +0,0 @@ -local status_ok, _ = pcall(require, "lspconfig") -if not status_ok then - return -end - -require "user.lsp.mason" -require("user.lsp.handlers").setup() -require "user.lsp.null-ls" - diff --git a/Saved/lsp/mason.lua b/Saved/lsp/mason.lua deleted file mode 100644 index 48e02aed977..00000000000 --- a/Saved/lsp/mason.lua +++ /dev/null @@ -1,52 +0,0 @@ -local servers = { - "lua_ls", - -- "cssls", - -- "html", - -- "tsserver", - "pyright", - -- "bashls", - "jsonls", - -- "yamlls", -} - -local settings = { - ui = { - border = "none", - icons = { - package_installed = "◍", - package_pending = "◍", - package_uninstalled = "◍", - }, - }, - log_level = vim.log.levels.INFO, - max_concurrent_installers = 4, -} - -require("mason").setup(settings) --- require("mason-lspconfig").setup({ --- ensure_installed = servers, --- automatic_installation = true, --- }) - -local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") -if not lspconfig_status_ok then - return -end - -local opts = {} - -for _, server in pairs(servers) do - opts = { - on_attach = require("user.lsp.handlers").on_attach, - capabilities = require("user.lsp.handlers").capabilities, - } - - server = vim.split(server, "@")[1] - - local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server) - if require_ok then - opts = vim.tbl_deep_extend("force", conf_opts, opts) - end - - lspconfig[server].setup(opts) -end diff --git a/Saved/lsp/null-ls.lua b/Saved/lsp/null-ls.lua deleted file mode 100644 index 874e19c532a..00000000000 --- a/Saved/lsp/null-ls.lua +++ /dev/null @@ -1,19 +0,0 @@ -local null_ls_status_ok, null_ls = pcall(require, "null-ls") -if not null_ls_status_ok then - return -end - --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting -local formatting = null_ls.builtins.formatting --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -local diagnostics = null_ls.builtins.diagnostics - -null_ls.setup({ - debug = false, - sources = { - formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), - formatting.black.with({ extra_args = { "--fast" } }), - formatting.stylua, - -- diagnostics.flake8 - }, -}) diff --git a/Saved/lsp/settings/jsonls.lua b/Saved/lsp/settings/jsonls.lua deleted file mode 100644 index e202e1e1d9b..00000000000 --- a/Saved/lsp/settings/jsonls.lua +++ /dev/null @@ -1,197 +0,0 @@ -local default_schemas = nil -local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls") -if status_ok then - default_schemas = jsonls_settings.get_default_schemas() -end - -local schemas = { - { - description = "TypeScript compiler configuration file", - fileMatch = { - "tsconfig.json", - "tsconfig.*.json", - }, - url = "https://json.schemastore.org/tsconfig.json", - }, - { - description = "Lerna config", - fileMatch = { "lerna.json" }, - url = "https://json.schemastore.org/lerna.json", - }, - { - description = "Babel configuration", - fileMatch = { - ".babelrc.json", - ".babelrc", - "babel.config.json", - }, - url = "https://json.schemastore.org/babelrc.json", - }, - { - description = "ESLint config", - fileMatch = { - ".eslintrc.json", - ".eslintrc", - }, - url = "https://json.schemastore.org/eslintrc.json", - }, - { - description = "Bucklescript config", - fileMatch = { "bsconfig.json" }, - url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json", - }, - { - description = "Prettier config", - fileMatch = { - ".prettierrc", - ".prettierrc.json", - "prettier.config.json", - }, - url = "https://json.schemastore.org/prettierrc", - }, - { - description = "Vercel Now config", - fileMatch = { "now.json" }, - url = "https://json.schemastore.org/now", - }, - { - description = "Stylelint config", - fileMatch = { - ".stylelintrc", - ".stylelintrc.json", - "stylelint.config.json", - }, - url = "https://json.schemastore.org/stylelintrc", - }, - { - description = "A JSON schema for the ASP.NET LaunchSettings.json files", - fileMatch = { "launchsettings.json" }, - url = "https://json.schemastore.org/launchsettings.json", - }, - { - description = "Schema for CMake Presets", - fileMatch = { - "CMakePresets.json", - "CMakeUserPresets.json", - }, - url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json", - }, - { - description = "Configuration file as an alternative for configuring your repository in the settings page.", - fileMatch = { - ".codeclimate.json", - }, - url = "https://json.schemastore.org/codeclimate.json", - }, - { - description = "LLVM compilation database", - fileMatch = { - "compile_commands.json", - }, - url = "https://json.schemastore.org/compile-commands.json", - }, - { - description = "Config file for Command Task Runner", - fileMatch = { - "commands.json", - }, - url = "https://json.schemastore.org/commands.json", - }, - { - description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.", - fileMatch = { - "*.cf.json", - "cloudformation.json", - }, - url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json", - }, - { - description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.", - fileMatch = { - "serverless.template", - "*.sam.json", - "sam.json", - }, - url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json", - }, - { - description = "Json schema for properties json file for a GitHub Workflow template", - fileMatch = { - ".github/workflow-templates/**.properties.json", - }, - url = "https://json.schemastore.org/github-workflow-template-properties.json", - }, - { - description = "golangci-lint configuration file", - fileMatch = { - ".golangci.toml", - ".golangci.json", - }, - url = "https://json.schemastore.org/golangci-lint.json", - }, - { - description = "JSON schema for the JSON Feed format", - fileMatch = { - "feed.json", - }, - url = "https://json.schemastore.org/feed.json", - versions = { - ["1"] = "https://json.schemastore.org/feed-1.json", - ["1.1"] = "https://json.schemastore.org/feed.json", - }, - }, - { - description = "Packer template JSON configuration", - fileMatch = { - "packer.json", - }, - url = "https://json.schemastore.org/packer.json", - }, - { - description = "NPM configuration file", - fileMatch = { - "package.json", - }, - url = "https://json.schemastore.org/package.json", - }, - { - description = "JSON schema for Visual Studio component configuration files", - fileMatch = { - "*.vsconfig", - }, - url = "https://json.schemastore.org/vsconfig.json", - }, - { - description = "Resume json", - fileMatch = { "resume.json" }, - url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json", - }, -} - -local function extend(tab1, tab2) - for _, value in ipairs(tab2 or {}) do - table.insert(tab1, value) - end - return tab1 -end - -local extended_schemas = extend(schemas, default_schemas) - -local opts = { - settings = { - json = { - schemas = extended_schemas, - }, - }, - setup = { - commands = { - Format = { - function() - vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) - end, - }, - }, - }, -} - -return opts diff --git a/Saved/lsp/settings/lua_ls.lua b/Saved/lsp/settings/lua_ls.lua deleted file mode 100644 index 0ac454a7202..00000000000 --- a/Saved/lsp/settings/lua_ls.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - settings = { - - Lua = { - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.stdpath("config") .. "/lua"] = true, - }, - }, - }, - }, -} diff --git a/Saved/lsp/settings/pyright.lua b/Saved/lsp/settings/pyright.lua deleted file mode 100644 index c2a518dba1c..00000000000 --- a/Saved/lsp/settings/pyright.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - settings = { - python = { - analysis = { - typeCheckingMode = "off", - }, - }, - }, -} diff --git a/init.lua b/init.lua index ef3b323c21b..8890a3c4a6a 100644 --- a/init.lua +++ b/init.lua @@ -18,7 +18,7 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup { { import = 'plugins' }, - { import = 'plugins.lsp' }, + -- { import = 'plugins.lsp' }, } require 'user.options' @@ -30,5 +30,5 @@ require 'user.autocmds' -- require 'user.treesitter' -- require 'user.autopairs' -vim.lsp.enable('pyright') -vim.lsp.enable('lua_ls') +-- vim.lsp.enable('pyright') +-- vim.lsp.enable('lua_ls') diff --git a/kickstart/health.lua b/kickstart/health.lua deleted file mode 100644 index b59d08649af..00000000000 --- a/kickstart/health.lua +++ /dev/null @@ -1,52 +0,0 @@ ---[[ --- --- This file is not required for your own configuration, --- but helps people determine if their system is setup correctly. --- ---]] - -local check_version = function() - local verstr = tostring(vim.version()) - if not vim.version.ge then - vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) - return - end - - if vim.version.ge(vim.version(), '0.10-dev') then - vim.health.ok(string.format("Neovim version is: '%s'", verstr)) - else - vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) - end -end - -local check_external_reqs = function() - -- Basic utils: `git`, `make`, `unzip` - for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do - local is_executable = vim.fn.executable(exe) == 1 - if is_executable then - vim.health.ok(string.format("Found executable: '%s'", exe)) - else - vim.health.warn(string.format("Could not find executable: '%s'", exe)) - end - end - - return true -end - -return { - check = function() - vim.health.start 'kickstart.nvim' - - vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth` - - Fix only warnings for plugins and languages you intend to use. - Mason will give warnings for languages that are not installed. - You do not need to install, unless you want to use those languages!]] - - local uv = vim.uv or vim.loop - vim.health.info('System Information: ' .. vim.inspect(uv.os_uname())) - - check_version() - check_external_reqs() - end, -} diff --git a/kickstart/plugins/debug.lua b/kickstart/plugins/debug.lua deleted file mode 100644 index 753cb0cedd3..00000000000 --- a/kickstart/plugins/debug.lua +++ /dev/null @@ -1,148 +0,0 @@ --- debug.lua --- --- Shows how to use the DAP plugin to debug your code. --- --- Primarily focused on configuring the debugger for Go, but can --- be extended to other languages as well. That's why it's called --- kickstart.nvim and not kitchen-sink.nvim ;) - -return { - -- NOTE: Yes, you can install new plugins here! - 'mfussenegger/nvim-dap', - -- NOTE: And you can specify dependencies as well - dependencies = { - -- Creates a beautiful debugger UI - 'rcarriga/nvim-dap-ui', - - -- Required dependency for nvim-dap-ui - 'nvim-neotest/nvim-nio', - - -- Installs the debug adapters for you - 'williamboman/mason.nvim', - 'jay-babu/mason-nvim-dap.nvim', - - -- Add your own debuggers here - 'leoluz/nvim-dap-go', - }, - keys = { - -- Basic debugging keymaps, feel free to change to your liking! - { - '', - function() - require('dap').continue() - end, - desc = 'Debug: Start/Continue', - }, - { - '', - function() - require('dap').step_into() - end, - desc = 'Debug: Step Into', - }, - { - '', - function() - require('dap').step_over() - end, - desc = 'Debug: Step Over', - }, - { - '', - function() - require('dap').step_out() - end, - desc = 'Debug: Step Out', - }, - { - 'b', - function() - require('dap').toggle_breakpoint() - end, - desc = 'Debug: Toggle Breakpoint', - }, - { - 'B', - function() - require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, - desc = 'Debug: Set Breakpoint', - }, - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - { - '', - function() - require('dapui').toggle() - end, - desc = 'Debug: See last session result.', - }, - }, - config = function() - local dap = require 'dap' - local dapui = require 'dapui' - - require('mason-nvim-dap').setup { - -- Makes a best effort to setup the various debuggers with - -- reasonable debug configurations - automatic_installation = true, - - -- You can provide additional configuration to the handlers, - -- see mason-nvim-dap README for more information - handlers = {}, - - -- You'll need to check that you have the required things installed - -- online, please don't ask me how to install them :) - ensure_installed = { - -- Update this to ensure that you have the debuggers for the langs you want - 'delve', - }, - } - - -- Dap UI setup - -- For more information, see |:help nvim-dap-ui| - dapui.setup { - -- Set icons to characters that are more likely to work in every terminal. - -- Feel free to remove or use ones that you like more! :) - -- Don't feel like these are good choices. - icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, - controls = { - icons = { - pause = '⏸', - play = '▶', - step_into = '⏎', - step_over = '⏭', - step_out = '⏮', - step_back = 'b', - run_last = '▶▶', - terminate = '⏹', - disconnect = '⏏', - }, - }, - } - - -- Change breakpoint icons - -- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) - -- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) - -- local breakpoint_icons = vim.g.have_nerd_font - -- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' } - -- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' } - -- for type, icon in pairs(breakpoint_icons) do - -- local tp = 'Dap' .. type - -- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak' - -- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl }) - -- end - - dap.listeners.after.event_initialized['dapui_config'] = dapui.open - dap.listeners.before.event_terminated['dapui_config'] = dapui.close - dap.listeners.before.event_exited['dapui_config'] = dapui.close - - -- Install golang specific config - require('dap-go').setup { - delve = { - -- On Windows delve must be run attached or it crashes. - -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring - detached = vim.fn.has 'win32' == 0, - }, - } - end, -} diff --git a/kickstart/plugins/gitsigns.lua b/kickstart/plugins/gitsigns.lua deleted file mode 100644 index 4bcc70f4c79..00000000000 --- a/kickstart/plugins/gitsigns.lua +++ /dev/null @@ -1,61 +0,0 @@ --- Adds git related signs to the gutter, as well as utilities for managing changes --- NOTE: gitsigns is already included in init.lua but contains only the base --- config. This will add also the recommended keymaps. - -return { - { - 'lewis6991/gitsigns.nvim', - opts = { - on_attach = function(bufnr) - local gitsigns = require 'gitsigns' - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map('n', ']c', function() - if vim.wo.diff then - vim.cmd.normal { ']c', bang = true } - else - gitsigns.nav_hunk 'next' - end - end, { desc = 'Jump to next git [c]hange' }) - - map('n', '[c', function() - if vim.wo.diff then - vim.cmd.normal { '[c', bang = true } - else - gitsigns.nav_hunk 'prev' - end - end, { desc = 'Jump to previous git [c]hange' }) - - -- Actions - -- visual mode - map('v', 'hs', function() - gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'stage git hunk' }) - map('v', 'hr', function() - gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'reset git hunk' }) - -- normal mode - map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) - map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) - map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) - map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) - map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) - map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) - map('n', 'hD', function() - gitsigns.diffthis '@' - end, { desc = 'git [D]iff against last commit' }) - -- Toggles - map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) - end, - }, - }, -} diff --git a/kickstart/plugins/indent_line.lua b/kickstart/plugins/indent_line.lua deleted file mode 100644 index ed7f269399f..00000000000 --- a/kickstart/plugins/indent_line.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - { -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help ibl` - main = 'ibl', - opts = {}, - }, -} diff --git a/kickstart/plugins/lint.lua b/kickstart/plugins/lint.lua deleted file mode 100644 index 907c6bf3e31..00000000000 --- a/kickstart/plugins/lint.lua +++ /dev/null @@ -1,60 +0,0 @@ -return { - - { -- Linting - 'mfussenegger/nvim-lint', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - local lint = require 'lint' - lint.linters_by_ft = { - markdown = { 'markdownlint' }, - } - - -- To allow other plugins to add linters to require('lint').linters_by_ft, - -- instead set linters_by_ft like this: - -- lint.linters_by_ft = lint.linters_by_ft or {} - -- lint.linters_by_ft['markdown'] = { 'markdownlint' } - -- - -- However, note that this will enable a set of default linters, - -- which will cause errors unless these tools are available: - -- { - -- clojure = { "clj-kondo" }, - -- dockerfile = { "hadolint" }, - -- inko = { "inko" }, - -- janet = { "janet" }, - -- json = { "jsonlint" }, - -- markdown = { "vale" }, - -- rst = { "vale" }, - -- ruby = { "ruby" }, - -- terraform = { "tflint" }, - -- text = { "vale" } - -- } - -- - -- You can disable the default linters by setting their filetypes to nil: - -- lint.linters_by_ft['clojure'] = nil - -- lint.linters_by_ft['dockerfile'] = nil - -- lint.linters_by_ft['inko'] = nil - -- lint.linters_by_ft['janet'] = nil - -- lint.linters_by_ft['json'] = nil - -- lint.linters_by_ft['markdown'] = nil - -- lint.linters_by_ft['rst'] = nil - -- lint.linters_by_ft['ruby'] = nil - -- lint.linters_by_ft['terraform'] = nil - -- lint.linters_by_ft['text'] = nil - - -- Create autocommand which carries out the actual linting - -- on the specified events. - local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) - vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { - group = lint_augroup, - callback = function() - -- Only run the linter in buffers that you can modify in order to - -- avoid superfluous noise, notably within the handy LSP pop-ups that - -- describe the hovered symbol using Markdown. - if vim.opt_local.modifiable:get() then - lint.try_lint() - end - end, - }) - end, - }, -} diff --git a/kickstart/plugins/neo-tree.lua b/kickstart/plugins/neo-tree.lua deleted file mode 100644 index bd4422695aa..00000000000 --- a/kickstart/plugins/neo-tree.lua +++ /dev/null @@ -1,25 +0,0 @@ --- Neo-tree is a Neovim plugin to browse the file system --- https://github.com/nvim-neo-tree/neo-tree.nvim - -return { - 'nvim-neo-tree/neo-tree.nvim', - version = '*', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended - 'MunifTanjim/nui.nvim', - }, - cmd = 'Neotree', - keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, - }, - opts = { - filesystem = { - window = { - mappings = { - ['\\'] = 'close_window', - }, - }, - }, - }, -} diff --git a/lua/plugins.lua b/lua/plugins.lua index 9a9ff67f689..4d6d862adb9 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,6 +1,6 @@ return { - {'folke/tokyonight.nvim'}, - { "nvim-lua/popup.nvim" }, -- An implementation of the Popup API from vim in Neovim + { 'folke/tokyonight.nvim' }, + { "nvim-lua/popup.nvim" }, -- An implementation of the Popup API from vim in Neovim { "nvim-lua/plenary.nvim" }, -- Useful lua functions used ny lots of plugins { "windwp/nvim-autopairs" }, -- Autopairs -- "numToStr/Comment.nvim" -- Easily comment stuff @@ -9,25 +9,12 @@ return { -- "lunarvim/colorschemes" -- A bunch of colorschemes you can try out { "lunarvim/darkplus.nvim" }, { "moll/vim-bbye" }, --- cmp plugins - -- { "hrsh7th/nvim-cmp" }, -- The completion plugin - -- { "hrsh7th/cmp-buffer" }, -- buffer completions - -- { "hrsh7th/cmp-path" }, -- path completions - -- { "hrsh7th/cmp-nvim-lua" }, - -- { "hrsh7th/cmp-cmdline" }, -- cmdline completions - -- { "saadparwaiz1/cmp_luasnip" }, -- snippet completions - -- { "hrsh7th/cmp-nvim-lsp" }, --- snippets - { "L3MON4D3/LuaSnip" }, --snippet engine + -- snippets + { "L3MON4D3/LuaSnip" }, --snippet engine { "rafamadriz/friendly-snippets" }, -- a bunch of snippets to use --- LSP - -- { "neovim/nvim-lspconfig" }, -- enable LSP - -- { "williamboman/mason.nvim" }, -- simple to use language server installer - -- { "williamboman/mason-lspconfig.nvim" }, -- simple to use language server installer - --- Telescope + -- Telescope { "nvim-telescope/telescope-media-files.nvim" }, -- Treesitter @@ -37,4 +24,24 @@ return { }, -- "p00f/nvim-ts-rainbow" -- "nvim-treesitter/playground" + { "neovim/nvim-lspconfig" }, + { "williamboman/mason.nvim" }, + { "williamboman/mason-lspconfig.nvim" }, + { + "hrsh7th/nvim-cmp", + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + 'hrsh7th/cmp-vsnip', + 'hrsh7th/vim-vsnip', + 'rafamadriz/friendly-snippets', + } + }, + { 'mfussenegger/nvim-lint', }, + { 'mfussenegger/nvim-dap' }, + { 'mhartington/formatter.nvim' } } diff --git a/lua/plugins/cmp-settings.lua b/lua/plugins/cmp-settings.lua new file mode 100644 index 00000000000..32c80c76761 --- /dev/null +++ b/lua/plugins/cmp-settings.lua @@ -0,0 +1,75 @@ +-- ~/.config/nvim/lua/plugins/cmp.lua +return { + { + "hrsh7th/nvim-cmp", + dependencies = { + "L3MON4D3/LuaSnip", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + -- Optional extras: + -- "petertriho/cmp-git", + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + + -- Load friendly snippets + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + }), + }) + + -- Git commits + cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "git" }, -- if using petertriho/cmp-git + }, { + { name = "buffer" }, + }), + }) + + -- Search (/ and ?) + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + + -- Command mode (:) + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + }) + end, + }, +} + diff --git a/lua/plugins/formatter.lua b/lua/plugins/formatter.lua new file mode 100644 index 00000000000..0602a993b2c --- /dev/null +++ b/lua/plugins/formatter.lua @@ -0,0 +1,43 @@ +return { + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + keys = { + { + -- Customize or remove this keymap to your liking + 'f', + function() + require('conform').format { async = true } + end, + mode = 'n', + desc = 'Format buffer', + }, + }, + -- This will provide type hinting with LuaLS + ---@module "conform" + ---@type conform.setupOpts + opts = { + -- Define your formatters + formatters_by_ft = { + lua = { 'stylua' }, + python = { 'isort', 'black' }, + javascript = { 'prettierd', 'prettier', stop_after_first = true }, + }, + -- Set default options + default_format_opts = { + lsp_format = 'fallback', + }, + -- Set up format-on-save + format_on_save = { timeout_ms = 500 }, + -- Customize formatters + formatters = { + shfmt = { + prepend_args = { '-i', '2' }, + }, + }, + }, + init = function() + -- If you want the formatexpr, here is the place to set it + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + end, +} diff --git a/lua/plugins/lsp-settings.lua b/lua/plugins/lsp-settings.lua new file mode 100644 index 00000000000..2ac0bc5b544 --- /dev/null +++ b/lua/plugins/lsp-settings.lua @@ -0,0 +1,69 @@ +-- ~/.config/nvim/lua/plugins/custom-lsp.lua +return { + { + "neovim/nvim-lspconfig", + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + }, + config = function() + -- Setup Mason + require("mason").setup() + require("mason-lspconfig").setup() + + -- LSPs to enable + -- local servers = { + -- "lua_ls", + -- "ols", + -- "zls", + -- "clangd", + -- "jsonls", + -- "html", + -- "rust_analyzer", + -- "jdtls", + -- "eslint", + -- "pyright", + -- } + + local lspconfig = require("lspconfig") + local capabilities = require("cmp_nvim_lsp").default_capabilities() + + -- for _, server in ipairs(servers) do + -- lspconfig[server].setup({ + -- capabilities = capabilities, + -- }) + -- end + + -- Autocommand for keymaps + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + local map = function(keys, func, desc) + vim.keymap.set("n", keys, func, { buffer = ev.buf, desc = "Lsp: " .. desc }) + end + + local tele = require("telescope.builtin") + + map("gd", tele.lsp_definitions, "Goto Definition") + map("fs", tele.lsp_document_symbols, "Doc Symbols") + map("fS", tele.lsp_dynamic_workspace_symbols, "Dynamic Symbols") + map("ft", tele.lsp_type_definitions, "Goto Type") + map("fr", tele.lsp_references, "Goto References") + map("fi", tele.lsp_implementations, "Goto Impl") + + map("K", vim.lsp.buf.hover, "Hover Docs") + map("E", vim.diagnostic.open_float, "Diagnostics") + map("k", vim.lsp.buf.signature_help, "Signature Help") + map("rn", vim.lsp.buf.rename, "Rename") + map("ca", vim.lsp.buf.code_action, "Code Action") + map("wf", function() + vim.lsp.buf.format({ async = true }) + end, "Format") + + vim.keymap.set("v", "ca", vim.lsp.buf.code_action, { buffer = ev.buf, desc = "Lsp: Code Action" }) + end, + }) + end, + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua deleted file mode 100644 index 6f1b581ce11..00000000000 --- a/lua/plugins/lsp.lua +++ /dev/null @@ -1,130 +0,0 @@ --- return { --- "mason-org/mason-lspconfig.nvim", --- opts = { --- ensure_installed = { "lua_ls", "rust_analyzer", "pyright" }, --- }, --- dependencies = { --- { "mason-org/mason.nvim", opts = {} }, --- "neovim/nvim-lspconfig", --- }, --- } -return { - "VonHeikemen/lsp-zero.nvim", - branch = "v2.x", - dependencies = { - -- LSP Support - { "neovim/nvim-lspconfig" }, -- Required - { -- Optional - "williamboman/mason.nvim", - build = function() - pcall(vim.cmd, "MasonUpdate") - end, - }, - { "williamboman/mason-lspconfig.nvim" }, -- Optional - - -- Autocompletion - { "hrsh7th/nvim-cmp" }, -- Required - { "hrsh7th/cmp-nvim-lsp" }, -- Required - { "L3MON4D3/LuaSnip" }, -- Required - { "rafamadriz/friendly-snippets" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/cmp-path" }, - { "hrsh7th/cmp-cmdline" }, - { "saadparwaiz1/cmp_luasnip" }, - }, - config = function() - local lsp = require("lsp-zero") - - lsp.on_attach(function(client, bufnr) - local opts = { buffer = bufnr, remap = false } - - vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Goto Reference" })) - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Goto Definition" })) - vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Hover" })) - vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Workspace Symbol" })) - vim.keymap.set("n", "vd", function() vim.diagnostic.setloclist() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Show Diagnostics" })) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, vim.tbl_deep_extend("force", opts, { desc = "Next Diagnostic" })) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, vim.tbl_deep_extend("force", opts, { desc = "Previous Diagnostic" })) - vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Code Action" })) - vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, vim.tbl_deep_extend("force", opts, { desc = "LSP References" })) - vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Rename" })) - vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, vim.tbl_deep_extend("force", opts, { desc = "LSP Signature Help" })) - end) - - require("mason").setup({}) - require("mason-lspconfig").setup({ - ensure_installed = { - "eslint", - "lua_ls", - "jsonls", - "html", - "tailwindcss", - -- "pylsp", - "dockerls", - "bashls", - "gopls", - "pyright", - }, - handlers = { - lsp.default_setup, - lua_ls = function() - local lua_opts = lsp.nvim_lua_ls() - require("lspconfig").lua_ls.setup(lua_opts) - end, - }, - }) - - local cmp_action = require("lsp-zero").cmp_action() - local cmp = require("cmp") - local cmp_select = { behavior = cmp.SelectBehavior.Select } - - require("luasnip.loaders.from_vscode").lazy_load() - - -- `/` cmdline setup. - cmp.setup.cmdline("/", { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, - }) - - -- `:` cmdline setup. - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { - name = "cmdline", - option = { - ignore_cmds = { "Man", "!" }, - }, - }, - }), - }) - - cmp.setup({ - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - sources = { - { name = "nvim_lsp" }, - { name = "luasnip", keyword_length = 2 }, - { name = "buffer", keyword_length = 3 }, - { name = "path" }, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_prev_item(cmp_select), - [""] = cmp.mapping.select_next_item(cmp_select), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), - [""] = cmp_action.luasnip_jump_forward(), - [""] = cmp_action.luasnip_jump_backward(), - [""] = cmp_action.luasnip_supertab(), - [""] = cmp_action.luasnip_shift_supertab(), - }), - }) - end, -} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua deleted file mode 100644 index 8002641e9b9..00000000000 --- a/lua/plugins/nvim-cmp.lua +++ /dev/null @@ -1,61 +0,0 @@ -return { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-buffer", -- Source for text in buffer - "hrsh7th/cmp-path", -- Source for file system paths - { - "L3MON4D3/LuaSnip", -- Snippet Engine - version = "v2.*", - build = "make install_jsregexp", -- Allow lsp-snippet-transformations - }, - "rafamadriz/friendly-snippets", -- Preconfigured snippets for different languages - "onsails/lspkind.nvim", -- VS-Code like pictograms - }, - config = function() - local cmp = require("cmp") - local lspkind = require("lspkind") - local luasnip = require("luasnip") - - require("luasnip.loaders.from_vscode").lazy_load() -- Required for friendly-snippets to work - - -- Settings for the appearance of the completion window - vim.api.nvim_set_hl(0, "CmpNormal", { bg = "#000000", fg = "#ffffff" }) - vim.api.nvim_set_hl(0, "CmpSelect", { bg = "#000000", fg = "#b5010f" }) - vim.api.nvim_set_hl(0, "CmpBorder", { bg = "#000000", fg = "#b5010f" }) - - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }), - window = { - completion = { - border = "rounded", - winhighlight = "Normal:CmpNormal,CursorLine:CmpSelect,FloatBorder:CmpBorder", - } - }, - }) - vim.cmd([[ - set completeopt=menuone,noinsert,noselect - highlight! default link CmpItemKind CmpItemMenuDefault - ]]) - end, -} diff --git a/tester.py b/tester.py index d6a2c41a3bd..aa93b791de6 100644 --- a/tester.py +++ b/tester.py @@ -1,20 +1,18 @@ items = [1, 2, 3] -print([x**2 for x in items]) -print([x**3 for x in items]) for i in items: print(i) def myfunc(x: int) -> str: - 'this is a docstring yuhhh' + "this is a docstring yuhhh" return f"this is my num {x}" def myfunc2(): - pass + pass -print(myfunc(2)) -print(myfunc(3)) -print(myfunc(5)) +print(myfunc(4)) + +print(myfunc(5)) From a9aead8bd6e36132c81bf559bf7dc1810196c069 Mon Sep 17 00:00:00 2001 From: Daniel B Sherry Date: Wed, 27 Aug 2025 11:34:00 -0500 Subject: [PATCH 12/12] latest --- LICENSE.md | 19 --- README.md | 233 ----------------------------------- Saved/autopairs.lua | 33 ----- Saved/lazy.lua | 37 ------ lua/plugins.lua | 56 ++++----- lua/plugins/lsp-settings.lua | 88 ++++++------- lua/plugins/tmux.lua | 18 +++ lua/plugins/which-key.lua | 10 +- lua/user/keymaps.lua | 104 ++++++++-------- test.py | 6 + tester.py | 18 --- 11 files changed, 151 insertions(+), 471 deletions(-) delete mode 100644 LICENSE.md delete mode 100644 README.md delete mode 100644 Saved/autopairs.lua delete mode 100644 Saved/lazy.lua create mode 100644 lua/plugins/tmux.lua create mode 100644 test.py delete mode 100644 tester.py diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 9cf106272ac..00000000000 --- a/LICENSE.md +++ /dev/null @@ -1,19 +0,0 @@ -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 800ca990d51..00000000000 --- a/README.md +++ /dev/null @@ -1,233 +0,0 @@ -# kickstart.nvim - -## Introduction - -A starting point for Neovim that is: - -* Small -* Single-file -* Completely Documented - -**NOT** a Neovim distribution, but instead a starting point for your configuration. - -## Installation - -### Install Neovim - -Kickstart.nvim targets *only* the latest -['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest -['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. -If you are experiencing issues, please make sure you have the latest versions. - -### Install External Dependencies - -External Requirements: -- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) -- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) -- Clipboard tool (xclip/xsel/win32yank or other depending on platform) -- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - - if you have it set `vim.g.have_nerd_font` in `init.lua` to true -- Language Setup: - - If you want to write Typescript, you need `npm` - - If you want to write Golang, you will need `go` - - etc. - -> **NOTE** -> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes -> and quick install snippets - -### Install Kickstart - -> **NOTE** -> [Backup](#FAQ) your previous configuration (if any exists) - -Neovim's configurations are located under the following paths, depending on your OS: - -| OS | PATH | -| :- | :--- | -| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows (cmd)| `%localappdata%\nvim\` | -| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | - -#### Recommended Step - -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo -so that you have your own copy that you can modify, then install by cloning the -fork to your machine using one of the commands below, depending on your OS. - -> **NOTE** -> Your fork's url will be something like this: -> `https://github.com//kickstart.nvim.git` - -You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file -too - it's ignored in the kickstart repo to make maintenance easier, but it's -[recommmended to track it in version control](https://lazy.folke.io/usage/lockfile). - -#### Clone kickstart.nvim -> **NOTE** -> If following the recommended step above (i.e., forking the repo), replace -> `nvim-lua` with `` in the commands below - -
Linux and Mac - -```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim -``` - -
- -
Windows - -If you're using `cmd.exe`: - -``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim" -``` - -If you're using `powershell.exe` - -``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" -``` - -
- -### Post Installation - -Start Neovim - -```sh -nvim -``` - -That's it! Lazy will install all the plugins you have. Use `:Lazy` to view -current plugin status. Hit `q` to close the window. - -Read through the `init.lua` file in your configuration folder for more -information about extending and exploring Neovim. That also includes -examples of adding popularly requested plugins. - - -### Getting Started - -[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) - -### FAQ - -* What should I do if I already have a pre-existing neovim configuration? - * You should back it up and then delete all associated files. - * This includes your existing init.lua and the neovim files in `~/.local` - which can be deleted with `rm -rf ~/.local/share/nvim/` -* Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` - to maintain multiple configurations. For example, you can install the kickstart - configuration in `~/.config/nvim-kickstart` and create an alias: - ``` - alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' - ``` - When you run Neovim using `nvim-kickstart` alias it will use the alternative - config directory and the matching local directory - `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim - distribution that you would like to try out. -* What if I want to "uninstall" this configuration: - * See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information -* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? - * The main purpose of kickstart is to serve as a teaching tool and a reference - configuration that someone can easily use to `git clone` as a basis for their own. - As you progress in learning Neovim and Lua, you might consider splitting `init.lua` - into smaller parts. A fork of kickstart that does this while maintaining the - same functionality is available here: - * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) - * Discussions on this topic can be found here: - * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) - * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) - -### Install Recipes - -Below you can find OS specific install instructions for Neovim and dependencies. - -After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step. - -#### Windows Installation - -
Windows with Microsoft C++ Build Tools and CMake -Installation may require installing build tools and updating the run command for `telescope-fzf-native` - -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) - -This requires: - -- Install CMake and the Microsoft C++ Build Tools on Windows - -```lua -{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } -``` -
-
Windows with gcc/make using chocolatey -Alternatively, one can install gcc and make which don't require changing the config, -the easiest way is to use choco: - -1. install [chocolatey](https://chocolatey.org/install) -either follow the instructions on the page or use winget, -run in cmd as **admin**: -``` -winget install --accept-source-agreements chocolatey.chocolatey -``` - -2. install all requirements using choco, exit previous cmd and -open a new one so that choco path is set, and run in cmd as **admin**: -``` -choco install -y neovim git ripgrep wget fd unzip gzip mingw make -``` -
-
WSL (Windows Subsystem for Linux) - -``` -wsl --install -wsl -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip neovim -``` -
- -#### Linux Install -
Ubuntu Install Steps - -``` -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip neovim -``` -
-
Debian Install Steps - -``` -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip curl - -# Now we install nvim -curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz -sudo rm -rf /opt/nvim-linux64 -sudo mkdir -p /opt/nvim-linux64 -sudo chmod a+rX /opt/nvim-linux64 -sudo tar -C /opt -xzf nvim-linux64.tar.gz - -# make it available in /usr/local/bin, distro installs to /usr/bin -sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/ -``` -
-
Fedora Install Steps - -``` -sudo dnf install -y gcc make git ripgrep fd-find unzip neovim -``` -
- -
Arch Install Steps - -``` -sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim -``` -
- diff --git a/Saved/autopairs.lua b/Saved/autopairs.lua deleted file mode 100644 index 577e571e20a..00000000000 --- a/Saved/autopairs.lua +++ /dev/null @@ -1,33 +0,0 @@ --- Setup nvim-cmp. -local status_ok, npairs = pcall(require, "nvim-autopairs") -if not status_ok then - return -end - -npairs.setup { - check_ts = true, - ts_config = { - lua = { "string", "source" }, - javascript = { "string", "template_string" }, - java = false, - }, - disable_filetype = { "TelescopePrompt", "spectre_panel" }, - fast_wrap = { - map = "", - chars = { "{", "[", "(", '"', "'" }, - pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), - offset = 0, -- Offset from pattern match - end_key = "$", - keys = "qwertyuiopzxcvbnmasdfghjkl", - check_comma = true, - highlight = "PmenuSel", - highlight_grey = "LineNr", - }, -} - -local cmp_autopairs = require "nvim-autopairs.completion.cmp" -local cmp_status_ok, cmp = pcall(require, "cmp") -if not cmp_status_ok then - return -end -cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } }) diff --git a/Saved/lazy.lua b/Saved/lazy.lua deleted file mode 100644 index efda595ec3c..00000000000 --- a/Saved/lazy.lua +++ /dev/null @@ -1,37 +0,0 @@ --- 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) - --- Make sure to setup `mapleader` and `maplocalleader` before --- loading lazy.nvim so that mappings are correct. --- This is also a good place to setup other settings (vim.opt) -vim.g.mapleader = " " -vim.g.maplocalleader = " " - --- My plugins here - --- Setup lazy.nvim -require("lazy").setup({ - spec = { - -- import your plugins - { import = "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/plugins.lua b/lua/plugins.lua index 4d6d862adb9..7cfbbdc99b3 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,47 +1,47 @@ return { { 'folke/tokyonight.nvim' }, - { "nvim-lua/popup.nvim" }, -- An implementation of the Popup API from vim in Neovim - { "nvim-lua/plenary.nvim" }, -- Useful lua functions used ny lots of plugins - { "windwp/nvim-autopairs" }, -- Autopairs + { 'nvim-lua/popup.nvim' }, -- An implementation of the Popup API from vim in Neovim + { 'nvim-lua/plenary.nvim' }, -- Useful lua functions used ny lots of plugins + { 'windwp/nvim-autopairs' }, -- Autopairs -- "numToStr/Comment.nvim" -- Easily comment stuff { 'kyazdani42/nvim-web-devicons' }, -- Colorschemes -- "lunarvim/colorschemes" -- A bunch of colorschemes you can try out - { "lunarvim/darkplus.nvim" }, - { "moll/vim-bbye" }, + { 'lunarvim/darkplus.nvim' }, + { 'moll/vim-bbye' }, -- snippets - { "L3MON4D3/LuaSnip" }, --snippet engine - { "rafamadriz/friendly-snippets" }, -- a bunch of snippets to use - + { 'L3MON4D3/LuaSnip' }, --snippet engine + { 'rafamadriz/friendly-snippets' }, -- a bunch of snippets to use + -- { 'christoomey/vim-tmux-navigator' }, -- tmux & split window navigation -- Telescope - { "nvim-telescope/telescope-media-files.nvim" }, + { 'nvim-telescope/telescope-media-files.nvim' }, -- Treesitter { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', }, -- "p00f/nvim-ts-rainbow" -- "nvim-treesitter/playground" - { "neovim/nvim-lspconfig" }, - { "williamboman/mason.nvim" }, - { "williamboman/mason-lspconfig.nvim" }, + { 'neovim/nvim-lspconfig' }, + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, { - "hrsh7th/nvim-cmp", - dependencies = { - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', - 'hrsh7th/cmp-vsnip', - 'hrsh7th/vim-vsnip', - 'rafamadriz/friendly-snippets', - } + 'hrsh7th/nvim-cmp', + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + 'hrsh7th/cmp-vsnip', + 'hrsh7th/vim-vsnip', + 'rafamadriz/friendly-snippets', + }, }, - { 'mfussenegger/nvim-lint', }, + { 'mfussenegger/nvim-lint' }, { 'mfussenegger/nvim-dap' }, - { 'mhartington/formatter.nvim' } + { 'mhartington/formatter.nvim' }, } diff --git a/lua/plugins/lsp-settings.lua b/lua/plugins/lsp-settings.lua index 2ac0bc5b544..2a21476f55b 100644 --- a/lua/plugins/lsp-settings.lua +++ b/lua/plugins/lsp-settings.lua @@ -1,67 +1,67 @@ -- ~/.config/nvim/lua/plugins/custom-lsp.lua return { { - "neovim/nvim-lspconfig", + 'neovim/nvim-lspconfig', dependencies = { - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - "hrsh7th/cmp-nvim-lsp", + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + 'hrsh7th/cmp-nvim-lsp', }, config = function() -- Setup Mason - require("mason").setup() - require("mason-lspconfig").setup() + require('mason').setup() + require('mason-lspconfig').setup() -- LSPs to enable - -- local servers = { - -- "lua_ls", - -- "ols", - -- "zls", - -- "clangd", - -- "jsonls", - -- "html", - -- "rust_analyzer", - -- "jdtls", - -- "eslint", - -- "pyright", - -- } + local servers = { + 'lua_ls', + 'ols', + 'zls', + 'clangd', + 'jsonls', + 'html', + 'rust_analyzer', + 'jdtls', + 'eslint', + 'pyright', + } - local lspconfig = require("lspconfig") - local capabilities = require("cmp_nvim_lsp").default_capabilities() + local lspconfig = require 'lspconfig' + local capabilities = require('cmp_nvim_lsp').default_capabilities() - -- for _, server in ipairs(servers) do - -- lspconfig[server].setup({ - -- capabilities = capabilities, - -- }) - -- end + for _, server in ipairs(servers) do + lspconfig[server].setup { + capabilities = capabilities, + } + end -- Autocommand for keymaps - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev) local map = function(keys, func, desc) - vim.keymap.set("n", keys, func, { buffer = ev.buf, desc = "Lsp: " .. desc }) + vim.keymap.set('n', keys, func, { buffer = ev.buf, desc = 'Lsp: ' .. desc }) end - local tele = require("telescope.builtin") + local tele = require 'telescope.builtin' - map("gd", tele.lsp_definitions, "Goto Definition") - map("fs", tele.lsp_document_symbols, "Doc Symbols") - map("fS", tele.lsp_dynamic_workspace_symbols, "Dynamic Symbols") - map("ft", tele.lsp_type_definitions, "Goto Type") - map("fr", tele.lsp_references, "Goto References") - map("fi", tele.lsp_implementations, "Goto Impl") + map('gd', tele.lsp_definitions, 'Goto Definition') + map('fs', tele.lsp_document_symbols, 'Doc Symbols') + map('fS', tele.lsp_dynamic_workspace_symbols, 'Dynamic Symbols') + map('ft', tele.lsp_type_definitions, 'Goto Type') + map('fr', tele.lsp_references, 'Goto References') + map('fi', tele.lsp_implementations, 'Goto Impl') - map("K", vim.lsp.buf.hover, "Hover Docs") - map("E", vim.diagnostic.open_float, "Diagnostics") - map("k", vim.lsp.buf.signature_help, "Signature Help") - map("rn", vim.lsp.buf.rename, "Rename") - map("ca", vim.lsp.buf.code_action, "Code Action") - map("wf", function() - vim.lsp.buf.format({ async = true }) - end, "Format") + map('K', vim.lsp.buf.hover, 'Hover Docs') + map('E', vim.diagnostic.open_float, 'Diagnostics') + map('k', vim.lsp.buf.signature_help, 'Signature Help') + map('rn', vim.lsp.buf.rename, 'Rename') + map('ca', vim.lsp.buf.code_action, 'Code Action') + map('wf', function() + vim.lsp.buf.format { async = true } + end, 'Format') - vim.keymap.set("v", "ca", vim.lsp.buf.code_action, { buffer = ev.buf, desc = "Lsp: Code Action" }) + vim.keymap.set('v', 'ca', vim.lsp.buf.code_action, { buffer = ev.buf, desc = 'Lsp: Code Action' }) end, }) end, diff --git a/lua/plugins/tmux.lua b/lua/plugins/tmux.lua new file mode 100644 index 00000000000..26fb72ba14c --- /dev/null +++ b/lua/plugins/tmux.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/plugins/which-key.lua b/lua/plugins/which-key.lua index 9fadb977261..79eb31ce0bc 100644 --- a/lua/plugins/which-key.lua +++ b/lua/plugins/which-key.lua @@ -1,6 +1,6 @@ return { - "folke/which-key.nvim", - event = "VeryLazy", + 'folke/which-key.nvim', + event = 'VeryLazy', opts = { -- your configuration comes here -- or leave it empty to use the default settings @@ -8,11 +8,11 @@ return { }, keys = { { - "?", + '?', function() - require("which-key").show({ global = false }) + require('which-key').show { global = false } end, - desc = "Buffer Local Keymaps (which-key)", + desc = 'Buffer Local Keymaps (which-key)', }, }, } diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index d90e5a532c6..80708eb9c12 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -1,11 +1,8 @@ +-- local keymap = vim.api.nvim_set_keymap +local keymap = vim.keymap.set local opts = { noremap = true, silent = true } - local term_opts = { silent = true } --- Shorten function name -local keymap = vim.api.nvim_set_keymap - ---Remap space as leader key keymap('', '', '', opts) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' @@ -25,23 +22,26 @@ keymap('n', '', 'j', opts) keymap('n', '', 'k', opts) keymap('n', '', 'l', opts) -keymap('n', 'e', ':Lex 30', opts) -- hit again to close +keymap('n', 'e', ':Lex 34', opts) -- hit again to close -- Resize with arrows -keymap('n', '', ':resize +2', opts) -keymap('n', '', ':resize -2', opts) -keymap('n', '', ':vertical resize -2', opts) -keymap('n', '', ':vertical resize +2', opts) +keymap('n', '', ':resize +6', opts) +keymap('n', '', ':resize 2', opts) +keymap('n', '', ':vertical resize 2', opts) +keymap('n', '', ':vertical resize +6', opts) -- Navigate buffers -keymap('n', '', ':bnext', opts) -keymap("n", "n", ":bnext", opts) -keymap('n', '', ':bprevious', opts) -keymap("n", "p", ":bprev", opts) +-- keymap('n', '', ':bnext', opts) +vim.keymap.set('n', '', ':bnext', opts) +vim.keymap.set('n', '', ':bprev', opts) + +keymap('n', 'n', ':bnext', opts) +-- keymap('n', '', ':bprevious', opts) +keymap('n', 'p', ':bprev', opts) -- Insert -- -- Press fast to exit -keymap('i', 'jk', '', opts) +-- keymap('i', 'jk', '', opts) -- Jump to beginning of line keymap('n', 'h', '^', opts) @@ -50,49 +50,42 @@ keymap('n', 'h', '^', opts) -- Stay in indent mode keymap('v', '<', '', '>gv', opts) - --- Move text up and down -keymap('v', '', ':m .+1==', opts) -keymap('v', '', ':m .-2==', opts) -- paste over currently selected text without yanking it +-- _ register is black hole. Unrecoverable keymap('v', 'p', '"_dp', opts) keymap('v', 'P', '"_dP', opts) -- Visual Block -- -- Move text up and down +-- keymap('x', 'J', ":move '>+5gv-gv", opts) +-- keymap('x', 'K', ":move '<2gv-gv", opts) +keymap('v', '', ':m .+1==', opts) +keymap('v', '', ':m .-2==', opts) keymap('x', 'J', ":move '>+1gv-gv", opts) keymap('x', 'K', ":move '<-2gv-gv", opts) keymap('x', '', ":move '>+1gv-gv", opts) keymap('x', '', ":move '<-2gv-gv", opts) --- Terminal -- -- Better terminal navigation -keymap('t', '', 'h', term_opts) -keymap('t', '', 'j', term_opts) keymap('t', '', 'k', term_opts) keymap('t', '', 'l', term_opts) - --- keymap("n", "f", "Telescope find_files", opts) -keymap("n", "f", "lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))", opts) -keymap("n", "", "Telescope live_grep", opts) --- -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' -vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) -vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) -vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) -vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) -vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) -vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - -vim.keymap.set('n', '/', function() +keymap('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) +keymap('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) +keymap('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) +keymap('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) +keymap('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) +keymap('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) +keymap('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) +keymap('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) +keymap('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) +keymap('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + +keymap('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, + winblend = 14, previewer = false, }) end, { desc = '[/] Fuzzily search in current buffer' }) @@ -112,24 +105,27 @@ vim.keymap.set('n', 'sn', function() end, { desc = '[S]earch [N]eovim files' }) -- Nvimtree -keymap("n", "e", ":NvimTreeToggle", opts) +keymap('n', 'e', ':NvimTreeToggle', opts) -- keymap("n", "f", ":Format", opts) -keymap("n", "w", ":w", opts) -keymap("n", "q", ":q", opts) -keymap("n", "d", ":bdelete", opts) +keymap('n', 'w', ':w', opts) +keymap('n', 'q', ':q', opts) +keymap('n', 'd', ':bdelete', opts) -keymap("n", "", "zz", opts) -keymap("n", "", "zz", opts) +keymap('n', '', 'zz', opts) +keymap('n', '', 'zz', opts) -- Move line on the screen rather than by line in the file -vim.keymap.set("n", "j", "gj", opts) -vim.keymap.set("n", "k", "gk", opts) +keymap('n', 'j', 'gj', opts) +keymap('n', 'k', 'gk', opts) -- Select all -vim.keymap.set("n", "", "ggVG", opts) +vim.keymap.set('n', '', 'ggvg', opts) + +-- vim.keymap.set('n', 'YY', 'va{Vy', opts) +keymap('n', 'r', ':w:!python3 %', { noremap = true, silent = true }) +-- vim.keymap.set('n', 'x', ':source %', opts) +keymap('n', 'x', ':.lua', opts) +keymap('v', 'x', ':lua', opts) -vim.keymap.set("n", "YY", "va{Vy", opts) -vim.keymap.set("n", "r", ":w:!python3 %", { noremap = true, silent = true }) -vim.keymap.set("n", "x", ":source %", opts) -vim.keymap.set("n", "x", ":.lua", opts) -vim.keymap.set("v", "x", ":lua", opts) +-- undo word by word +vim.keymap.set('i', '', 'u', opts) diff --git a/test.py b/test.py new file mode 100644 index 00000000000..dab30c30ced --- /dev/null +++ b/test.py @@ -0,0 +1,6 @@ +def add(a, b) -> int: + return a + b + + +if __name__ == "__main__": + print(add(2, 8)) diff --git a/tester.py b/tester.py deleted file mode 100644 index aa93b791de6..00000000000 --- a/tester.py +++ /dev/null @@ -1,18 +0,0 @@ -items = [1, 2, 3] - -for i in items: - print(i) - - -def myfunc(x: int) -> str: - "this is a docstring yuhhh" - return f"this is my num {x}" - - -def myfunc2(): - pass - - -print(myfunc(4)) - -print(myfunc(5))