clipboard and notes changes

This commit is contained in:
Noah Masur 2021-11-24 08:25:39 -05:00
parent 3b223a88ca
commit 5ce2e5cbce

View File

@ -130,9 +130,6 @@ require('packer').startup(function(use)
-- Language Server -- Language Server
-- ======================================================================= -- =======================================================================
-- Language server completion plugin
use 'hrsh7th/cmp-nvim-lsp'
-- Language server engine -- Language server engine
use { use {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
@ -180,11 +177,20 @@ require('packer').startup(function(use)
-- Pretty highlights -- Pretty highlights
use 'folke/lsp-colors.nvim' use 'folke/lsp-colors.nvim'
use {
'folke/trouble.nvim',
requires = 'kyazdani42/nvim-web-devicons',
config = function()
require("trouble").setup { }
end
}
-- ======================================================================= -- =======================================================================
-- Completion System -- Completion System
-- ======================================================================= -- =======================================================================
-- Completion sources -- Completion sources
use 'hrsh7th/cmp-nvim-lsp' --- Language server completion plugin
use 'hrsh7th/cmp-buffer' --- Generic text completion use 'hrsh7th/cmp-buffer' --- Generic text completion
use 'hrsh7th/cmp-path' --- Local file completion use 'hrsh7th/cmp-path' --- Local file completion
use 'hrsh7th/cmp-cmdline' --- Command line completion use 'hrsh7th/cmp-cmdline' --- Command line completion
@ -359,6 +365,9 @@ require('packer').startup(function(use)
require('neoclip').setup({ require('neoclip').setup({
enable_persistant_history = true, enable_persistant_history = true,
default_register = {'+', '"'}, default_register = {'+', '"'},
keys = {
i = { paste = '<c-v>' },
},
}) })
require('telescope').load_extension('neoclip') require('telescope').load_extension('neoclip')
end end
@ -449,9 +458,6 @@ vim.api.nvim_exec([[
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 } au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
]], false) ]], false)
-- Auto-pairs
vim.g.AutoPairsFlyMode = 0
-- Netrw -- Netrw
vim.g.netrw_liststyle = 3 -- Change style to 'tree' view vim.g.netrw_liststyle = 3 -- Change style to 'tree' view
vim.g.netrw_banner = 0 -- Remove useless banner vim.g.netrw_banner = 0 -- Remove useless banner
@ -496,26 +502,62 @@ vim.api.nvim_exec([[
-- =========================================================================== -- ===========================================================================
grep_notes = function() grep_notes = function()
local opts = {} local opts = {
opts.prompt_title = "Search Notes" prompt_title = "Search Notes",
opts.cwd = '$NOTES_PATH' cwd = '$NOTES_PATH',
}
require('telescope.builtin').live_grep(opts) require('telescope.builtin').live_grep(opts)
end end
find_notes = function() find_notes = function()
local opts = {} local opts = {
opts.prompt_title = "Find Notes" prompt_title = "Find Notes",
opts.cwd = '$NOTES_PATH' cwd = '$NOTES_PATH',
}
require('telescope.builtin').find_files(opts) require('telescope.builtin').find_files(opts)
end end
find_downloads = function() find_downloads = function()
local opts = {} local opts = {
opts.prompt_title = "Find Downloads" prompt_title = "Find Downloads",
opts.cwd = '~/Downloads' cwd = '~/Downloads',
}
require('telescope.builtin').file_browser(opts) require('telescope.builtin').file_browser(opts)
end 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 -- Key Mapping
-- =========================================================================== -- ===========================================================================
@ -565,21 +607,22 @@ key("n", "<Leader>b", ":Telescope buffers<CR>")
key("n", "<Leader>hh", ":Telescope help_tags<CR>") key("n", "<Leader>hh", ":Telescope help_tags<CR>")
key("n", "<Leader>fr", ":Telescope oldfiles<CR>") key("n", "<Leader>fr", ":Telescope oldfiles<CR>")
key("n", "<Leader>cc", ":Telescope commands<CR>") key("n", "<Leader>cc", ":Telescope commands<CR>")
key("n", "<Leader>cr", "<Cmd>lua require('telescope.builtin').command_history(require('telescope.themes').get_ivy({}))<CR>") key("n", "<Leader>cr", "<Cmd>lua command_history()<CR>")
key("n", "<Leader>y", "<Cmd>lua require('telescope').extensions.neoclip.neoclip(require('telescope.themes').get_cursor({}))<CR>") key("n", "<Leader>y", "<Cmd>lua clipboard_history()<CR>")
key("i", "<c-y>", "<Cmd>lua clipboard_history()<CR>")
key("n", "<Leader>s", ":Telescope current_buffer_fuzzy_find<CR>") key("n", "<Leader>s", ":Telescope current_buffer_fuzzy_find<CR>")
key("n", "<Leader>gc", ":Telescope git_commits<CR>") key("n", "<Leader>gc", ":Telescope git_commits<CR>")
key("n", "<Leader>gf", ":Telescope git_bcommits<CR>") key("n", "<Leader>gf", ":Telescope git_bcommits<CR>")
key("n", "<Leader>gb", ":Telescope git_branches<CR>") key("n", "<Leader>gb", ":Telescope git_branches<CR>")
key("n", "<Leader>gs", ":Telescope git_status<CR>") key("n", "<Leader>gs", ":Telescope git_status<CR>")
key("n", "<C-p>", ":lua require'telescope'.extensions.project.project(require('telescope.themes').get_ivy({}))<CR>") key("n", "<C-p>", "<Cmd>lua choose_project()<CR>")
-- Harpoon -- Harpoon
key("n", "<Leader>m", ":<Cmd> lua require('harpoon.mark').add_file()<CR><Esc>") key("n", "<Leader>m", "<Cmd>lua require('harpoon.mark').add_file()<CR><Esc>")
key("n", "<Leader>`", ":<Cmd> lua require('harpoon.ui').toggle_quick_menu()<CR><Esc>") key("n", "<Leader>`", "<Cmd>lua require('harpoon.ui').toggle_quick_menu()<CR><Esc>")
key("n", "<Leader>1", ":<Cmd> lua require('harpoon.ui').nav_file(1)<CR><Esc>") key("n", "<Leader>1", "<Cmd>lua require('harpoon.ui').nav_file(1)<CR><Esc>")
key("n", "<Leader>2", ":<Cmd> lua require('harpoon.ui').nav_file(2)<CR><Esc>") key("n", "<Leader>2", "<Cmd>lua require('harpoon.ui').nav_file(2)<CR><Esc>")
key("n", "<Leader>3", ":<Cmd> lua require('harpoon.ui').nav_file(3)<CR><Esc>") key("n", "<Leader>3", "<Cmd>lua require('harpoon.ui').nav_file(3)<CR><Esc>")
-- LSP -- LSP
key("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", {silent=true}) key("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", {silent=true})
@ -610,9 +653,7 @@ key("n", "<Leader>wm", ":only<CR>")
-- Tabularize -- Tabularize
key("", "<Leader>ta", ":Tabularize /") key("", "<Leader>ta", ":Tabularize /")
key("", "<Leader>t#", ":Tabularize /#<CR>") key("", "<Leader>t#", ":Tabularize /#<CR>")
key("", "<Leader>t\"", ":Tabularize /\"<CR>") key("", "<Leader>tl", ":Tabularize /---<CR>")
key("", "<Leader>tl", ":Tabularize /--<CR>")
key("", "<Leader>tL", ":Tabularize /---<CR>")
-- Vimrc editing -- Vimrc editing
key("n", "<Leader>fv", ":edit $MYVIMRC<CR>") key("n", "<Leader>fv", ":edit $MYVIMRC<CR>")
@ -636,4 +677,4 @@ key("t", "<A-CR>", "<C-\\><C-n>") --- Exit terminal mo
key("n", "<A-CR>", ":noh<CR>", {silent=true}) --- Clear search in VimWiki key("n", "<A-CR>", ":noh<CR>", {silent=true}) --- Clear search in VimWiki
key("n", "Y", "y$") --- Copy to end of line key("n", "Y", "y$") --- Copy to end of line
key("v", "<C-r>", "y<Esc>:%s/<C-r>+//gc<left><left><left>") --- Substitute selected key("v", "<C-r>", "y<Esc>:%s/<C-r>+//gc<left><left><left>") --- Substitute selected
key("v", "D", "y'>p") --- Duplicate selected key("v", "D", "y'>gp") --- Duplicate selected