Add harpoon; telescope: ' fa': search all, ' ff': search respect hidden and ignore

nix-components
pegasust 2022-08-22 02:17:11 -07:00
parent c5475444d5
commit 6d79654021
2 changed files with 68 additions and 9 deletions

View File

@ -36,7 +36,7 @@ vim.g.mapleader = ' '
-- basic keymaps -- basic keymaps
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true }) -- since we're using space for leader vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true }) -- since we're using space for leader
vim.keymap.set('t', '<Esc>', '<C-\\><C-n>)') -- make :terminal escape out vim.keymap.set('t', '<Esc>', '<C-\\><C-n>)') -- make :terminal escape out
vim.keymap.set({'n','i','v'}, '<c-l>', '<Cmd>:mode<Cr>') -- redraw on every mode vim.keymap.set({ 'n', 'i', 'v' }, '<c-l>', '<Cmd>:mode<Cr>') -- redraw on every mode
-- diagnostics (errors/warnings to be shown) -- diagnostics (errors/warnings to be shown)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
@ -63,7 +63,9 @@ Plug('nvim-lua/plenary.nvim')
Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting
Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects
Plug('nvim-telescope/telescope.nvim', { tag = '0.1.0' }) -- file browser Plug('nvim-telescope/telescope.nvim', { tag = '0.1.0' }) -- file browser
Plug('nvim-telescope/telescope-fzf-native.nvim', {['do'] = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=release && cmake --build build --config Release && cmake --install build --prefix build'}) Plug('nvim-telescope/telescope-fzf-native.nvim',
{ ['do'] = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=release && cmake --build build --config Release && cmake --install build --prefix build' })
Plug('nvim-telescope/telescope-file-browser.nvim')
-- cmp: auto-complete/suggestions -- cmp: auto-complete/suggestions
Plug('neovim/nvim-lspconfig') -- built-in LSP configurations Plug('neovim/nvim-lspconfig') -- built-in LSP configurations
Plug('hrsh7th/cmp-nvim-lsp') Plug('hrsh7th/cmp-nvim-lsp')
@ -108,10 +110,11 @@ vim.opt.listchars:append "space:⋅"
vim.opt.listchars:append "eol:↴" vim.opt.listchars:append "eol:↴"
require("indent_blankline").setup { require("indent_blankline").setup {
show_end_of_line = true, show_end_of_line = true,
space_char_blankline = " ", space_char_blankline = " ",
} }
-- telescope -- telescope
local fb_actions = require "telescope".extensions.file_browser.actions
require('telescope').setup { require('telescope').setup {
defaults = { defaults = {
mappings = { mappings = {
@ -123,30 +126,75 @@ require('telescope').setup {
}, },
extensions = { extensions = {
fzf = { fzf = {
fuzzy = true, -- allow fuzzy matches fuzzy = true, -- allow fuzzy matches
override_generic_sorter = true, override_generic_sorter = true,
override_file_sorter = true, override_file_sorter = true,
case_mode = 'smart_case' case_mode = 'smart_case'
},
file_browser = {
theme = "ivy",
hiject_netrw = true, -- disables netrw and use file-browser instead
mappings = {
["i"] = {}, -- disable any shortcut in insert mode for now
["n"] = {
["c"] = fb_actions.create,
["r"] = fb_actions.rename,
["m"] = fb_actions.move,
["y"] = fb_actions.copy,
["d"] = fb_actions.remove,
["o"] = fb_actions.open,
["g"] = fb_actions.goto_parent_dir,
["e"] = fb_actions.goto_home_dir,
["w"] = fb_actions.goto_cwd,
["t"] = fb_actions.change_cwd,
["f"] = fb_actions.toggle_browser,
["h"] = fb_actions.toggle_hidden,
["s"] = fb_actions.toggle_all,
}
}
} }
} }
} }
pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'file_browser')
remap('n', '<C-p>', '<cmd>Telescope<cr>', { desc = 'Open Telescope general search' }) remap('n', '<C-p>', '<cmd>Telescope<cr>', { desc = 'Open Telescope general search' })
remap('n', '<leader>fm', function()
require("telescope").extensions.file_browser.file_browser()
end, { desc = '[F]ile [M]utation' })
remap('n', '<leader>ff', function() remap('n', '<leader>ff', function()
require('telescope.builtin').find_files() require('telescope.builtin').find_files({
end, { desc = '[F]ind [F]iles' }) hidden = false,
no_ignore = false,
follow = false,
})
end, { desc = '[F]ind [F]ile' })
remap('n', '<leader>fa', function()
require('telescope.builtin').find_files({
hidden = true,
no_ignore = true,
follow = true,
})
end, { desc = '[F]ind [A]ll files' })
remap('n', '<leader>fg', function() remap('n', '<leader>fg', function()
require('telescope.builtin').live_grep() require('telescope.builtin').live_grep()
end, { desc = '[F]ind by [G]rep' }) end, { desc = '[F]ind by [G]rep' })
remap('n', '<leader>fb', function() remap('n', '<leader>fb', function()
require('telescope.builtin').buffers() require('telescope.builtin').buffers()
end, { desc = '[F]ind existing [B]uffers' }) end, { desc = '[F]ind existing [B]uffers' })
remap('n', '<leader>fh', function() remap('n', '<leader>fh', function()
require('telescope.builtin').help_tags() require('telescope.builtin').help_tags()
end, { desc = '[F]ind [H]elp' }) end, { desc = '[F]ind [H]elp' })
remap('n', '<leader>fd', function() remap('n', '<leader>fd', function()
require('telescope.builtin').diagnostics() require('telescope.builtin').diagnostics()
end, { desc = '[F]ind [D]iagnostics' }) end, { desc = '[F]ind [D]iagnostics' })
-- treesitter -- treesitter
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {
ensure_installed = { 'lua', 'typescript', 'rust', 'go', 'python', 'prisma' }, ensure_installed = { 'lua', 'typescript', 'rust', 'go', 'python', 'prisma' },
@ -174,6 +222,13 @@ require('nvim-treesitter.configs').setup {
}, },
}, },
} }
-- harpoon: mark significant files & switch between them
remap('n', '<leader>m', function() require('harpoon.mark').add_file() end)
remap('n', '<leader>hf', function() require('harpoon.ui').nav_file(1) end)
remap('n', '<leader>hj', function() require('harpoon.ui').nav_file(2) end)
remap('n', '<leader>hd', function() require('harpoon.ui').nav_file(3) end)
remap('n', '<leader>hk', function() require('harpoon.ui').nav_file(4) end)
remap('n', '<leader>hh', function() require('harpoon.ui').toggle_quick_menu() end)
-- LSP settings -- LSP settings
-- This function gets run when an LSP connects to a particular buffer. -- This function gets run when an LSP connects to a particular buffer.

View File

@ -2,6 +2,11 @@
set -g default-terminal "screen-256color" # more colors set -g default-terminal "screen-256color" # more colors
set -ga terminal-overrides ",xterm-256color*:Tc" # more colors set -ga terminal-overrides ",xterm-256color*:Tc" # more colors
set -s escape-time 0 set -s escape-time 0
set -g display-time 1500
# rebind C-b to C-a; easier to type on qwerty
unbind C-b
set -g prefix C-a
bind r source-file ~/.tmux.conf \; display "tmux.conf reloaded at ~/.tmux.conf" bind r source-file ~/.tmux.conf \; display "tmux.conf reloaded at ~/.tmux.conf"
set -g base-index 1 # rebind to start from 0 set -g base-index 1 # rebind to start from 0
@ -11,4 +16,3 @@ set-option -g renumber-windows on
# status bar # status bar
set -g status-style 'bg=#333333 fg=#5eacd3' set -g status-style 'bg=#333333 fg=#5eacd3'