From e1375562508a57ed88ce76c0d9273a81c03a4a6a Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Sat, 18 Mar 2023 22:47:34 -0600 Subject: [PATCH 01/15] Fork and customize config --- after/plugin/defaults.lua | 70 ++++++++++++++++++++++++++++ init.lua | 53 +++++++++++---------- lua/custom/plugins/init.lua | 31 ++++++++++-- lua/custom/plugins/nvim-base16.lua | 10 ++++ lua/custom/plugins/reveal.lua | 20 ++++++++ lua/kickstart/plugins/autoformat.lua | 6 +-- 6 files changed, 155 insertions(+), 35 deletions(-) create mode 100644 after/plugin/defaults.lua create mode 100644 lua/custom/plugins/nvim-base16.lua create mode 100644 lua/custom/plugins/reveal.lua diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua new file mode 100644 index 00000000..ef1ce4e8 --- /dev/null +++ b/after/plugin/defaults.lua @@ -0,0 +1,70 @@ +-- prev/next tab +vim.keymap.set('n', 'H', 'gT') +vim.keymap.set('n', 'L', 'gt') + +-- line bubbling + +-- nnoremap :m .+1== +-- nnoremap :m .-2== +vim.keymap.set('n', '', ':m .+1==', { noremap = true }) +vim.keymap.set('n', '', ':m .-2==', { noremap = true }) -- conflicts with "signature help" from LSP + +-- inoremap :m .+1==gi +-- inoremap :m .-2==gi +vim.keymap.set('i', '', ':m .+1==gi', { noremap = true }) +vim.keymap.set('i', '', ':m .-2==gi', { noremap = true }) + +-- vnoremap :m '>+1gv=gv +-- vnoremap :m '<-2gv=gv +vim.keymap.set('v', '', ":m '<-2gv=gv", { noremap = true }) +vim.keymap.set('v', '', ":m '>+1gv=gv", { noremap = true }) + +vim.o.inccommand = "nosplit" + +-- vim.cmd([[ +-- autocmd FileType dirvish nmap - +-- ]]) + +vim.diagnostic.config({ + virtual_text = { + -- source = "always", -- Or "if_many" + prefix = '●', -- Could be '■', '▎', 'x' + }, + severity_sort = true, + float = { + source = "always", -- Or "if_many" + }, +}) +-- vim.o.updatetime = 250 +-- vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]] + + +local signs = { Error = "✗", Warn = "⚠", Hint = "➤", Info = "i" } +for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) +end + + +-- function PrintDiagnostics(opts, bufnr, line_nr, client_id) +-- bufnr = bufnr or 0 +-- line_nr = line_nr or (vim.api.nvim_win_get_cursor(0)[1] - 1) +-- opts = opts or { ['lnum'] = line_nr } +-- +-- local line_diagnostics = vim.diagnostic.get(bufnr, opts) +-- if vim.tbl_isempty(line_diagnostics) then return end +-- +-- local diagnostic_message = "" +-- for i, diagnostic in ipairs(line_diagnostics) do +-- diagnostic_message = diagnostic_message .. string.format("%d: %s", i, diagnostic.message or "") +-- print(diagnostic_message) +-- if i ~= #line_diagnostics then +-- diagnostic_message = diagnostic_message .. "\n" +-- end +-- end +-- vim.api.nvim_echo({ { diagnostic_message, "Normal" } }, false, {}) +-- end +-- +-- vim.cmd [[ autocmd! CursorHold * lua PrintDiagnostics() ]] + +-- vim: ts=2 sts=2 sw=2 et diff --git a/init.lua b/init.lua index 72890326..6263a948 100644 --- a/init.lua +++ b/init.lua @@ -35,7 +35,6 @@ I hope you enjoy your Neovim journey, 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 required (otherwise wrong leader will be used) @@ -75,7 +74,8 @@ require('lazy').setup({ -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. - { -- LSP Configuration & Plugins + { + -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim @@ -91,14 +91,16 @@ require('lazy').setup({ }, }, - { -- Autocompletion + { + -- Autocompletion 'hrsh7th/nvim-cmp', dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - { -- Adds git releated signs to the gutter, as well as utilities for managing changes + { 'folke/which-key.nvim', opts = {} }, + { + -- Adds git releated signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', opts = { -- See `:help gitsigns.txt` @@ -112,28 +114,22 @@ require('lazy').setup({ }, }, - { -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'onedark' - end, - }, - - { -- Set lualine as statusline + { + -- Set lualine as statusline 'nvim-lualine/lualine.nvim', -- See `:help lualine.txt` opts = { options = { icons_enabled = false, - theme = 'onedark', + theme = 'base16', component_separators = '|', section_separators = '', }, }, }, - { -- Add indentation guides even on blank lines + { + -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` @@ -144,7 +140,7 @@ require('lazy').setup({ }, -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, @@ -162,7 +158,8 @@ require('lazy').setup({ end, }, - { -- Highlight, edit, and navigate code + { + -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', @@ -175,7 +172,7 @@ require('lazy').setup({ -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', + require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` @@ -291,7 +288,7 @@ require('nvim-treesitter.configs').setup { ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'help', 'vim' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, + auto_install = true, highlight = { enable = true }, indent = { enable = true, disable = { 'python' } }, @@ -385,7 +382,7 @@ local on_attach = function(_, bufnr) -- See `:help K` for why this keymap nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + -- nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') -- Lesser used LSP functionality nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') @@ -407,12 +404,14 @@ end -- Add any additional override configuration in the following tables. They will be passed to -- the `settings` field of the server config. You must look up that documentation yourself. local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- tsserver = {}, - + clangd = {}, + cssls = {}, + eslint = {}, + gopls = {}, + pyright = {}, + rust_analyzer = {}, + stylelint_lsp = {}, + tsserver = {}, lua_ls = { Lua = { workspace = { checkThirdParty = false }, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..98029f39 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -1,5 +1,26 @@ --- 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 {} +return { + { "github/copilot.vim", }, + { "myusuf3/numbers.vim", }, + { "tpope/vim-eunuch", }, + { "tpope/vim-repeat", }, + { "tpope/vim-surround" }, + + { + "nvim-tree/nvim-web-devicons", + opts = {} + }, + + { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup {} + end, + }, + + { + "kristijanhusak/vim-dirvish-git", + dependencies = { + "justinmk/vim-dirvish", + }, + }, +} diff --git a/lua/custom/plugins/nvim-base16.lua b/lua/custom/plugins/nvim-base16.lua new file mode 100644 index 00000000..6e8be747 --- /dev/null +++ b/lua/custom/plugins/nvim-base16.lua @@ -0,0 +1,10 @@ +return { + 'norcalli/nvim-base16.lua', + lazy = false, + priority = 1000, + config = function() + local base16 = require 'base16' + + base16(base16.themes[vim.env.BASE16_THEME or "3024"], true) + end, +} diff --git a/lua/custom/plugins/reveal.lua b/lua/custom/plugins/reveal.lua new file mode 100644 index 00000000..95a67294 --- /dev/null +++ b/lua/custom/plugins/reveal.lua @@ -0,0 +1,20 @@ +-- RevealInFinder +-- --------------------------------------------------------------------------- + +-- set this to leader-e +vim.cmd([[ +function! s:RevealInFinder() + if filereadable(expand("%")) + let l:command = "open -R %" + elseif getftype(expand("%:p:h")) == "dir" + let l:command = "open %:p:h" + else + let l:command = "open ." + endif + execute ":silent! !" . l:command + redraw! +endfunction +command! Reveal call RevealInFinder() +]]) + +return {} diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua index bc56b15b..1bbd622e 100644 --- a/lua/kickstart/plugins/autoformat.lua +++ b/lua/kickstart/plugins/autoformat.lua @@ -46,9 +46,9 @@ return { -- Tsserver usually works poorly. Sorry you work with bad languages -- You can remove this line if you know what you're doing :) - if client.name == 'tsserver' then - return - end + -- if client.name == 'tsserver' then + -- return + -- end -- Create an autocmd that will run *before* we save the buffer. -- Run the formatting command for the LSP that has just attached. From 724fb28491b2d93bcd8777ba9c798a3f1e0c92c2 Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Sun, 19 Mar 2023 21:25:50 -0600 Subject: [PATCH 02/15] remove stylelint --- after/plugin/defaults.lua | 29 ----------------------------- init.lua | 10 +++++----- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index ef1ce4e8..e64c56f1 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -21,10 +21,6 @@ vim.keymap.set('v', '', ":m '>+1gv=gv", { noremap = true }) vim.o.inccommand = "nosplit" --- vim.cmd([[ --- autocmd FileType dirvish nmap - --- ]]) - vim.diagnostic.config({ virtual_text = { -- source = "always", -- Or "if_many" @@ -35,9 +31,6 @@ vim.diagnostic.config({ source = "always", -- Or "if_many" }, }) --- vim.o.updatetime = 250 --- vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]] - local signs = { Error = "✗", Warn = "⚠", Hint = "➤", Info = "i" } for type, icon in pairs(signs) do @@ -45,26 +38,4 @@ for type, icon in pairs(signs) do vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) end - --- function PrintDiagnostics(opts, bufnr, line_nr, client_id) --- bufnr = bufnr or 0 --- line_nr = line_nr or (vim.api.nvim_win_get_cursor(0)[1] - 1) --- opts = opts or { ['lnum'] = line_nr } --- --- local line_diagnostics = vim.diagnostic.get(bufnr, opts) --- if vim.tbl_isempty(line_diagnostics) then return end --- --- local diagnostic_message = "" --- for i, diagnostic in ipairs(line_diagnostics) do --- diagnostic_message = diagnostic_message .. string.format("%d: %s", i, diagnostic.message or "") --- print(diagnostic_message) --- if i ~= #line_diagnostics then --- diagnostic_message = diagnostic_message .. "\n" --- end --- end --- vim.api.nvim_echo({ { diagnostic_message, "Normal" } }, false, {}) --- end --- --- vim.cmd [[ autocmd! CursorHold * lua PrintDiagnostics() ]] - -- vim: ts=2 sts=2 sw=2 et diff --git a/init.lua b/init.lua index 6263a948..02934542 100644 --- a/init.lua +++ b/init.lua @@ -117,13 +117,12 @@ require('lazy').setup({ { -- Set lualine as statusline 'nvim-lualine/lualine.nvim', + dependencies = { 'RRethy/nvim-base16' }, -- See `:help lualine.txt` opts = { + theme = 'base16', options = { - icons_enabled = false, - theme = 'base16', - component_separators = '|', - section_separators = '', + icons_enabled = true, }, }, }, @@ -403,6 +402,8 @@ end -- -- Add any additional override configuration in the following tables. They will be passed to -- the `settings` field of the server config. You must look up that documentation yourself. +-- +-- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md local servers = { clangd = {}, cssls = {}, @@ -410,7 +411,6 @@ local servers = { gopls = {}, pyright = {}, rust_analyzer = {}, - stylelint_lsp = {}, tsserver = {}, lua_ls = { Lua = { From 97708a370f5543c52e4f42bb724e78d0dff3cf9a Mon Sep 17 00:00:00 2001 From: ggdawson <37080130+ggdawson@users.noreply.github.com> Date: Mon, 20 Mar 2023 13:15:46 -0400 Subject: [PATCH 03/15] add null_ls for formatting --- after/plugin/defaults.lua | 10 ++++++++++ lua/custom/plugins/init.lua | 8 +++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index e64c56f1..c1eecf11 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -38,4 +38,14 @@ for type, icon in pairs(signs) do vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) end +-- null-ls + +local null_ls = require("null-ls") + +null_ls.setup({ + sources = { + null_ls.builtins.formatting.prettierd, + }, +}) + -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 98029f39..02ae290b 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -19,8 +19,10 @@ return { { "kristijanhusak/vim-dirvish-git", - dependencies = { - "justinmk/vim-dirvish", - }, + dependencies = { "justinmk/vim-dirvish", }, }, + { + "jose-elias-alvarez/null-ls.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + } } From 8cac12d06d03759a64f14ef58a39f9876f227681 Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Tue, 21 Mar 2023 08:39:13 -0600 Subject: [PATCH 04/15] fix: add more vim.opt settings --- after/plugin/defaults.lua | 17 +++++++++++++++++ lua/kickstart/plugins/autoformat.lua | 6 +++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index c1eecf11..1dfc08d2 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -1,3 +1,20 @@ +local set = vim.opt + +set.colorcolumn = "80,120" +set.cursorline = true +set.expandtab = true +set.list = true +set.swapfile = false +set.writebackup = false +set.wrap = false +-- vim.o.sessionoptions = "resize,winpos,winsize,buffers,tabpages,folds,curdir,help" +set.shiftwidth = 2 +-- vim.o.showmode = true +set.splitbelow = true +set.splitright = true +set.tabstop = 2 +set.textwidth = 80 + -- prev/next tab vim.keymap.set('n', 'H', 'gT') vim.keymap.set('n', 'L', 'gt') diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua index 1bbd622e..bc56b15b 100644 --- a/lua/kickstart/plugins/autoformat.lua +++ b/lua/kickstart/plugins/autoformat.lua @@ -46,9 +46,9 @@ return { -- Tsserver usually works poorly. Sorry you work with bad languages -- You can remove this line if you know what you're doing :) - -- if client.name == 'tsserver' then - -- return - -- end + if client.name == 'tsserver' then + return + end -- Create an autocmd that will run *before* we save the buffer. -- Run the formatting command for the LSP that has just attached. From a5345d82c0d133564ba82d97ae51438cb5ccd78e Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Mon, 27 Mar 2023 13:45:55 -0600 Subject: [PATCH 05/15] fix: add desc to keymaps --- after/plugin/defaults.lua | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index 1dfc08d2..6cf72926 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -16,25 +16,25 @@ set.tabstop = 2 set.textwidth = 80 -- prev/next tab -vim.keymap.set('n', 'H', 'gT') -vim.keymap.set('n', 'L', 'gt') +vim.keymap.set('n', 'H', 'gT', { desc = 'Tab Left' }) +vim.keymap.set('n', 'L', 'gt', { desc = 'Tab Right' }) -- line bubbling -- nnoremap :m .+1== -- nnoremap :m .-2== -vim.keymap.set('n', '', ':m .+1==', { noremap = true }) -vim.keymap.set('n', '', ':m .-2==', { noremap = true }) -- conflicts with "signature help" from LSP +vim.keymap.set('n', '', ':m .+1==', { noremap = true, desc = 'Bubble Down' }) +vim.keymap.set('n', '', ':m .-2==', { noremap = true, desc = 'Bubble Up' }) -- conflicts with "signature help" from LSP -- inoremap :m .+1==gi -- inoremap :m .-2==gi -vim.keymap.set('i', '', ':m .+1==gi', { noremap = true }) -vim.keymap.set('i', '', ':m .-2==gi', { noremap = true }) +vim.keymap.set('i', '', ':m .+1==gi', { noremap = true, desc = 'Bubble Down' }) +vim.keymap.set('i', '', ':m .-2==gi', { noremap = true, desc = 'Bubble Up' }) -- vnoremap :m '>+1gv=gv -- vnoremap :m '<-2gv=gv -vim.keymap.set('v', '', ":m '<-2gv=gv", { noremap = true }) -vim.keymap.set('v', '', ":m '>+1gv=gv", { noremap = true }) +vim.keymap.set('v', '', ":m '<-2gv=gv", { noremap = true, desc = 'Bubble Down' }) +vim.keymap.set('v', '', ":m '>+1gv=gv", { noremap = true, desc = 'Bubble Up' }) vim.o.inccommand = "nosplit" @@ -65,4 +65,12 @@ null_ls.setup({ }, }) +-- nvim-autopairs + nvim-cmp +local cmp_autopairs = require('nvim-autopairs.completion.cmp') +local cmp = require('cmp') +cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() +) + -- vim: ts=2 sts=2 sw=2 et From 8cdc7e23730a597576ceb5ce481466cf2795f24f Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Mon, 3 Apr 2023 08:53:04 -0600 Subject: [PATCH 06/15] fix: improve diagnostics --- after/plugin/defaults.lua | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index 6cf72926..60b41a22 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -39,13 +39,29 @@ vim.keymap.set('v', '', ":m '>+1gv=gv", { noremap = true, desc = 'Bubbl vim.o.inccommand = "nosplit" vim.diagnostic.config({ - virtual_text = { - -- source = "always", -- Or "if_many" - prefix = '●', -- Could be '■', '▎', 'x' - }, severity_sort = true, + virtual_text = { + source = false, + prefix = '●', + format = function() + return "" + end, + }, float = { - source = "always", -- Or "if_many" + source = "always", + -- close_events = { 'BufLeave', 'CursorMoved', 'InsertEnter', 'FocusLost' }, + format = function(diagnostic) + if diagnostic.source == 'eslint' then + return string.format( + '%s [%s]', + diagnostic.message, + -- shows the name of the rule + diagnostic.user_data.lsp.code + ) + end + + return string.format('%s [%s]', diagnostic.message, diagnostic.source) + end, }, }) @@ -56,6 +72,8 @@ for type, icon in pairs(signs) do end -- null-ls +-- @see: https://github.com/jay-babu/mason-null-ls.nvim +-- might want to just use mason-null-ls. not yet sure what the advantage is. local null_ls = require("null-ls") From 6d29e4da7dce97f4b4b1d3149c63aeca6f572216 Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Wed, 5 Apr 2023 20:50:46 -0600 Subject: [PATCH 07/15] add hop and neogen --- after/plugin/defaults.lua | 36 +++++++++++++++++++++--------------- lua/custom/plugins/init.lua | 16 ++++++++++++++++ 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index 60b41a22..8d1a867b 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -7,9 +7,7 @@ set.list = true set.swapfile = false set.writebackup = false set.wrap = false --- vim.o.sessionoptions = "resize,winpos,winsize,buffers,tabpages,folds,curdir,help" set.shiftwidth = 2 --- vim.o.showmode = true set.splitbelow = true set.splitright = true set.tabstop = 2 @@ -20,19 +18,10 @@ vim.keymap.set('n', 'H', 'gT', { desc = 'Tab Left' }) vim.keymap.set('n', 'L', 'gt', { desc = 'Tab Right' }) -- line bubbling - --- nnoremap :m .+1== --- nnoremap :m .-2== vim.keymap.set('n', '', ':m .+1==', { noremap = true, desc = 'Bubble Down' }) vim.keymap.set('n', '', ':m .-2==', { noremap = true, desc = 'Bubble Up' }) -- conflicts with "signature help" from LSP - --- inoremap :m .+1==gi --- inoremap :m .-2==gi vim.keymap.set('i', '', ':m .+1==gi', { noremap = true, desc = 'Bubble Down' }) vim.keymap.set('i', '', ':m .-2==gi', { noremap = true, desc = 'Bubble Up' }) - --- vnoremap :m '>+1gv=gv --- vnoremap :m '<-2gv=gv vim.keymap.set('v', '', ":m '<-2gv=gv", { noremap = true, desc = 'Bubble Down' }) vim.keymap.set('v', '', ":m '>+1gv=gv", { noremap = true, desc = 'Bubble Up' }) @@ -49,13 +38,11 @@ vim.diagnostic.config({ }, float = { source = "always", - -- close_events = { 'BufLeave', 'CursorMoved', 'InsertEnter', 'FocusLost' }, format = function(diagnostic) if diagnostic.source == 'eslint' then return string.format( '%s [%s]', diagnostic.message, - -- shows the name of the rule diagnostic.user_data.lsp.code ) end @@ -74,9 +61,7 @@ end -- null-ls -- @see: https://github.com/jay-babu/mason-null-ls.nvim -- might want to just use mason-null-ls. not yet sure what the advantage is. - local null_ls = require("null-ls") - null_ls.setup({ sources = { null_ls.builtins.formatting.prettierd, @@ -91,4 +76,25 @@ cmp.event:on( cmp_autopairs.on_confirm_done() ) +-- neogen +vim.keymap.set('n', 'nf', ":Neogen func", { noremap = true, desc = '[D]ocument [F]unction' }) + +-- hop +local hop = require('hop') +local directions = require('hop.hint').HintDirection + +vim.keymap.set( + '', + 'h', + function() hop.hint_char1({ direction = directions.AFTER_CURSOR }) end, + { remap = true } +) + +vim.keymap.set( + '', + 'H', + function() hop.hint_char1({ direction = directions.BEFORE_CURSOR }) end, + { remap = true } +) + -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 02ae290b..94f679a2 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -4,14 +4,29 @@ return { { "tpope/vim-eunuch", }, { "tpope/vim-repeat", }, { "tpope/vim-surround" }, + { "tribela/vim-transparent" }, { "nvim-tree/nvim-web-devicons", opts = {} }, + { + "danymat/neogen", + dependencies = "nvim-treesitter/nvim-treesitter", + config = true, + }, + { + 'phaazon/hop.nvim', + branch = 'v2', + config = function() + require 'hop'.setup {} + end + }, + { "windwp/nvim-autopairs", + lazy = true, config = function() require("nvim-autopairs").setup {} end, @@ -23,6 +38,7 @@ return { }, { "jose-elias-alvarez/null-ls.nvim", + lazy = true, dependencies = { "nvim-lua/plenary.nvim" }, } } From e22a0b7248e15141155ade8b9f7f3eb723fccf78 Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Wed, 5 Apr 2023 21:17:35 -0600 Subject: [PATCH 08/15] revise HopChar1 keybind --- after/plugin/defaults.lua | 8 ++++---- lua/custom/plugins/init.lua | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index 8d1a867b..e4277f8f 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -85,16 +85,16 @@ local directions = require('hop.hint').HintDirection vim.keymap.set( '', - 'h', + 'h', function() hop.hint_char1({ direction = directions.AFTER_CURSOR }) end, - { remap = true } + { remap = true, desc = '[H]opChar1 forwards' } ) vim.keymap.set( '', - 'H', + 'H', function() hop.hint_char1({ direction = directions.BEFORE_CURSOR }) end, - { remap = true } + { remap = true, desc = '[H]opChar1 backwards' } ) -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 94f679a2..55a11dd2 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -36,6 +36,7 @@ return { "kristijanhusak/vim-dirvish-git", dependencies = { "justinmk/vim-dirvish", }, }, + { "jose-elias-alvarez/null-ls.nvim", lazy = true, From 4baccf1f8bfe302d113975183112bebc1d8f40ff Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Thu, 6 Apr 2023 21:00:35 -0600 Subject: [PATCH 09/15] replace hop with leap --- after/plugin/defaults.lua | 39 ---------------------------- init.lua | 2 +- lua/custom/plugins/init.lua | 51 +++++++++++++++++++++++++++++++++++-- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index e4277f8f..3617dbbd 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -58,43 +58,4 @@ for type, icon in pairs(signs) do vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) end --- null-ls --- @see: https://github.com/jay-babu/mason-null-ls.nvim --- might want to just use mason-null-ls. not yet sure what the advantage is. -local null_ls = require("null-ls") -null_ls.setup({ - sources = { - null_ls.builtins.formatting.prettierd, - }, -}) - --- nvim-autopairs + nvim-cmp -local cmp_autopairs = require('nvim-autopairs.completion.cmp') -local cmp = require('cmp') -cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done() -) - --- neogen -vim.keymap.set('n', 'nf', ":Neogen func", { noremap = true, desc = '[D]ocument [F]unction' }) - --- hop -local hop = require('hop') -local directions = require('hop.hint').HintDirection - -vim.keymap.set( - '', - 'h', - function() hop.hint_char1({ direction = directions.AFTER_CURSOR }) end, - { remap = true, desc = '[H]opChar1 forwards' } -) - -vim.keymap.set( - '', - 'H', - function() hop.hint_char1({ direction = directions.BEFORE_CURSOR }) end, - { remap = true, desc = '[H]opChar1 backwards' } -) - -- vim: ts=2 sts=2 sw=2 et diff --git a/init.lua b/init.lua index 02934542..da018a0c 100644 --- a/init.lua +++ b/init.lua @@ -171,7 +171,7 @@ require('lazy').setup({ -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. - require 'kickstart.plugins.autoformat', + -- require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 55a11dd2..5fab7e7a 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -14,13 +14,43 @@ return { { "danymat/neogen", dependencies = "nvim-treesitter/nvim-treesitter", - config = true, + config = function() + require('neogen').setup {} + vim.keymap.set('n', 'nf', ":Neogen func", { noremap = true, desc = '[D]ocument [F]unction' }) + end, }, + + { + 'ggandor/leap.nvim', + dependencies = { "tpope/vim-repeat" }, + config = function() + require('leap').add_default_mappings() + end + }, + { 'phaazon/hop.nvim', + cond = false, branch = 'v2', config = function() - require 'hop'.setup {} + local hop = require('hop') + local directions = require('hop.hint').HintDirection + + hop.setup {} + + vim.keymap.set( + '', + 'h', + function() hop.hint_char1({ direction = directions.AFTER_CURSOR }) end, + { remap = true, desc = '[H]opChar1 forwards' } + ) + + vim.keymap.set( + '', + 'H', + function() hop.hint_char1({ direction = directions.BEFORE_CURSOR }) end, + { remap = true, desc = '[H]opChar1 backwards' } + ) end }, @@ -29,6 +59,13 @@ return { lazy = true, config = function() require("nvim-autopairs").setup {} + + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) end, }, @@ -41,5 +78,15 @@ return { "jose-elias-alvarez/null-ls.nvim", lazy = true, dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + -- @see: https://github.com/jay-babu/mason-null-ls.nvim + -- might want to just use mason-null-ls. not yet sure what the advantage is. + local null_ls = require("null-ls") + null_ls.setup({ + sources = { + null_ls.builtins.formatting.prettierd, + }, + }) + end } } From 490c1cd33158bcccd65ad6fb4fde1b8bbf5c5b3a Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Thu, 6 Apr 2023 21:25:07 -0600 Subject: [PATCH 10/15] kludge "Reveal" --- lua/custom/plugins/init.lua | 3 ++- lua/custom/plugins/reveal.lua | 31 +++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 5fab7e7a..10e10a9a 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -8,7 +8,7 @@ return { { "nvim-tree/nvim-web-devicons", - opts = {} + lazy = true }, { @@ -84,6 +84,7 @@ return { local null_ls = require("null-ls") null_ls.setup({ sources = { + null_ls.builtins.formatting.lua_format, null_ls.builtins.formatting.prettierd, }, }) diff --git a/lua/custom/plugins/reveal.lua b/lua/custom/plugins/reveal.lua index 95a67294..b50cb8dc 100644 --- a/lua/custom/plugins/reveal.lua +++ b/lua/custom/plugins/reveal.lua @@ -1,20 +1,23 @@ -- RevealInFinder -- --------------------------------------------------------------------------- --- set this to leader-e vim.cmd([[ -function! s:RevealInFinder() - if filereadable(expand("%")) - let l:command = "open -R %" - elseif getftype(expand("%:p:h")) == "dir" - let l:command = "open %:p:h" - else - let l:command = "open ." - endif - execute ":silent! !" . l:command - redraw! -endfunction -command! Reveal call RevealInFinder() + function! s:RevealInFinder() + if filereadable(expand("%")) + let l:command = "xdg-open -R %" + elseif getftype(expand("%:p:h")) == "dir" + let l:command = "xdg-open %:p:h" + else + let l:command = "xdg-open ." + endif + execute ":silent! !" . l:command + redraw! + endfunction + + command! Reveal call RevealInFinder() ]]) -return {} +vim.keymap.set('n', 'R', ":Reveal", { noremap = true, desc = '[R]eveal with xdg-open' }) + +return { +} From a5d2cf826ce924939ceae06483cf3faaea3c6fa3 Mon Sep 17 00:00:00 2001 From: ggdawson <37080130+ggdawson@users.noreply.github.com> Date: Thu, 13 Apr 2023 19:41:39 -0400 Subject: [PATCH 11/15] fix: Add Reveal back in --- after/plugin/defaults.lua | 6 +++++- init.lua | 5 ++++- lua/custom/plugins/init.lua | 35 ++++++++++++++++++++++++++++++++++- lua/custom/plugins/reveal.lua | 30 ++++++++++++++---------------- 4 files changed, 57 insertions(+), 19 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index 3617dbbd..2ecd1d89 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -13,6 +13,8 @@ set.splitright = true set.tabstop = 2 set.textwidth = 80 +vim.o.inccommand = "nosplit" + -- prev/next tab vim.keymap.set('n', 'H', 'gT', { desc = 'Tab Left' }) vim.keymap.set('n', 'L', 'gt', { desc = 'Tab Right' }) @@ -25,7 +27,9 @@ vim.keymap.set('i', '', ':m .-2==gi', { noremap = true, desc = 'Bu vim.keymap.set('v', '', ":m '<-2gv=gv", { noremap = true, desc = 'Bubble Down' }) vim.keymap.set('v', '', ":m '>+1gv=gv", { noremap = true, desc = 'Bubble Up' }) -vim.o.inccommand = "nosplit" +-- additional telescope triggers +vim.keymap.set('n', '', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', '', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.diagnostic.config({ severity_sort = true, diff --git a/init.lua b/init.lua index da018a0c..a5641305 100644 --- a/init.lua +++ b/init.lua @@ -171,7 +171,7 @@ require('lazy').setup({ -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', + require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` @@ -249,12 +249,15 @@ vim.api.nvim_create_autocmd('TextYankPost', { -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` +local actions = require "telescope.actions" require('telescope').setup { defaults = { mappings = { i = { [''] = false, [''] = false, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, }, }, }, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 10e10a9a..c4ffb2cb 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -74,9 +74,36 @@ return { dependencies = { "justinmk/vim-dirvish", }, }, + { + "folke/trouble.nvim", + cond = false, + requires = "nvim-tree/nvim-web-devicons", + config = function() + require("trouble").setup {} + vim.keymap.set("n", "xx", "TroubleToggle", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "xw", "TroubleToggle workspace_diagnostics", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "xl", "TroubleToggle loclist", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "xq", "TroubleToggle quickfix", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "gR", "TroubleToggle lsp_references", + { silent = true, noremap = true } + ) + end + }, + { "jose-elias-alvarez/null-ls.nvim", - lazy = true, + -- cond = false, dependencies = { "nvim-lua/plenary.nvim" }, config = function() -- @see: https://github.com/jay-babu/mason-null-ls.nvim @@ -84,7 +111,13 @@ return { local null_ls = require("null-ls") null_ls.setup({ sources = { + null_ls.builtins.code_actions.eslint_d, + null_ls.builtins.diagnostics.codespell, + -- null_ls.builtins.diagnostics.cspell, + -- null_ls.builtins.diagnostics.editorconfig_checker, + null_ls.builtins.diagnostics.eslint_d, null_ls.builtins.formatting.lua_format, + -- null_ls.builtins.formatting.prettier_eslint, null_ls.builtins.formatting.prettierd, }, }) diff --git a/lua/custom/plugins/reveal.lua b/lua/custom/plugins/reveal.lua index b50cb8dc..2edcd1e8 100644 --- a/lua/custom/plugins/reveal.lua +++ b/lua/custom/plugins/reveal.lua @@ -1,21 +1,19 @@ --- RevealInFinder --- --------------------------------------------------------------------------- +vim.api.nvim_create_user_command('Reveal', + function() + -- local sysname = vim.loop.os_uname().sysname -vim.cmd([[ - function! s:RevealInFinder() - if filereadable(expand("%")) - let l:command = "xdg-open -R %" - elseif getftype(expand("%:p:h")) == "dir" - let l:command = "xdg-open %:p:h" + local currentBuffer = vim.api.nvim_get_current_buf() + local bufName = vim.api.nvim_buf_get_name(currentBuffer) + local ftype = vim.fn.getftype(bufName) + + if ftype == "dir" then + os.execute("xdg-open " .. bufName) else - let l:command = "xdg-open ." - endif - execute ":silent! !" . l:command - redraw! - endfunction - - command! Reveal call RevealInFinder() -]]) + os.execute("xdg-open " .. vim.fn.expand("%:p:h")) + end + end, + {} +) vim.keymap.set('n', 'R', ":Reveal", { noremap = true, desc = '[R]eveal with xdg-open' }) From 48db037cfc3caba0928db3f1ccb6052950fea532 Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Fri, 14 Apr 2023 23:15:16 -0600 Subject: [PATCH 12/15] fix: comment out spell --- after/plugin/defaults.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index 2ecd1d89..3ec96904 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -4,14 +4,16 @@ set.colorcolumn = "80,120" set.cursorline = true set.expandtab = true set.list = true -set.swapfile = false -set.writebackup = false -set.wrap = false set.shiftwidth = 2 +-- set.spell = true +-- set.spelllang = 'en_us' set.splitbelow = true set.splitright = true +set.swapfile = false set.tabstop = 2 set.textwidth = 80 +set.wrap = false +set.writebackup = false vim.o.inccommand = "nosplit" From 7e978b24fc7fe4737c2bd378a57a6ca7effae592 Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Sun, 16 Apr 2023 01:23:30 -0600 Subject: [PATCH 13/15] feat: move :Reveal to a plugin --- init.lua | 6 +++++- lua/custom/plugins/init.lua | 27 +++++++++++++++++++-------- lua/custom/plugins/reveal.lua | 26 +++++++------------------- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/init.lua b/init.lua index a5641305..f0cf4046 100644 --- a/init.lua +++ b/init.lua @@ -183,7 +183,11 @@ require('lazy').setup({ -- An additional note is that if you only copied in the `init.lua`, you can just comment this line -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. { import = 'custom.plugins' }, -}, {}) +}, { + dev = { + path = "~/repos", + } +}) -- [[ Setting options ]] -- See `:help vim.o` diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index c4ffb2cb..14839c02 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -71,7 +71,7 @@ return { { "kristijanhusak/vim-dirvish-git", - dependencies = { "justinmk/vim-dirvish", }, + dependencies = { "justinmk/vim-dirvish" }, }, { @@ -103,24 +103,35 @@ return { { "jose-elias-alvarez/null-ls.nvim", - -- cond = false, dependencies = { "nvim-lua/plenary.nvim" }, config = function() - -- @see: https://github.com/jay-babu/mason-null-ls.nvim - -- might want to just use mason-null-ls. not yet sure what the advantage is. local null_ls = require("null-ls") + null_ls.setup({ sources = { null_ls.builtins.code_actions.eslint_d, null_ls.builtins.diagnostics.codespell, - -- null_ls.builtins.diagnostics.cspell, - -- null_ls.builtins.diagnostics.editorconfig_checker, null_ls.builtins.diagnostics.eslint_d, - null_ls.builtins.formatting.lua_format, - -- null_ls.builtins.formatting.prettier_eslint, null_ls.builtins.formatting.prettierd, }, }) end + }, + + { + "jay-babu/mason-null-ls.nvim", + cond = false, + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "jose-elias-alvarez/null-ls.nvim", + }, + config = function() + require("mason-null-ls").setup({ + ensure_installed = {}, + automatic_installation = true, + automatic_setup = false, + }) + end, } } diff --git a/lua/custom/plugins/reveal.lua b/lua/custom/plugins/reveal.lua index 2edcd1e8..89918a7f 100644 --- a/lua/custom/plugins/reveal.lua +++ b/lua/custom/plugins/reveal.lua @@ -1,21 +1,9 @@ -vim.api.nvim_create_user_command('Reveal', - function() - -- local sysname = vim.loop.os_uname().sysname - - local currentBuffer = vim.api.nvim_get_current_buf() - local bufName = vim.api.nvim_buf_get_name(currentBuffer) - local ftype = vim.fn.getftype(bufName) - - if ftype == "dir" then - os.execute("xdg-open " .. bufName) - else - os.execute("xdg-open " .. vim.fn.expand("%:p:h")) - end - end, - {} -) - -vim.keymap.set('n', 'R', ":Reveal", { noremap = true, desc = '[R]eveal with xdg-open' }) - return { + { + "killtheliterate/nvim-reveal", + dev = false, + config = function() + require('nvim-reveal').setup {} + end + }, } From 6a37323f6a4d8d77706df2f44669ea576dcdd85e Mon Sep 17 00:00:00 2001 From: Garrett Dawson Date: Sun, 16 Apr 2023 15:22:03 -0600 Subject: [PATCH 14/15] fix: consolidate plugins table --- init.lua | 2 +- lua/custom/plugins/init.lua | 20 ++++++++++++++++++++ lua/custom/plugins/nvim-base16.lua | 10 ---------- lua/custom/plugins/reveal.lua | 9 --------- 4 files changed, 21 insertions(+), 20 deletions(-) delete mode 100644 lua/custom/plugins/nvim-base16.lua delete mode 100644 lua/custom/plugins/reveal.lua diff --git a/init.lua b/init.lua index d5bd7d9d..e10deec0 100644 --- a/init.lua +++ b/init.lua @@ -84,7 +84,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 14839c02..ef690820 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -6,6 +6,25 @@ return { { "tpope/vim-surround" }, { "tribela/vim-transparent" }, + { + "killtheliterate/nvim-reveal", + dev = false, + config = function() + require('nvim-reveal').setup {} + end + }, + + { + 'norcalli/nvim-base16.lua', + lazy = false, + priority = 1000, + config = function() + local base16 = require 'base16' + + base16(base16.themes[vim.env.BASE16_THEME or "3024"], true) + end, + }, + { "nvim-tree/nvim-web-devicons", lazy = true @@ -112,6 +131,7 @@ return { null_ls.builtins.code_actions.eslint_d, null_ls.builtins.diagnostics.codespell, null_ls.builtins.diagnostics.eslint_d, + null_ls.builtins.formatting.eslint_d, null_ls.builtins.formatting.prettierd, }, }) diff --git a/lua/custom/plugins/nvim-base16.lua b/lua/custom/plugins/nvim-base16.lua deleted file mode 100644 index 6e8be747..00000000 --- a/lua/custom/plugins/nvim-base16.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - 'norcalli/nvim-base16.lua', - lazy = false, - priority = 1000, - config = function() - local base16 = require 'base16' - - base16(base16.themes[vim.env.BASE16_THEME or "3024"], true) - end, -} diff --git a/lua/custom/plugins/reveal.lua b/lua/custom/plugins/reveal.lua deleted file mode 100644 index 89918a7f..00000000 --- a/lua/custom/plugins/reveal.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - { - "killtheliterate/nvim-reveal", - dev = false, - config = function() - require('nvim-reveal').setup {} - end - }, -} From 21a75c46352fc447ba1e305962cdf8bea2adc4e5 Mon Sep 17 00:00:00 2001 From: ggdawson <37080130+ggdawson@users.noreply.github.com> Date: Wed, 3 May 2023 10:26:28 -0600 Subject: [PATCH 15/15] fix: more tweaks --- after/plugin/defaults.lua | 6 +++-- init.lua | 4 ++-- lua/custom/plugins/init.lua | 46 +++++++++++++++++++++++++++++++++---- 3 files changed, 48 insertions(+), 8 deletions(-) diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index 3ec96904..969f1940 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -5,8 +5,6 @@ set.cursorline = true set.expandtab = true set.list = true set.shiftwidth = 2 --- set.spell = true --- set.spelllang = 'en_us' set.splitbelow = true set.splitright = true set.swapfile = false @@ -32,6 +30,10 @@ vim.keymap.set('v', '', ":m '>+1gv=gv", { noremap = true, desc = 'Bubbl -- additional telescope triggers vim.keymap.set('n', '', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', '', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sj', require('telescope.builtin').jumplist, { desc = '[S]earch [J]umplist' }) +vim.keymap.set('n', 'sj', require('telescope.builtin').jumplist, { desc = '[S]earch [J]umplist' }) +vim.keymap.set('n', 'ss', require('telescope.builtin').git_status, { desc = '[S]earch [S]tatus' }) +vim.keymap.set('n', 'sm', require('telescope.builtin').marks, { desc = '[S]earch [M]arks' }) vim.diagnostic.config({ severity_sort = true, diff --git a/init.lua b/init.lua index e10deec0..654c250e 100644 --- a/init.lua +++ b/init.lua @@ -139,7 +139,7 @@ require('lazy').setup({ }, -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { 'numToStr/Comment.nvim', opts = { } }, -- Fuzzy Finder (files, lsp, etc) { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, @@ -412,7 +412,7 @@ end local servers = { clangd = {}, cssls = {}, - eslint = {}, + -- eslint_d = {}, gopls = {}, pyright = {}, rust_analyzer = {}, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index ef690820..bc7336cf 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -95,25 +95,32 @@ return { { "folke/trouble.nvim", - cond = false, - requires = "nvim-tree/nvim-web-devicons", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, config = function() require("trouble").setup {} + vim.keymap.set("n", "xx", "TroubleToggle", { silent = true, noremap = true } ) + vim.keymap.set("n", "xw", "TroubleToggle workspace_diagnostics", { silent = true, noremap = true } ) + vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics", { silent = true, noremap = true } ) + vim.keymap.set("n", "xl", "TroubleToggle loclist", { silent = true, noremap = true } ) + vim.keymap.set("n", "xq", "TroubleToggle quickfix", { silent = true, noremap = true } ) + vim.keymap.set("n", "gR", "TroubleToggle lsp_references", { silent = true, noremap = true } ) @@ -131,7 +138,7 @@ return { null_ls.builtins.code_actions.eslint_d, null_ls.builtins.diagnostics.codespell, null_ls.builtins.diagnostics.eslint_d, - null_ls.builtins.formatting.eslint_d, + -- null_ls.builtins.formatting.eslint_d, null_ls.builtins.formatting.prettierd, }, }) @@ -153,5 +160,36 @@ return { automatic_setup = false, }) end, - } + }, + + { + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'JoosepAlviste/nvim-ts-context-commentstring', + }, + config = function() + require('nvim-treesitter.configs').setup { + ensure_installed = { + 'css', + 'html', + 'javascript', + 'lua', + 'python', + 'scss', + 'tsx', + 'typescript', + 'vim', + }, + + context_commentstring = { + enable = true, + enable_autocmd = false, + } + } + + require('Comment').setup { + pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(), + } + end + }, }