Skip to content

Commit

Permalink
my own customized #1
Browse files Browse the repository at this point in the history
  • Loading branch information
tw-sithumyo committed Apr 11, 2024
1 parent 2377390 commit 1b3c95d
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
14 changes: 13 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

-- Set to true if you have a Nerd Font installed
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true

-- [[ Setting options ]]
-- See `:help vim.opt`
Expand Down Expand Up @@ -167,6 +167,10 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagn
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })

-- Copy The whole file buffer to system clipboard
vim.api.nvim_set_keymap('n', '<leader>y', ':%y+<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>pv', '<cmd>Ex<CR>', { noremap = true, silent = true })

-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
-- is not what someone will guess without a bit more experience.
Expand Down Expand Up @@ -369,9 +373,14 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>pf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>pw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>pg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>st', builtin.git_files, { desc = '[S]earch [T]ree' })
vim.keymap.set('n', '<leader>sb', builtin.buffers, { desc = '[S]earch [B]uffers' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
Expand Down Expand Up @@ -464,13 +473,16 @@ require('lazy').setup({
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
map('<leader>gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')

-- Find references for the word under your cursor.
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
map('<leader>gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')

-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
map('<leader>gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')

-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
Expand Down
8 changes: 8 additions & 0 deletions lua/custom/plugins/copilot.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
return {
'github/copilot.vim',
branch = 'release',
dependencies = {},
config = function()
vim.g.copilot_filetypes = { markdown = true, yaml = true }
end,
}
56 changes: 56 additions & 0 deletions lua/custom/plugins/hapoon2.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
return {
'ThePrimeagen/harpoon',
branch = 'harpoon2',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local harpoon = require 'harpoon'
harpoon:setup {}

-- Keybindings
vim.keymap.set('n', '<Leader>hh', function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end)
vim.keymap.set('n', '<Leader>hm', function()
harpoon:list():append()
end)

-- Navigate to the marked files
for i = 1, 5 do
vim.keymap.set('n', '<Leader>h' .. i, function()
harpoon:list():select(i)
end)
end

-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set('n', '<Leader>hp', function()
harpoon:list():prev()
end)
vim.keymap.set('n', '<Leader>hn', function()
harpoon:list():next()
end)

-- basic telescope configuration
local conf = require('telescope.config').values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end

require('telescope.pickers')
.new({}, {
prompt_title = 'Harpoon',
finder = require('telescope.finders').new_table {
results = file_paths,
},
previewer = conf.file_previewer {},
sorter = conf.generic_sorter {},
})
:find()
end

vim.keymap.set('n', '<C-e>', function()
toggle_telescope(harpoon:list())
end, { desc = 'Open harpoon window' })
end,
}

0 comments on commit 1b3c95d

Please sign in to comment.