Skip to content

Commit f50ff82

Browse files
Brij Kishore SharmaBrij Kishore Sharma
authored andcommitted
added more plugins
1 parent 5aeddfd commit f50ff82

File tree

5 files changed

+243
-4
lines changed

5 files changed

+243
-4
lines changed

init.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ P.S. You can delete this when you're done too. It's your config now! :)
8989
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
9090
vim.g.mapleader = ' '
9191
vim.g.maplocalleader = ' '
92+
vim.opt.shell = '/bin/bash'
9293

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

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

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

911912
-- The line beneath this is called `modeline`. See `:help modeline`
912913
-- vim: ts=2 sts=2 sw=2 et
914+
915+
require 'lua/custom/vscode'

lua/custom/plugins/harpoon.lua

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
return {
2+
'ThePrimeagen/harpoon',
3+
branch = 'harpoon2',
4+
dependencies = { 'nvim-lua/plenary.nvim' },
5+
config = function()
6+
local harpoon = require 'harpoon'
7+
8+
-- REQUIRED
9+
harpoon:setup()
10+
-- REQUIRED
11+
12+
vim.keymap.set('n', '<leader>a', function()
13+
harpoon:list():add()
14+
end)
15+
vim.keymap.set('n', '<C-e>', function()
16+
harpoon.ui:toggle_quick_menu(harpoon:list())
17+
end)
18+
19+
vim.keymap.set('n', '<leader>1', function()
20+
harpoon:list():select(1)
21+
end)
22+
vim.keymap.set('n', '<leader>2', function()
23+
harpoon:list():select(2)
24+
end)
25+
vim.keymap.set('n', '<leader>3', function()
26+
harpoon:list():select(3)
27+
end)
28+
vim.keymap.set('n', '<leader>4', function()
29+
harpoon:list():select(4)
30+
end)
31+
32+
-- Toggle previous & next buffers stored within Harpoon list
33+
vim.keymap.set('n', '<C-S-P>', function()
34+
harpoon:list():prev()
35+
end)
36+
vim.keymap.set('n', '<C-S-N>', function()
37+
harpoon:list():next()
38+
end)
39+
end,
40+
}

lua/custom/plugins/init.lua

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,59 @@
22
-- I promise not to create any merge conflicts in this directory :)
33
--
44
-- See the kickstart.nvim README for more information
5-
return {}
5+
return {
6+
'nvim-tree/nvim-tree.lua',
7+
version = '*',
8+
lazy = false,
9+
dependencies = {
10+
'nvim-tree/nvim-web-devicons',
11+
},
12+
config = function()
13+
require('nvim-tree').setup {}
14+
--
15+
-- disable netrw at the very start of your init.lua
16+
vim.g.loaded_netrw = 1
17+
vim.g.loaded_netrwPlugin = 1
18+
-- empty setup using defaults
19+
local nvim_tree_api = require 'nvim-tree.api'
20+
local function open_nvim_tree(data)
21+
-- buffer is a directory
22+
local directory = vim.fn.isdirectory(data.file) == 1
23+
if directory then
24+
-- change to the directory
25+
vim.cmd.cd(data.file)
26+
-- open the tree
27+
nvim_tree_api.tree.open()
28+
return
29+
end
30+
31+
-- buffer is a real file on the disk
32+
local real_file = vim.fn.filereadable(data.file) == 1
33+
34+
-- buffer is a [No Name]
35+
local no_name = data.file == '' and vim.bo[data.buf].buftype == ''
36+
37+
if not real_file and not no_name then
38+
return
39+
end
40+
41+
-- open the tree, find the file but don't focus it
42+
nvim_tree_api.tree.toggle { focus = false, find_file = true }
43+
end
44+
vim.api.nvim_create_autocmd({ 'VimEnter' }, { callback = open_nvim_tree })
45+
vim.keymap.set('n', '<leader>x', function()
46+
nvim_tree_api.tree.open()
47+
end)
48+
49+
vim.api.nvim_create_autocmd('BufEnter', {
50+
group = vim.api.nvim_create_augroup('NvimTreeClose', { clear = true }),
51+
pattern = 'NvimTree_*',
52+
callback = function()
53+
local layout = vim.api.nvim_call_function('winlayout', {})
54+
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
55+
vim.cmd 'confirm quit'
56+
end
57+
end,
58+
})
59+
end,
60+
}

lua/custom/plugins/leap.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
return {
2+
'ggandor/leap.nvim',
3+
config = function()
4+
require('leap').create_default_mappings()
5+
end,
6+
}

lua/custom/vscode.lua

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
if vim.g.vscode then
2+
local vscode = require 'vscode'
3+
--n: normal mode, x: visual mode, i: insert mode
4+
5+
vim.keymap.set({ 'n', 'x' }, '<leader>,', function()
6+
vscode.action 'workbench.action.showCommands'
7+
end)
8+
vim.keymap.set({ 'n', 'x' }, '<leader><leader>', function()
9+
vscode.action 'workbench.action.quickOpen'
10+
end)
11+
vim.keymap.set({ 'n', 'x' }, '<leader>ts', function()
12+
vscode.action 'workbench.action.toggleSidebarVisibility'
13+
end)
14+
vim.keymap.set({ 'n', 'x' }, '<leader>x', function()
15+
vscode.action 'workbench.view.explorer'
16+
end)
17+
vim.keymap.set({ 'n', 'x' }, '<leader>wr', function()
18+
vscode.action 'workbench.action.reloadWindow'
19+
end)
20+
vim.keymap.set({ 'n', 'x' }, '<leader>wq', function()
21+
vscode.action 'workbench.action.quit'
22+
end)
23+
24+
-- find key
25+
vim.keymap.set({ 'n', 'x' }, '<leader>sf', function()
26+
vscode.action 'workbench.action.findInFiles'
27+
end)
28+
vim.keymap.set({ 'n', 'x' }, '<leader>sn', function()
29+
vscode.action 'workbench.action.focusNextSearchResult'
30+
end)
31+
vim.keymap.set({ 'n', 'x' }, '<leader>sp', function()
32+
vscode.action 'workbench.action.focusPreviousSearchResult'
33+
end)
34+
35+
-- document keys
36+
vim.keymap.set({ 'n', 'x' }, '<leader>f', function()
37+
vscode.action 'editor.action.formatDocument'
38+
end)
39+
vim.keymap.set('n', '<leader>ds', function()
40+
vscode.action 'cSpell.toggleEnableSpellChecker'
41+
vscode.call 'workbench.action.quickOpenNavigateNextInEditorPicker'
42+
vscode.call 'workbench.action.quickOpenNavigateNextInEditorPicker'
43+
end)
44+
vim.keymap.set({ 'n', 'x' }, '<leader>.', function()
45+
vscode.action 'editor.action.quickFix'
46+
end)
47+
vim.keymap.set({ 'n', 'x' }, '<leader>rn', function()
48+
vscode.action 'editor.action.rename'
49+
end)
50+
vim.keymap.set({ 'n', 'x' }, '<leader>rr', function()
51+
vscode.action 'editor.action.refactor'
52+
end)
53+
vim.keymap.set({ 'n', 'x' }, '<leader>ri', function()
54+
vscode.action 'editor.action.organizeImports'
55+
end)
56+
vim.keymap.set('n', 'gd', function()
57+
vscode.action 'editor.action.revealDefinition'
58+
end)
59+
vim.keymap.set('n', 'gi', function()
60+
vscode.action 'editor.action.goToImplementation'
61+
end)
62+
vim.keymap.set('n', 'K', function()
63+
vscode.action 'editor.action.scrollUpHover'
64+
end)
65+
vim.keymap.set('n', '<C-k>', function()
66+
vscode.action 'editor.action.triggerParameterHints'
67+
end)
68+
vim.keymap.set('n', 'gr', function()
69+
vscode.action 'references-view.findReferences'
70+
end)
71+
-- editor.action.findReferences
72+
vim.keymap.set('n', '[d', function()
73+
vscode.action 'editor.action.marker.prev'
74+
end)
75+
vim.keymap.set('n', ']d', function()
76+
vscode.action 'editor.action.marker.next'
77+
end)
78+
vim.keymap.set('n', '<leader>e', function()
79+
vscode.action 'workbench.actions.view.problems'
80+
end)
81+
82+
-- editor keys
83+
vim.keymap.set({ 'n', 'x' }, '<leader>ep', function()
84+
vscode.action 'workbench.action.pinEditor'
85+
end)
86+
vim.keymap.set({ 'n', 'x' }, '<leader>eP', function()
87+
vscode.action 'workbench.action.unpinEditor'
88+
end)
89+
vim.keymap.set({ 'n', 'x' }, '<leader>es', function()
90+
vscode.action 'workbench.action.splitEditor'
91+
end)
92+
vim.keymap.set({ 'n', 'x' }, '<leader>ev', function()
93+
vscode.action 'workbench.action.splitEditorDown'
94+
end)
95+
vim.keymap.set({ 'n', 'x' }, '<leader>et', function()
96+
vscode.action 'workbench.action.closeOtherEditors'
97+
end)
98+
vim.keymap.set({ 'n', 'x' }, '<leader>el', function()
99+
vscode.action 'workbench.action.moveEditorLeftInGroup'
100+
end)
101+
vim.keymap.set({ 'n', 'x' }, '<leader>el', function()
102+
vscode.action 'workbench.action.moveEditorRightInGroup'
103+
end)
104+
vim.keymap.set({ 'n', 'x' }, 'Q', function()
105+
vscode.call 'workbench.action.files.save'
106+
vscode.call 'workbench.action.unpinEditor'
107+
vscode.action 'workbench.action.closeActiveEditor'
108+
end)
109+
110+
-- vscode-harpoon
111+
vim.keymap.set('n', '<leader>ha', function()
112+
vscode.action 'vscode-harpoon.addEditor'
113+
end)
114+
vim.keymap.set('n', '<leader>hp', function()
115+
vscode.action 'vscode-harpoon.editorQuickPick'
116+
end)
117+
vim.keymap.set('n', '<leader>he', function()
118+
vscode.action 'vscode-harpoon.editEditors'
119+
end)
120+
vim.keymap.set('n', '<leader>h1', function()
121+
vscode.action 'vscode-harpoon.goToEditor1'
122+
end)
123+
vim.keymap.set('n', '<leader>h2', function()
124+
vscode.action 'vscode-harpoon.goToEditor2'
125+
end)
126+
vim.keymap.set('n', '<leader>h3', function()
127+
vscode.action 'vscode-harpoon.goToEditor3'
128+
end)
129+
vim.keymap.set('n', '<leader>h4', function()
130+
vscode.action 'vscode-harpoon.goToEditor4'
131+
end)
132+
vim.keymap.set('n', '<leader>h5', function()
133+
vscode.action 'vscode-harpoon.goToEditor5'
134+
end)
135+
end

0 commit comments

Comments
 (0)