From 5ce2e5cbce0d4f15a64d4f7fe86ea288cf869d66 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Wed, 24 Nov 2021 08:25:39 -0500 Subject: [PATCH] clipboard and notes changes --- nvim.configlink/init.lua | 95 ++++++++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 27 deletions(-) diff --git a/nvim.configlink/init.lua b/nvim.configlink/init.lua index 32d46cd..7aa6fde 100644 --- a/nvim.configlink/init.lua +++ b/nvim.configlink/init.lua @@ -130,9 +130,6 @@ require('packer').startup(function(use) -- Language Server -- ======================================================================= - -- Language server completion plugin - use 'hrsh7th/cmp-nvim-lsp' - -- Language server engine use { 'neovim/nvim-lspconfig', @@ -180,11 +177,20 @@ require('packer').startup(function(use) -- Pretty highlights use 'folke/lsp-colors.nvim' + use { + 'folke/trouble.nvim', + requires = 'kyazdani42/nvim-web-devicons', + config = function() + require("trouble").setup { } + end + } + -- ======================================================================= -- Completion System -- ======================================================================= -- Completion sources + use 'hrsh7th/cmp-nvim-lsp' --- Language server completion plugin use 'hrsh7th/cmp-buffer' --- Generic text completion use 'hrsh7th/cmp-path' --- Local file completion use 'hrsh7th/cmp-cmdline' --- Command line completion @@ -359,6 +365,9 @@ require('packer').startup(function(use) require('neoclip').setup({ enable_persistant_history = true, default_register = {'+', '"'}, + keys = { + i = { paste = '' }, + }, }) require('telescope').load_extension('neoclip') end @@ -449,9 +458,6 @@ vim.api.nvim_exec([[ au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 } ]], false) --- Auto-pairs -vim.g.AutoPairsFlyMode = 0 - -- Netrw vim.g.netrw_liststyle = 3 -- Change style to 'tree' view vim.g.netrw_banner = 0 -- Remove useless banner @@ -496,26 +502,62 @@ vim.api.nvim_exec([[ -- =========================================================================== grep_notes = function() - local opts = {} - opts.prompt_title = "Search Notes" - opts.cwd = '$NOTES_PATH' + local opts = { + prompt_title = "Search Notes", + cwd = '$NOTES_PATH', + } require('telescope.builtin').live_grep(opts) end find_notes = function() - local opts = {} - opts.prompt_title = "Find Notes" - opts.cwd = '$NOTES_PATH' + local opts = { + prompt_title = "Find Notes", + cwd = '$NOTES_PATH', + } require('telescope.builtin').find_files(opts) end find_downloads = function() - local opts = {} - opts.prompt_title = "Find Downloads" - opts.cwd = '~/Downloads' + local opts = { + prompt_title = "Find Downloads", + cwd = '~/Downloads', + } require('telescope.builtin').file_browser(opts) end +choose_project = function() + local opts = require("telescope.themes").get_ivy { + layout_config = { + bottom_pane = { + height = 10, + }, + }, + } + require('telescope').extensions.project.project(opts) +end + +clipboard_history = function() + local opts = require("telescope.themes").get_cursor { + layout_config = { + cursor = { + width = 150, + }, + }, + } + require('telescope').extensions.neoclip.neoclip(opts) +end + +command_history = function() + local opts = require("telescope.themes").get_ivy { + layout_config = { + bottom_pane = { + height = 15, + } + } + } + require('telescope.builtin').command_history(opts) +end + -- =========================================================================== -- Key Mapping -- =========================================================================== @@ -565,21 +607,22 @@ key("n", "b", ":Telescope buffers") key("n", "hh", ":Telescope help_tags") key("n", "fr", ":Telescope oldfiles") key("n", "cc", ":Telescope commands") -key("n", "cr", "lua require('telescope.builtin').command_history(require('telescope.themes').get_ivy({}))") -key("n", "y", "lua require('telescope').extensions.neoclip.neoclip(require('telescope.themes').get_cursor({}))") +key("n", "cr", "lua command_history()") +key("n", "y", "lua clipboard_history()") +key("i", "", "lua clipboard_history()") key("n", "s", ":Telescope current_buffer_fuzzy_find") key("n", "gc", ":Telescope git_commits") key("n", "gf", ":Telescope git_bcommits") key("n", "gb", ":Telescope git_branches") key("n", "gs", ":Telescope git_status") -key("n", "", ":lua require'telescope'.extensions.project.project(require('telescope.themes').get_ivy({}))") +key("n", "", "lua choose_project()") -- Harpoon -key("n", "m", ": lua require('harpoon.mark').add_file()") -key("n", "`", ": lua require('harpoon.ui').toggle_quick_menu()") -key("n", "1", ": lua require('harpoon.ui').nav_file(1)") -key("n", "2", ": lua require('harpoon.ui').nav_file(2)") -key("n", "3", ": lua require('harpoon.ui').nav_file(3)") +key("n", "m", "lua require('harpoon.mark').add_file()") +key("n", "`", "lua require('harpoon.ui').toggle_quick_menu()") +key("n", "1", "lua require('harpoon.ui').nav_file(1)") +key("n", "2", "lua require('harpoon.ui').nav_file(2)") +key("n", "3", "lua require('harpoon.ui').nav_file(3)") -- LSP key("n", "gd", "lua vim.lsp.buf.definition()", {silent=true}) @@ -610,9 +653,7 @@ key("n", "wm", ":only") -- Tabularize key("", "ta", ":Tabularize /") key("", "t#", ":Tabularize /#") -key("", "t\"", ":Tabularize /\"") -key("", "tl", ":Tabularize /--") -key("", "tL", ":Tabularize /---") +key("", "tl", ":Tabularize /---") -- Vimrc editing key("n", "fv", ":edit $MYVIMRC") @@ -636,4 +677,4 @@ key("t", "", "") --- Exit terminal mo key("n", "", ":noh", {silent=true}) --- Clear search in VimWiki key("n", "Y", "y$") --- Copy to end of line key("v", "", "y:%s/+//gc") --- Substitute selected -key("v", "D", "y'>p") --- Duplicate selected +key("v", "D", "y'>gp") --- Duplicate selected