Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ P.S. You can delete this when you're done too. It's your config now! :)
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.opt.shell = '/bin/bash'

-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true

-- [[ Setting options ]]
-- See `:help vim.opt`
Expand All @@ -102,7 +103,7 @@ vim.g.have_nerd_font = false
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true
vim.opt.relativenumber = true

-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'
Expand Down Expand Up @@ -885,7 +886,7 @@ require('lazy').setup({
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the
Expand All @@ -910,3 +911,5 @@ require('lazy').setup({

-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

require 'lua/custom/vscode'
40 changes: 40 additions & 0 deletions lua/custom/plugins/harpoon.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
return {
'ThePrimeagen/harpoon',
branch = 'harpoon2',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local harpoon = require 'harpoon'

-- REQUIRED
harpoon:setup()
-- REQUIRED

vim.keymap.set('n', '<leader>a', function()
harpoon:list():add()
end)
vim.keymap.set('n', '<C-e>', function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end)

vim.keymap.set('n', '<leader>1', function()
harpoon:list():select(1)
end)
vim.keymap.set('n', '<leader>2', function()
harpoon:list():select(2)
end)
vim.keymap.set('n', '<leader>3', function()
harpoon:list():select(3)
end)
vim.keymap.set('n', '<leader>4', function()
harpoon:list():select(4)
end)

-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set('n', '<C-S-P>', function()
harpoon:list():prev()
end)
vim.keymap.set('n', '<C-S-N>', function()
harpoon:list():next()
end)
end,
}
57 changes: 56 additions & 1 deletion lua/custom/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,59 @@
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}
return {
'nvim-tree/nvim-tree.lua',
version = '*',
lazy = false,
dependencies = {
'nvim-tree/nvim-web-devicons',
},
config = function()
require('nvim-tree').setup {}
--
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- empty setup using defaults
local nvim_tree_api = require 'nvim-tree.api'
local function open_nvim_tree(data)
-- buffer is a directory
local directory = vim.fn.isdirectory(data.file) == 1
if directory then
-- change to the directory
vim.cmd.cd(data.file)
-- open the tree
nvim_tree_api.tree.open()
return
end

-- buffer is a real file on the disk
local real_file = vim.fn.filereadable(data.file) == 1

-- buffer is a [No Name]
local no_name = data.file == '' and vim.bo[data.buf].buftype == ''

if not real_file and not no_name then
return
end

-- open the tree, find the file but don't focus it
nvim_tree_api.tree.toggle { focus = false, find_file = true }
end
vim.api.nvim_create_autocmd({ 'VimEnter' }, { callback = open_nvim_tree })
vim.keymap.set('n', '<leader>x', function()
nvim_tree_api.tree.open()
end)

vim.api.nvim_create_autocmd('BufEnter', {
group = vim.api.nvim_create_augroup('NvimTreeClose', { clear = true }),
pattern = 'NvimTree_*',
callback = function()
local layout = vim.api.nvim_call_function('winlayout', {})
if layout[1] == 'leaf' and vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(layout[2]), 'filetype') == 'NvimTree' and layout[3] == nil then
vim.cmd 'confirm quit'
end
end,
})
end,
}
6 changes: 6 additions & 0 deletions lua/custom/plugins/leap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
return {
'ggandor/leap.nvim',
config = function()
require('leap').create_default_mappings()
end,
}
135 changes: 135 additions & 0 deletions lua/custom/vscode.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
if vim.g.vscode then
local vscode = require 'vscode'
--n: normal mode, x: visual mode, i: insert mode

vim.keymap.set({ 'n', 'x' }, '<leader>,', function()
vscode.action 'workbench.action.showCommands'
end)
vim.keymap.set({ 'n', 'x' }, '<leader><leader>', function()
vscode.action 'workbench.action.quickOpen'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>ts', function()
vscode.action 'workbench.action.toggleSidebarVisibility'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>x', function()
vscode.action 'workbench.view.explorer'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>wr', function()
vscode.action 'workbench.action.reloadWindow'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>wq', function()
vscode.action 'workbench.action.quit'
end)

-- find key
vim.keymap.set({ 'n', 'x' }, '<leader>sf', function()
vscode.action 'workbench.action.findInFiles'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>sn', function()
vscode.action 'workbench.action.focusNextSearchResult'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>sp', function()
vscode.action 'workbench.action.focusPreviousSearchResult'
end)

-- document keys
vim.keymap.set({ 'n', 'x' }, '<leader>f', function()
vscode.action 'editor.action.formatDocument'
end)
vim.keymap.set('n', '<leader>ds', function()
vscode.action 'cSpell.toggleEnableSpellChecker'
vscode.call 'workbench.action.quickOpenNavigateNextInEditorPicker'
vscode.call 'workbench.action.quickOpenNavigateNextInEditorPicker'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>.', function()
vscode.action 'editor.action.quickFix'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>rn', function()
vscode.action 'editor.action.rename'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>rr', function()
vscode.action 'editor.action.refactor'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>ri', function()
vscode.action 'editor.action.organizeImports'
end)
vim.keymap.set('n', 'gd', function()
vscode.action 'editor.action.revealDefinition'
end)
vim.keymap.set('n', 'gi', function()
vscode.action 'editor.action.goToImplementation'
end)
vim.keymap.set('n', 'K', function()
vscode.action 'editor.action.scrollUpHover'
end)
vim.keymap.set('n', '<C-k>', function()
vscode.action 'editor.action.triggerParameterHints'
end)
vim.keymap.set('n', 'gr', function()
vscode.action 'references-view.findReferences'
end)
-- editor.action.findReferences
vim.keymap.set('n', '[d', function()
vscode.action 'editor.action.marker.prev'
end)
vim.keymap.set('n', ']d', function()
vscode.action 'editor.action.marker.next'
end)
vim.keymap.set('n', '<leader>e', function()
vscode.action 'workbench.actions.view.problems'
end)

-- editor keys
vim.keymap.set({ 'n', 'x' }, '<leader>ep', function()
vscode.action 'workbench.action.pinEditor'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>eP', function()
vscode.action 'workbench.action.unpinEditor'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>es', function()
vscode.action 'workbench.action.splitEditor'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>ev', function()
vscode.action 'workbench.action.splitEditorDown'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>et', function()
vscode.action 'workbench.action.closeOtherEditors'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>el', function()
vscode.action 'workbench.action.moveEditorLeftInGroup'
end)
vim.keymap.set({ 'n', 'x' }, '<leader>el', function()
vscode.action 'workbench.action.moveEditorRightInGroup'
end)
vim.keymap.set({ 'n', 'x' }, 'Q', function()
vscode.call 'workbench.action.files.save'
vscode.call 'workbench.action.unpinEditor'
vscode.action 'workbench.action.closeActiveEditor'
end)

-- vscode-harpoon
vim.keymap.set('n', '<leader>ha', function()
vscode.action 'vscode-harpoon.addEditor'
end)
vim.keymap.set('n', '<leader>hp', function()
vscode.action 'vscode-harpoon.editorQuickPick'
end)
vim.keymap.set('n', '<leader>he', function()
vscode.action 'vscode-harpoon.editEditors'
end)
vim.keymap.set('n', '<leader>h1', function()
vscode.action 'vscode-harpoon.goToEditor1'
end)
vim.keymap.set('n', '<leader>h2', function()
vscode.action 'vscode-harpoon.goToEditor2'
end)
vim.keymap.set('n', '<leader>h3', function()
vscode.action 'vscode-harpoon.goToEditor3'
end)
vim.keymap.set('n', '<leader>h4', function()
vscode.action 'vscode-harpoon.goToEditor4'
end)
vim.keymap.set('n', '<leader>h5', function()
vscode.action 'vscode-harpoon.goToEditor5'
end)
end
Loading