Skip to content

Commit 28ff2e6

Browse files
committed
file explorer has been added and read below...
- nvim-cmp has been updated. - lazy.nvim has been updated. - builtin bufferline (tabs) has been enabled. - nvim-tree and nvim-web-devicons has been added. - CTRL+e shortcut key is used to open file explorer. - CTRL+p shortcut has been shifted to CTRL+v to paste. - [ USAGE ] - CTRL+q - to quit a tab. - CTRL+e - to open file explorer. - [ File Explorer ] - CTRL+x - to cut a file. - CTRL+c - to copy a file. - CTRL+v - to paste a file. - CTRL+n - to create a new file. - Left - to close a expanded folder. - Right - to open a file or expand a folder. - Enter or CTRL+o - to open a file in new tab.
1 parent 147d304 commit 28ff2e6

File tree

4 files changed

+54
-5
lines changed

4 files changed

+54
-5
lines changed

lazy-lock.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
77
"everforest-nvim": { "branch": "main", "commit": "5e0e32a569fb464911342f0d421721cc1c94cf25" },
88
"friendly-snippets": { "branch": "main", "commit": "d1446afecd54d95b1214c6f5a032ad815fbc74d1" },
9-
"lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" },
9+
"lazy.nvim": { "branch": "main", "commit": "758bb5de98b805acc5eeed8cdc8ac7f0bc4b0b86" },
1010
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
1111
"nvim-autopairs": { "branch": "master", "commit": "14e97371b2aab6ee70054c1070a123dfaa3e217e" },
12-
"nvim-cmp": { "branch": "main", "commit": "cd2cf0c124d3de577fb5449746568ee8e601afc8" }
12+
"nvim-cmp": { "branch": "main", "commit": "1d88772dc662cb33ae9b4b6ed78fae54b485a43a" },
13+
"nvim-tree.lua": { "branch": "master", "commit": "78c4c083ed5d47e7fab7627d78ce33d3bcfb88f0" },
14+
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }
1315
}

lua/plugins/fileexplorer.lua

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
return {
2+
"nvim-tree/nvim-tree.lua",
3+
cmd = "NvimTreeFindFile",
4+
dependencies = { "nvim-tree/nvim-web-devicons" },
5+
config = function()
6+
local explorer = require("nvim-tree")
7+
local function explorer_attach(bufnr)
8+
local api = require("nvim-tree.api")
9+
local function opts(desc)
10+
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
11+
end
12+
vim.keymap.set('n', '<CR>', api.node.open.tab, opts('New Tab'))
13+
vim.keymap.set('n', '<Right>', api.node.open.edit, opts('Open Folder'))
14+
vim.keymap.set('n', '<Left>', api.node.navigate.parent_close, opts('Close Folder'))
15+
vim.keymap.set('n', 'q', api.tree.close, opts('Close Folder'))
16+
vim.keymap.set('n', '<C-n>', api.fs.create, opts('Create File'))
17+
vim.keymap.set('n', '<C-x>', api.fs.cut, opts('Cut File'))
18+
vim.keymap.set('n', '<C-c>', api.fs.copy.node, opts('Copy File'))
19+
vim.keymap.set('n', '<C-v>', api.fs.paste, opts('Paste File'))
20+
vim.keymap.set('n', '<C-o>', api.node.open.tab, opts('Open File'))
21+
end
22+
explorer.setup({
23+
on_attach = explorer_attach,
24+
disable_netrw = true,
25+
hijack_netrw = true,
26+
diagnostics = {
27+
enable = false,
28+
show_on_dirs = false,
29+
},
30+
view = {
31+
width = 25,
32+
},
33+
renderer = {
34+
indent_markers = { enable = true },
35+
},
36+
actions = {
37+
open_file = {
38+
quit_on_open = false,
39+
window_picker = { enable = true },
40+
},
41+
},
42+
filters = {
43+
custom = { ".DS_Store", "/node_modules/", ".git" },
44+
},
45+
})
46+
end
47+
}

lua/user/keymaps.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ end
1010

1111
-- pre defined vscode key shortcuts.
1212
nmap("f","zc")
13-
nmap("<C-t>","<Esc>:NERDTree<CR>")
13+
nmap("<C-e>","<Esc>:NvimTreeFindFile<CR>")
1414
nmap("<C-q>","<Esc>:q!<CR>")
1515
imap("<C-q>","<Esc>:wq<CR>i")
1616
imap("<C-s>","<Esc>:w<CR>i")
@@ -20,4 +20,4 @@ imap("<C-r>","<Esc>:redo<CR>i")
2020
imap("<C-Up>","<Esc>:m-2<CR>gi")
2121
imap("<C-Down>","<Esc>:m+<CR>gi")
2222
imap("<C-c>","<Esc>yyi")
23-
imap("<C-p>","<Esc>pi")
23+
imap("<C-v>","<Esc>pi")

lua/user/options.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ vim.opt.swapfile = false
1515

1616
-- tabs and indents.
1717
vim.opt.tabstop = 2
18-
-- vim.opt.showtabline = 2 -- quick file tabs on the top.
18+
vim.opt.showtabline = 2 -- quick file tabs on the top.
1919
vim.opt.shiftwidth = 2
2020
vim.opt.expandtab = true
2121
vim.opt.smartindent = true

0 commit comments

Comments
 (0)