From 780d341cec3f58fc418e2d6c32a8b6b86e1a1294 Mon Sep 17 00:00:00 2001 From: LuKe Tidd Date: Sat, 18 Jun 2022 00:56:41 -0400 Subject: [PATCH] a little cleanup --- after/ftplugin/go.lua | 7 + after/ftplugin/python.lua | 7 + after/ftplugin/sh.lua | 8 ++ init.lua | 2 +- lua/options.lua | 81 +++++++++++ lua/plugins.lua | 65 ++++++--- lua/plugins_old | 285 -------------------------------------- 7 files changed, 148 insertions(+), 307 deletions(-) create mode 100644 after/ftplugin/go.lua create mode 100644 after/ftplugin/python.lua create mode 100644 after/ftplugin/sh.lua delete mode 100644 lua/plugins_old diff --git a/after/ftplugin/go.lua b/after/ftplugin/go.lua new file mode 100644 index 0000000..8c7053d --- /dev/null +++ b/after/ftplugin/go.lua @@ -0,0 +1,7 @@ +local o = vim.o +local bo = vim.bo +bo.expandtab = false +bo.tabstop = 8 +bo.shiftwidth = 8 +bo.autoindent = true +bo.copyindent = true diff --git a/after/ftplugin/python.lua b/after/ftplugin/python.lua new file mode 100644 index 0000000..8c7053d --- /dev/null +++ b/after/ftplugin/python.lua @@ -0,0 +1,7 @@ +local o = vim.o +local bo = vim.bo +bo.expandtab = false +bo.tabstop = 8 +bo.shiftwidth = 8 +bo.autoindent = true +bo.copyindent = true diff --git a/after/ftplugin/sh.lua b/after/ftplugin/sh.lua new file mode 100644 index 0000000..a51ccc6 --- /dev/null +++ b/after/ftplugin/sh.lua @@ -0,0 +1,8 @@ +local o = vim.o +local bo = vim.bo +bo.expandtab = true +bo.tabstop = 2 +bo.shiftwidth = 2 +bo.softtabstop = 2 +bo.autoindent = true +o.colorcolumn = "80" diff --git a/init.lua b/init.lua index e7429dd..f3aa588 100644 --- a/init.lua +++ b/init.lua @@ -5,7 +5,7 @@ require("plugins") -- Vim mappings, see lua/config/which.lua for more mappings -- require("mappings") -- All non plugin related (vim) options --- require("options") +require("options") -- Vim autocommands/autogroups -- require("autocmd") diff --git a/lua/options.lua b/lua/options.lua index 4436d1b..b8bcadf 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -14,3 +14,84 @@ -- -- end, --} +-- + +local o = vim.o +local wo = vim.wo +local bo = vim.bo + +-- global options + -- +- current line on left side +o.relativenumber = true + -- also show current exact line number +o.number = true +o.signcolumn = "number" + -- bright colors +o.bg = "dark" + -- switch between buffers without saving +o.hidden = true + -- look cool +o.listchars = "tab:▶ ,trail:☲,extends:❯,precedes:❮,nbsp:¬,eol:⤦" + -- show hidden chars +o.list = true + -- kill the rat +o.mouse = "" + -- show chars as search is typed +o.incsearch = true + -- all lower searches match all cases, any number of caps forces case sensitive +o.ignorecase = true +o.smartcase = true + -- dont show intro text and do some abbreviations +o.shortmess = "fiIc" +o.syntax = "enable" +-- +-- Set completeopt to have a better completion experience +-- :help completeopt +-- menuone: popup even when there's only one match +-- noinsert: Do not insert text until a selection is made +-- noselect: Do not select, force user to select one from the menu +o.completeopt = "menuone,noinsert,noselect" + + +local map = vim.api.nvim_set_keymap + +options = { silent = true } +map('n', '', ':nohlsearch:echo ""', options) +map('n', '', ":set nolist nonumber norelativenumber signcolumn=no", options) +map('n', '', ":set list number relativenumber signcolumn=number", options) + +-- vim.cmd('colorscheme papaya') +o.termguicolors = true + +-- " use as trigger keys +-- imap (completion_smart_tab) +-- imap (completion_smart_s_tab) + +-- use tab to scroll completion +vim.api.nvim_set_keymap('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) +vim.api.nvim_set_keymap('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) + +-- " Code navigation shortcuts +options = { silent = true } +vim.api.nvim_set_keymap('n', '', ':lua vim.lsp.buf.definition()', options) +vim.api.nvim_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()', options) +vim.api.nvim_set_keymap('n', 'gD', ':lua vim.lsp.buf.implementation()', options) +vim.api.nvim_set_keymap('n', '', ':lua vim.lsp.buf.signature_help()', options) +vim.api.nvim_set_keymap('n', '1gD', ':lua vim.lsp.buf.type_definition()', options) +vim.api.nvim_set_keymap('n', 'gr', ':lua vim.lsp.buf.references()', options) +vim.api.nvim_set_keymap('n', 'g0', ':lua vim.lsp.buf.document_symbol()', options) +vim.api.nvim_set_keymap('n', 'gW', ':lua vim.lsp.buf.workspace_symbol()', options) +vim.api.nvim_set_keymap('n', 'gd', ':lua vim.lsp.buf.declaration()', options) +vim.api.nvim_set_keymap('n', 'ga', ':lua vim.lsp.buf.code_action()', options) +-- " Goto previous/next diagnostic warning/error +vim.api.nvim_set_keymap('n', 'g]', ':lua vim.lsp.diagnostic.goto_next()', options) +vim.api.nvim_set_keymap('n', 'g[', ':lua vim.lsp.diagnostic.goto_prev()', options) + +o.updatetime = 5000 +-- " Show diagnostic popup on cursor hold +vim.api.nvim_command('autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics()') +-- type hints! +-- vim.api.nvim_command([[ +-- autocmd CursorHold,CursorMoved,InsertLeave,BufEnter,BufWinEnter,TabEnter,BufWritePost * lua require'lsp_extensions'.inlay_hints{ prefix = '', highlight = "Comment", enabled = {"TypeHint", "ChainingHint", "ParameterHint"}, prefix = " ⇋ ", } +-- ]]) + diff --git a/lua/plugins.lua b/lua/plugins.lua index 4a0944a..ab60aed 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -40,39 +40,47 @@ packer.startup(function(use) -- actual plugins list use("wbthomason/packer.nvim") + -- telescope: highly extendable fuzzy finder over lists + -- https://github.com/nvim-telescope/telescope.nvim use({ "nvim-telescope/telescope.nvim", requires = { { "nvim-lua/popup.nvim" }, { "nvim-lua/plenary.nvim" } }, config = get_config("telescope"), }) - + -- zoxide helps jump to folders use({ "jvgrootveld/telescope-zoxide" }) + -- An extension for telescope.nvim that allows you to switch between document's headings. use({ "crispgm/telescope-heading.nvim" }) + -- provide its users with the ability of picking symbols and insert them at point use({ "nvim-telescope/telescope-symbols.nvim" }) use({ "nvim-telescope/telescope-file-browser.nvim" }) + -- file browser extension for telescope.nvim. It supports synchronized creation, deletion, renaming, and moving of files and folders powered by telescope.nvim and plenary.nvim. use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }) + -- Integration for packer.nvim with telescope.nvim. use({ "nvim-telescope/telescope-packer.nvim" }) + -- sets vim.ui.select to telescope. That means for example that neovim core stuff can fill the telescope picker use({ "nvim-telescope/telescope-ui-select.nvim" }) - + -- File Explorer use({ "kyazdani42/nvim-tree.lua", config = get_config("nvim-tree") }) - + -- Smoothly navigate between splits and panes + -- https://github.com/numToStr/Navigator.nvim use({ "numToStr/Navigator.nvim", config = get_config("navigator") }) - + -- Neovim statusline use({ "nvim-lualine/lualine.nvim", config = get_config("lualine"), event = "VimEnter", requires = { "kyazdani42/nvim-web-devicons", opt = true }, }) - + -- A high-performance color highlighter for Neovim which has no external dependencies use({ "norcalli/nvim-colorizer.lua", event = "BufReadPre", config = get_config("colorizer"), }) - + -- autopair plugin for Neovim that supports multiple characters use({ "windwp/nvim-autopairs", config = get_config("nvim-autopairs") }) - + -- fast parser for doing lookups per keystroke use({ "nvim-treesitter/nvim-treesitter", config = get_config("treesitter"), @@ -82,7 +90,7 @@ packer.startup(function(use) -- use("nvim-treesitter/nvim-treesitter-textobjects") -- use("RRethy/nvim-treesitter-endwise") - + -- A completion engine plugin for neovim use({ "hrsh7th/nvim-cmp", requires = { @@ -97,7 +105,7 @@ packer.startup(function(use) }, config = get_config("cmp"), }) - + -- community driven repository for all kinds of snippets in all programming languages use({ "rafamadriz/friendly-snippets" }) use({ "L3MON4D3/LuaSnip", @@ -117,6 +125,7 @@ packer.startup(function(use) config = get_config("diffview"), }) + -- some tui? for git in neovim? use({ "TimUntersberger/neogit", requires = { "nvim-lua/plenary.nvim" }, @@ -124,6 +133,7 @@ packer.startup(function(use) config = get_config("neogit"), }) + -- probably does git blame use({ "f-person/git-blame.nvim", config = get_config("git-blame") }) use({ @@ -133,13 +143,13 @@ packer.startup(function(use) config = get_config("gitsigns"), }) - -- use("p00f/nvim-ts-rainbow") - + -- make Neovim's quickfix window better use({ "kevinhwang91/nvim-bqf", requires = { { "junegunn/fzf", module = "nvim-bqf" }, config = get_config("nvim-bqf") }, }) + -- tab labels use({ "akinsho/nvim-bufferline.lua", requires = "kyazdani42/nvim-web-devicons", @@ -147,10 +157,12 @@ packer.startup(function(use) config = get_config("bufferline"), }) + -- delete a buffer without messing up your window layout use("famiu/bufdelete.nvim") use({ "neovim/nvim-lspconfig", config = get_config("lsp") }) + -- adds vscode-like pictograms use({ "onsails/lspkind-nvim", requires = { "famiu/bufdelete.nvim" } }) -- use({ @@ -159,48 +171,63 @@ packer.startup(function(use) -- config = get_config("null-ls"), -- }) + -- A tree like view for symbols use({ "simrat39/symbols-outline.nvim", cmd = { "SymbolsOutline" }, config = get_config("symbols"), }) + -- adds indentation guides to all lines use({ "lukas-reineke/indent-blankline.nvim", event = "BufReadPre", config = [[require("config/indent-blankline")]], }) - use({ - "akinsho/nvim-toggleterm.lua", - keys = { "", "fl", "gt" }, - config = get_config("toggleterm"), - }) + -- use({ + -- "akinsho/nvim-toggleterm.lua", + -- keys = { "", "fl", "gt" }, + -- config = get_config("toggleterm"), + -- }) + -- highlights todos use({ "folke/todo-comments.nvim", requires = "nvim-lua/plenary.nvim", config = get_config("todo"), }) + -- some kinda project management + -- https://github.com/ahmedkhalf/project.nvim use({ "ahmedkhalf/project.nvim", config = get_config("project") }) + -- text highlighting use("ironhouzi/starlite-nvim") + -- popup with possible key bindings of the command you started typing use({ "folke/which-key.nvim", config = get_config("which-key") }) + -- alignment use("junegunn/vim-easy-align") -- no lua alternative, https://github.com/Vonr/align.nvim not working for me + -- + -- literally a grammer checker + -- https://github.com/rhysd/vim-grammarous use({ "rhysd/vim-grammarous", cmd = "GrammarousCheck" }) + -- automatically highlighting other uses of the current word under the cursor + -- https://github.com/RRethy/vim-illuminate use({ "RRethy/vim-illuminate" }) + -- lf is a terminal file manager use({ "ptzz/lf.vim", requires = "voldikss/vim-floaterm", config = get_config("lf"), }) + -- themes if settings.theme == "nightfox" then use({ "EdenEast/nightfox.nvim", config = get_config("nightfox") }) elseif settings.theme == "catppuccino" then @@ -209,6 +236,7 @@ packer.startup(function(use) use({ "catppuccin/nvim", as = "catppuccin", config = get_config("catppuccin") }) end + -- use({ "ThePrimeagen/harpoon", requires = { "nvim-lua/plenary.nvim" }, @@ -264,8 +292,3 @@ packer.startup(function(use) end, }) end) - --- TODO: ???? --- use {"lukas-reineke/headlines.nvim", config = get_config("headlines")} --- https://github.com/glepnir/lspsaga.nvim --- use 'glepnir/lspsaga.nvim' diff --git a/lua/plugins_old b/lua/plugins_old deleted file mode 100644 index bee17da..0000000 --- a/lua/plugins_old +++ /dev/null @@ -1,285 +0,0 @@ ---require "paq" { --- "savq/paq-nvim"; -- this own plugin --- "neovim/nvim-lspconfig"; --- "nvim-lua/plenary.nvim"; --- "nvim-telescope/telescope.nvim"; --- --- --"hrsh7th/nvim-cmp"; --- -- {"lervag/vimtex", opt=true}; -- Use braces when passing options ---} - --- https://github.com/Allaman/nvim/tree/main/lua - -local settings = require("user-conf") -local fn = vim.fn - -local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" - --- -- returns the require for use in `config` parameter of packer's use --- -- expects the name of the config file -local function get_config(name) - return string.format('require("config/%s")', name) -end - --- bootstrap packer if not installed -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({ - "git", - "clone", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) - print("Installing packer...") - vim.api.nvim_command("packadd packer.nvim") -end - --- initialize and configure packer -local packer = require("packer") - -packer.init({ - enable = true, -- enable profiling via :PackerCompile profile=true - threshold = 0, -- the amount in ms that a plugins load time must be over for it to be included in the profile - max_jobs = 20, -- Limit the number of simultaneous jobs. nil means no limit. Set to 20 in order to prevent PackerSync form being "stuck" -> https://github.com/wbthomason/packer.nvim/issues/746 - -- Have packer use a popup window - display = { - open_fn = function() - return require("packer.util").float({ border = "rounded" }) - end, - }, -}) --- -packer.startup(function(use) - -- actual plugins list - use("wbthomason/packer.nvim") - -- use({ "neovim/nvim-lspconfig", config = get_config("lsp") }) - use("neovim/nvim-lspconfig") - -- use({ - -- "nvim-telescope/telescope.nvim", - -- requires = { { "nvim-lua/popup.nvim" }, { "nvim-lua/plenary.nvim" } }, - -- config = get_config("telescope"), - -- }) -end) --- --- --- use({ "jvgrootveld/telescope-zoxide" }) --- use({ "crispgm/telescope-heading.nvim" }) --- use({ "nvim-telescope/telescope-symbols.nvim" }) --- use({ "nvim-telescope/telescope-file-browser.nvim" }) --- use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }) --- use({ "nvim-telescope/telescope-packer.nvim" }) --- use({ "nvim-telescope/telescope-ui-select.nvim" }) --- --- use({ "kyazdani42/nvim-tree.lua", config = get_config("nvim-tree") }) --- --- use({ "numToStr/Navigator.nvim", config = get_config("navigator") }) --- --- use({ --- "nvim-lualine/lualine.nvim", --- config = get_config("lualine"), --- event = "VimEnter", --- requires = { "kyazdani42/nvim-web-devicons", opt = true }, --- }) --- --- use({ --- "norcalli/nvim-colorizer.lua", --- event = "BufReadPre", --- config = get_config("colorizer"), --- }) --- --- use({ "windwp/nvim-autopairs", config = get_config("nvim-autopairs") }) --- --- use({ --- "nvim-treesitter/nvim-treesitter", --- config = get_config("treesitter"), --- run = ":TSUpdate", --- }) --- --- use("nvim-treesitter/nvim-treesitter-textobjects") --- --- use("RRethy/nvim-treesitter-endwise") --- --- use({ --- "hrsh7th/nvim-cmp", --- requires = { --- "hrsh7th/cmp-nvim-lsp", --- "hrsh7th/cmp-buffer", --- "hrsh7th/cmp-path", --- "hrsh7th/cmp-cmdline", --- "f3fora/cmp-spell", --- "hrsh7th/cmp-calc", --- "lukas-reineke/cmp-rg", --- "hrsh7th/cmp-nvim-lsp-signature-help", --- }, --- config = get_config("cmp"), --- }) --- --- use({ "rafamadriz/friendly-snippets" }) --- use({ --- "L3MON4D3/LuaSnip", --- requires = "saadparwaiz1/cmp_luasnip", --- config = get_config("luasnip"), --- }) --- --- -- requirement for Neogit --- use({ --- "sindrets/diffview.nvim", --- cmd = { --- "DiffviewOpen", --- "DiffviewClose", --- "DiffviewToggleFiles", --- "DiffviewFocusFiles", --- }, --- config = get_config("diffview"), --- }) --- --- use({ --- "TimUntersberger/neogit", --- requires = { "nvim-lua/plenary.nvim" }, --- cmd = "Neogit", --- config = get_config("neogit"), --- }) --- --- use({ "f-person/git-blame.nvim", config = get_config("git-blame") }) --- --- use({ --- "lewis6991/gitsigns.nvim", --- requires = { "nvim-lua/plenary.nvim" }, --- event = "BufReadPre", --- config = get_config("gitsigns"), --- }) --- --- use("p00f/nvim-ts-rainbow") --- --- use({ --- "kevinhwang91/nvim-bqf", --- requires = { { "junegunn/fzf", module = "nvim-bqf" }, config = get_config("nvim-bqf") }, --- }) --- --- use({ --- "akinsho/nvim-bufferline.lua", --- requires = "kyazdani42/nvim-web-devicons", --- event = "BufReadPre", --- config = get_config("bufferline"), --- }) --- --- use("famiu/bufdelete.nvim") --- --- --- use({ "onsails/lspkind-nvim", requires = { "famiu/bufdelete.nvim" } }) --- --- use({ --- "jose-elias-alvarez/null-ls.nvim", --- requires = { { "nvim-lua/plenary.nvim" } }, --- config = get_config("null-ls"), --- }) --- --- use({ --- "simrat39/symbols-outline.nvim", --- cmd = { "SymbolsOutline" }, --- config = get_config("symbols"), --- }) --- --- use({ --- "lukas-reineke/indent-blankline.nvim", --- event = "BufReadPre", --- config = [[require("config/indent-blankline")]], --- }) --- --- use({ --- "akinsho/nvim-toggleterm.lua", --- keys = { "", "fl", "gt" }, --- config = get_config("toggleterm"), --- }) --- --- use({ --- "folke/todo-comments.nvim", --- requires = "nvim-lua/plenary.nvim", --- config = get_config("todo"), --- }) --- --- use({ "ahmedkhalf/project.nvim", config = get_config("project") }) --- --- use("ironhouzi/starlite-nvim") --- --- use({ "folke/which-key.nvim", config = get_config("which-key") }) --- --- use("junegunn/vim-easy-align") -- no lua alternative, https://github.com/Vonr/align.nvim not working for me --- --- use({ "rhysd/vim-grammarous", cmd = "GrammarousCheck" }) --- --- use({ "RRethy/vim-illuminate" }) --- --- use({ --- "ptzz/lf.vim", --- requires = "voldikss/vim-floaterm", --- config = get_config("lf"), --- }) --- --- if settings.theme == "nightfox" then --- use({ "EdenEast/nightfox.nvim", config = get_config("nightfox") }) --- elseif settings.theme == "catppuccino" then --- use({ "catppuccin/nvim", as = "catppuccin", config = get_config("catppuccin") }) --- else --- use({ "catppuccin/nvim", as = "catppuccin", config = get_config("catppuccin") }) --- end --- -- --- -- use({ --- -- "ThePrimeagen/harpoon", --- -- requires = { "nvim-lua/plenary.nvim" }, --- -- config = get_config("harpoon"), --- -- }) --- --- use({ "folke/zen-mode.nvim", cmd = "ZenMode", config = get_config("zen-mode") }) --- --- use({ "folke/twilight.nvim", config = get_config("twilight") }) --- --- use({ "tweekmonster/startuptime.vim" }) --- --- use({ "ggandor/lightspeed.nvim" }) --- --- use({ "ray-x/go.nvim", config = get_config("go"), ft = { "go" } }) --- --- use({ "LudoPinelli/comment-box.nvim", config = get_config("comment-box") }) --- --- use({ "rcarriga/nvim-notify", config = get_config("notify") }) --- --- use({ "echasnovski/mini.nvim", branch = "stable", config = get_config("mini") }) --- --- use({ --- "https://gitlab.com/yorickpeterse/nvim-window.git", --- config = get_config("nvim-window"), --- }) --- --- use({ --- "waylonwalker/Telegraph.nvim", --- config = function() --- require("telegraph").setup({}) --- end, --- }) --- --- use({ "rhysd/conflict-marker.vim" }) --- --- use({ "edluffy/specs.nvim", config = get_config("specs") }) --- --- use({ "mfussenegger/nvim-ts-hint-textobject" }) --- --- use({ --- "goolord/alpha-nvim", --- requires = { "kyazdani42/nvim-web-devicons" }, --- config = get_config("alpha-nvim"), --- }) --- --- use({ "SmiteshP/nvim-navic" }) --- --- use({ --- "j-hui/fidget.nvim", --- config = function() --- require("fidget").setup({}) --- end, --- }) --- end) --- --- -- TODO: ???? --- -- use {"lukas-reineke/headlines.nvim", config = get_config("headlines")} --- -- https://github.com/glepnir/lspsaga.nvim --- -- use 'glepnir/lspsaga.nvim'