Skip to content

Commit 251f422

Browse files
update neotree to be the default file explorer
1 parent 83795a2 commit 251f422

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ require('lazy').setup({
673673
-- https://github.com/pmizio/typescript-tools.nvim
674674
--
675675
-- But for many setups, the LSP (`tsserver`) will work just fine
676-
tsserver = {
676+
ts_ls = {
677677
javascript = {
678678
inlayHints = {
679679
includeInlayEnumMemberValueHints = true,

lua/custom/plugins/mini.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
return { 'echasnovski/mini.nvim', version = false }

lua/kickstart/plugins/neo-tree.lua

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,40 @@ return {
1313
keys = {
1414
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
1515
},
16+
init = function()
17+
vim.api.nvim_create_autocmd('BufNewFile', {
18+
group = vim.api.nvim_create_augroup('RemoteFile', { clear = true }),
19+
callback = function()
20+
local f = vim.fn.expand '%:p'
21+
for _, v in ipairs { 'sftp', 'scp', 'ssh', 'dav', 'fetch', 'ftp', 'http', 'rcp', 'rsync' } do
22+
local p = v .. '://'
23+
if string.sub(f, 1, #p) == p then
24+
vim.cmd [[
25+
unlet g:loaded_netrw
26+
unlet g:loaded_netrwPlugin
27+
runtime! plugin/netrwPlugin.vim
28+
silent Explore %
29+
]]
30+
vim.api.nvim_clear_autocmds { group = 'RemoteFile' }
31+
break
32+
end
33+
end
34+
end,
35+
})
36+
vim.api.nvim_create_autocmd('BufEnter', {
37+
group = vim.api.nvim_create_augroup('NeoTreeInit', { clear = true }),
38+
callback = function()
39+
local f = vim.fn.expand '%:p'
40+
if vim.fn.isdirectory(f) ~= 0 then
41+
vim.cmd('Neotree current dir=' .. f)
42+
vim.api.nvim_clear_autocmds { group = 'NeoTreeInit' }
43+
end
44+
end,
45+
})
46+
end,
1647
opts = {
1748
filesystem = {
49+
hijack_netrw_behavior = 'open_current',
1850
window = {
1951
mappings = {
2052
['\\'] = 'close_window',

0 commit comments

Comments
 (0)