add nvim config
This commit is contained in:
3
nvim/.config/nvim/init.lua
Normal file
3
nvim/.config/nvim/init.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
require("config.options")
|
||||||
|
require("config.lazy")
|
||||||
|
|
||||||
16
nvim/.config/nvim/lazy-lock.json
Normal file
16
nvim/.config/nvim/lazy-lock.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"catppuccin": { "branch": "main", "commit": "30fa4d122d9b22ad8b2e0ab1b533c8c26c4dde86" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||||
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "cea666ef965884414b1b71f6b39a537f9238bdb2" },
|
||||||
|
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "cb33dea610b7eff240985be9f6fe219920e630ef" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "4ae47f4fb18e85b80e84b729974fe65483b06aaf" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
|
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||||
|
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
|
||||||
|
}
|
||||||
35
nvim/.config/nvim/lua/config/lazy.lua
Normal file
35
nvim/.config/nvim/lua/config/lazy.lua
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
-- Bootstrap lazy.nvim
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||||
|
-- loading lazy.nvim so that mappings are correct.
|
||||||
|
-- This is also a good place to setup other settings (vim.opt)
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
|
-- Setup lazy.nvim
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- import your plugins
|
||||||
|
{ import = "plugins" },
|
||||||
|
},
|
||||||
|
-- Configure any other settings here. See the documentation for more details.
|
||||||
|
-- colorscheme that will be used when installing plugins.
|
||||||
|
install = { colorscheme = { "habamax" } },
|
||||||
|
-- automatically check for plugin updates
|
||||||
|
checker = { enabled = true },
|
||||||
|
})
|
||||||
5
nvim/.config/nvim/lua/config/options.lua
Normal file
5
nvim/.config/nvim/lua/config/options.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
vim.cmd("set expandtab")
|
||||||
|
vim.cmd("set tabstop=2")
|
||||||
|
vim.cmd("set softtabstop=2")
|
||||||
|
vim.cmd("set shiftwidth=2")
|
||||||
|
vim.cmd("set number")
|
||||||
5
nvim/.config/nvim/lua/plugins/.luarc.json
Normal file
5
nvim/.config/nvim/lua/plugins/.luarc.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"diagnostics.globals": [
|
||||||
|
"vim"
|
||||||
|
]
|
||||||
|
}
|
||||||
10
nvim/.config/nvim/lua/plugins/colorscheme.lua
Normal file
10
nvim/.config/nvim/lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"catppuccin/nvim",
|
||||||
|
name = "catppuccin",
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
vim.cmd.colorscheme("catppuccin-mocha")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
32
nvim/.config/nvim/lua/plugins/lsp-config.lua
Normal file
32
nvim/.config/nvim/lua/plugins/lsp-config.lua
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"mason-org/mason.nvim",
|
||||||
|
version = "^1.0.0",
|
||||||
|
config = function()
|
||||||
|
require('mason').setup()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mason-org/mason-lspconfig.nvim",
|
||||||
|
version = "^1.0.0",
|
||||||
|
opts = {},
|
||||||
|
config = function()
|
||||||
|
require('mason-lspconfig').setup({
|
||||||
|
ensure_installed = { "lua_ls", "ts_ls" }
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
version = "^1.0.0",
|
||||||
|
config = function()
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
lspconfig.lua_ls.setup({})
|
||||||
|
lspconfig.ts_ls.setup({})
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, {})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
12
nvim/.config/nvim/lua/plugins/lualine.lua
Normal file
12
nvim/.config/nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require('lualine').setup({
|
||||||
|
options = {
|
||||||
|
theme = 'dracula'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
48
nvim/.config/nvim/lua/plugins/neotree.lua
Normal file
48
nvim/.config/nvim/lua/plugins/neotree.lua
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v3.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons", -- optional, but recommended
|
||||||
|
},
|
||||||
|
lazy = false, -- neo-tree will lazily load itself
|
||||||
|
opts = {
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
visible = true,
|
||||||
|
hide_dotfiles = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require('neo-tree').setup(opts)
|
||||||
|
vim.keymap.set('n', '<C-n>', '<CMD>Neotree toggle<CR>', {})
|
||||||
|
-- Option 2: More targeted - only when opening actual files
|
||||||
|
vim.api.nvim_create_autocmd({"BufReadPost", "BufNewFile"}, {
|
||||||
|
callback = function()
|
||||||
|
-- Check if it's a real file (has a name and isn't a special buffer)
|
||||||
|
local bufname = vim.api.nvim_buf_get_name(0)
|
||||||
|
if bufname == "" or vim.bo.buftype ~= "" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Skip if neo-tree is already visible
|
||||||
|
local manager = require("neo-tree.sources.manager")
|
||||||
|
local state = manager.get_state("filesystem")
|
||||||
|
if state.tree and state.tree.visible then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("neo-tree.command").execute({ action = "show", source = "filesystem" })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
14
nvim/.config/nvim/lua/plugins/snacks.lua
Normal file
14
nvim/.config/nvim/lua/plugins/snacks.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
return {
|
||||||
|
"folke/snacks.nvim",
|
||||||
|
opts = {
|
||||||
|
dashboard = {
|
||||||
|
sections = {
|
||||||
|
{ section = "header" },
|
||||||
|
{ icon = " ", title = "Keymaps", section = "keys", indent = 2, padding = 1 },
|
||||||
|
{ icon = " ", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 },
|
||||||
|
{ icon = " ", title = "Projects", section = "projects", indent = 2, padding = 1 },
|
||||||
|
{ section = "startup" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
34
nvim/.config/nvim/lua/plugins/telescope.lua
Normal file
34
nvim/.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim', tag = '0.1.8',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
layout_strategy = 'flex',
|
||||||
|
layout_config = { width = 0.95 },
|
||||||
|
path_display = { 'smart' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<C-p>', builtin.find_files, { desc = 'Telescope find files' })
|
||||||
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||||
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||||
|
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-ui-select.nvim",
|
||||||
|
config = function()
|
||||||
|
require("telescope").setup({
|
||||||
|
extensions = {
|
||||||
|
["ui-select"] = {
|
||||||
|
require("telescope.themes").get_dropdown {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
require("telescope").load_extension("ui-select")
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
16
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
16
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
branch = 'master',
|
||||||
|
lazy = false,
|
||||||
|
build = ":TSUpdate",
|
||||||
|
config = function()
|
||||||
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
configs.setup({
|
||||||
|
ensure_installed = {"c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "javascript", "typescript", "python", "html", "css"},
|
||||||
|
highlight = { enabled = true },
|
||||||
|
indent = { enabled = true },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user