nvim-lua / kickstart.nvim

A launch point for your personal nvim configuration
MIT License
18.9k stars 21.67k forks source link

How can I open a folder with source code to start coding? #883

Closed jrichardsz closed 5 months ago

jrichardsz commented 5 months ago

I know this is not a issue of your starter.

But please help me to start a simple left tree editor.

I followed your readme.md and :Lazy works

image

But whats next?

I only need to have a simple left side tree browser and right side with editor like this

image

I researched but this is so simple that no one wrote a post

image

ChillerDragon commented 5 months ago

file browser plugin example

I use neo tree for that.

-- :Neotree to open it
-- docs for additional config:
-- https://github.com/nvim-neo-tree/neo-tree.nvim?tab=readme-ov-file#quickstart

return {
  'nvim-neo-tree/neo-tree.nvim',
  version = '*',
  dependencies = {
    'nvim-lua/plenary.nvim',
    'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
    'MunifTanjim/nui.nvim',
  },
  config = function()
    require('neo-tree').setup {
      filesystem = {
        filtered_items = {
          visible = true,
          hide_dotfiles = false,
          hide_gitignored = true,
        },
      }
    }
  end,
}

https://github.com/ChillerDragon/kickstart.nvim/blob/7652a9921cd9409728655c85670a3d147d7187f3/lua/custom/plugins/filetree.lua

And press <leader>ft to toggle it

vim.keymap.set('n', '<leader>ft', function()
  vim.cmd 'Neotree toggle'
end, { desc = '[F]ile [T]tree' })

https://github.com/ChillerDragon/kickstart.nvim/blob/7652a9921cd9409728655c85670a3d147d7187f3/lua/custom/chiller/keymaps.lua#L2-L4

plain kickstarter workflow

If you just type in nvim it opens the current folder by default. You can then press space+s+f (<leader>sf) to search for a file.

dam9000 commented 5 months ago

@jrichardsz The neo-tree plugin is already included in the kickstart repo but is commented out by default. All you need to do is uncomment the require 'kickstart.plugins.neo-tree' on line 880 in init.lua, here is a diff:

diff --git a/init.lua b/init.lua
index 036eefb..784f748 100644
--- a/init.lua
+++ b/init.lua
@@ -877,7 +877,7 @@ require('lazy').setup({
   -- require 'kickstart.plugins.indent_line',
   -- require 'kickstart.plugins.lint',
   -- require 'kickstart.plugins.autopairs',
-  -- require 'kickstart.plugins.neo-tree',
+  require 'kickstart.plugins.neo-tree',
   -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps

   -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`

Then restart nvim and press the key \ which is the default keymap for neo-tree, or type :Neotree. You can of course customize the keymaps to your liking.

feoh commented 5 months ago

Use neotree as described. Thanks for the issue!

jrichardsz commented 5 months ago

@jrichardsz The neo-tree plugin is already included in the kickstart repo but is commented out by default. All you need to do is uncomment the require 'kickstart.plugins.neo-tree' on line 880 in init.lua, here is a diff:

diff --git a/init.lua b/init.lua
index 036eefb..784f748 100644
--- a/init.lua
+++ b/init.lua
@@ -877,7 +877,7 @@ require('lazy').setup({
   -- require 'kickstart.plugins.indent_line',
   -- require 'kickstart.plugins.lint',
   -- require 'kickstart.plugins.autopairs',
-  -- require 'kickstart.plugins.neo-tree',
+  require 'kickstart.plugins.neo-tree',
   -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps

   -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`

Then restart nvim and press the key \ which is the default keymap for neo-tree, or type :Neotree. You can of course customize the keymaps to your liking.

Thanks it worked.

jrichardsz commented 5 months ago

file browser plugin example

I use neo tree for that.

-- :Neotree to open it
-- docs for additional config:
-- https://github.com/nvim-neo-tree/neo-tree.nvim?tab=readme-ov-file#quickstart

return {
  'nvim-neo-tree/neo-tree.nvim',
  version = '*',
  dependencies = {
    'nvim-lua/plenary.nvim',
    'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
    'MunifTanjim/nui.nvim',
  },
  config = function()
    require('neo-tree').setup {
      filesystem = {
        filtered_items = {
          visible = true,
          hide_dotfiles = false,
          hide_gitignored = true,
        },
      }
    }
  end,
}

https://github.com/ChillerDragon/kickstart.nvim/blob/7652a9921cd9409728655c85670a3d147d7187f3/lua/custom/plugins/filetree.lua

And press <leader>ft to toggle it

vim.keymap.set('n', '<leader>ft', function()
  vim.cmd 'Neotree toggle'
end, { desc = '[F]ile [T]tree' })

https://github.com/ChillerDragon/kickstart.nvim/blob/7652a9921cd9409728655c85670a3d147d7187f3/lua/custom/chiller/keymaps.lua#L2-L4

plain kickstarter workflow

If you just type in nvim it opens the current folder by default. You can then press space+s+f (<leader>sf) to search for a file.

Neo Tree works very well. Thank you!