made some changes
This commit is contained in:
parent
1f52835a7b
commit
63e5f7b074
255
init.lua
255
init.lua
|
@ -1,10 +1,10 @@
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
require('settings')
|
require 'settings'
|
||||||
require('keymaps')
|
require 'keymaps'
|
||||||
|
|
||||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||||
|
@ -14,23 +14,24 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require('lazy').setup({
|
require('lazy').setup {
|
||||||
{
|
------------------------------------------------------------------------------
|
||||||
'tpope/vim-sleuth', -- Automatically set the 'shiftwidth' and 'expandtab' options based on the current file
|
-- 1. Basic Plugins & Utilities
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
{ -- Automatically adjust shiftwidth and expandtab
|
||||||
|
'tpope/vim-sleuth',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'lewis6991/gitsigns.nvim', -- Git signs in the sign column
|
{ -- Gitsigns: Display Git changes and blame
|
||||||
opts = {
|
'lewis6991/gitsigns.nvim',
|
||||||
signs = {
|
config = function()
|
||||||
add = { text = '+' },
|
require('gitsigns').setup {
|
||||||
change = { text = '' },
|
current_line_blame = true,
|
||||||
delete = { text = '_' },
|
}
|
||||||
topdelete = { text = '‾' },
|
end,
|
||||||
changedelete = { text = '' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
|
||||||
|
{ -- Which-key: Shows available keybindings
|
||||||
'folke/which-key.nvim',
|
'folke/which-key.nvim',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
opts = {
|
opts = {
|
||||||
|
@ -68,23 +69,29 @@ require('lazy').setup({
|
||||||
F12 = '<F12>',
|
F12 = '<F12>',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
spec = {
|
spec = {
|
||||||
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
||||||
{ '<leader>d', group = '[D]ocument' },
|
{ '<leader>d', group = '[D]ocument' },
|
||||||
{ '<leader>r', group = '[R]ename' },
|
{ '<leader>r', group = '[R]ename' },
|
||||||
{ '<leader>s', group = '[S]earch' },
|
{ '<leader>s', group = '[S]earch' },
|
||||||
{ '<leader>w', group = '[W]orkspace' },
|
{ '<leader>w', group = '[W]orkspace' },
|
||||||
{ '<leader>t', group = '[T]oggle' },
|
{ '<leader>t', group = '[T]oggle' },
|
||||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
|
{ -- Nvim-tree: File explorer with keybinding
|
||||||
'nvim-tree/nvim-tree.lua',
|
'nvim-tree/nvim-tree.lua',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
config = function()
|
config = function()
|
||||||
require('nvim-tree').setup {
|
require('nvim-tree').setup {
|
||||||
|
filters = {
|
||||||
|
dotfiles = false, -- Keep this false to show dotfiles, or true to hide all dotfiles
|
||||||
|
custom = { '^.git$' }, -- Hide .git folder
|
||||||
|
},
|
||||||
renderer = {
|
renderer = {
|
||||||
|
root_folder_label = false, -- Remove the `~` indicator at the top
|
||||||
icons = {
|
icons = {
|
||||||
glyphs = {
|
glyphs = {
|
||||||
default = '',
|
default = '',
|
||||||
|
@ -114,27 +121,67 @@ require('lazy').setup({
|
||||||
vim.keymap.set('n', '<leader>e', '<cmd>NvimTreeToggle<CR>', { desc = 'Toggle File Explorer' })
|
vim.keymap.set('n', '<leader>e', '<cmd>NvimTreeToggle<CR>', { desc = 'Toggle File Explorer' })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'wakatime/vim-wakatime',
|
{ 'wakatime/vim-wakatime' },
|
||||||
},
|
{ 'github/copilot.vim' },
|
||||||
{
|
|
||||||
'github/copilot.vim',
|
------------------------------------------------------------------------------
|
||||||
},
|
-- 2. Formatting & Linting
|
||||||
{
|
------------------------------------------------------------------------------
|
||||||
|
{ -- null-ls: Integrates external formatters and linters
|
||||||
'jose-elias-alvarez/null-ls.nvim',
|
'jose-elias-alvarez/null-ls.nvim',
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
config = function()
|
config = function()
|
||||||
local null_ls = require 'null-ls'
|
local null_ls = require 'null-ls'
|
||||||
null_ls.setup {
|
null_ls.setup {
|
||||||
sources = {
|
sources = {
|
||||||
null_ls.builtins.formatting.prettier,
|
null_ls.builtins.formatting.stylua, -- Stylua for Lua formatting (ensure it's installed in your PATH)
|
||||||
|
null_ls.builtins.formatting.prettier, -- Prettier for HTML, JavaScript, etc.
|
||||||
null_ls.builtins.diagnostics.eslint,
|
null_ls.builtins.diagnostics.eslint,
|
||||||
null_ls.builtins.code_actions.eslint,
|
null_ls.builtins.code_actions.eslint,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
|
{ -- Conform: Format on save using external formatters
|
||||||
|
'stevearc/conform.nvim',
|
||||||
|
event = { 'BufWritePre' },
|
||||||
|
cmd = { 'ConformInfo' },
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>f',
|
||||||
|
function()
|
||||||
|
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||||
|
end,
|
||||||
|
mode = '',
|
||||||
|
desc = '[F]ormat buffer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
notify_on_error = false,
|
||||||
|
format_on_save = function(bufnr)
|
||||||
|
local disable_filetypes = { c = true, cpp = true }
|
||||||
|
return {
|
||||||
|
timeout_ms = 500,
|
||||||
|
lsp_format = disable_filetypes[vim.bo[bufnr].filetype] and 'never' or 'fallback',
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { 'stylua' }, -- Use stylua for Lua
|
||||||
|
javascript = { 'prettier' },
|
||||||
|
typescript = { 'prettier' },
|
||||||
|
css = { 'prettier' },
|
||||||
|
scss = { 'prettier' },
|
||||||
|
html = { 'prettier' }, -- Use prettier for HTML
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
-- 3. Statusline, Debugging, & Miscellaneous Utilities
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
{ -- Lualine: Statusline
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
config = function()
|
config = function()
|
||||||
|
@ -155,24 +202,16 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'lewis6991/gitsigns.nvim',
|
{ -- nvim-dap: Debug Adapter Protocol for debugging JavaScript
|
||||||
config = function()
|
|
||||||
require('gitsigns').setup {
|
|
||||||
current_line_blame = true,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
dap.adapters.node2 = {
|
dap.adapters.node2 = {
|
||||||
type = 'executable',
|
type = 'executable',
|
||||||
command = 'node',
|
command = 'node',
|
||||||
args = { os.getenv 'HOME' .. '/.local/share/nvim/mason/packages/node-debug2-adapter/out/src/nodeDebug.js' },
|
args = { os.getenv 'HOME' .. '/.local/share/nvim/mason/packages/node-debug2-adapter/out/src/nodeDebug.js' },
|
||||||
}
|
}
|
||||||
|
|
||||||
dap.configurations.javascript = {
|
dap.configurations.javascript = {
|
||||||
{
|
{
|
||||||
name = 'Launch Node.js',
|
name = 'Launch Node.js',
|
||||||
|
@ -188,14 +227,14 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ -- Comment.nvim: Easily comment code
|
||||||
'numToStr/Comment.nvim',
|
'numToStr/Comment.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
require('Comment').setup()
|
require('Comment').setup()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ -- nvim-autopairs: Automatically complete pairs
|
||||||
'windwp/nvim-autopairs',
|
'windwp/nvim-autopairs',
|
||||||
event = 'InsertEnter',
|
event = 'InsertEnter',
|
||||||
config = function()
|
config = function()
|
||||||
|
@ -203,20 +242,21 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ -- Spectre: Search and replace tool
|
||||||
'nvim-pack/nvim-spectre',
|
'nvim-pack/nvim-spectre',
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
config = function()
|
config = function()
|
||||||
require('spectre').setup()
|
require('spectre').setup()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
|
{ -- Telescope: Fuzzy finder and more
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
branch = '0.1.x',
|
branch = '0.1.x',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
{
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
build = 'make',
|
build = 'make',
|
||||||
cond = function()
|
cond = function()
|
||||||
|
@ -234,9 +274,8 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
pcall(require('telescope').load_extension, 'ui-select')
|
pcall(require('telescope').load_extension, 'ui-select')
|
||||||
|
|
||||||
local builtin = require 'telescope.builtin'
|
local builtin = require 'telescope.builtin'
|
||||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||||
|
@ -248,28 +287,25 @@ require('lazy').setup({
|
||||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>/', function()
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
winblend = 10,
|
winblend = 10,
|
||||||
previewer = false,
|
previewer = false,
|
||||||
})
|
})
|
||||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>s/', function()
|
vim.keymap.set('n', '<leader>s/', function()
|
||||||
builtin.live_grep {
|
builtin.live_grep {
|
||||||
grep_open_files = true,
|
grep_open_files = true,
|
||||||
prompt_title = 'Live Grep in Open Files',
|
prompt_title = 'Live Grep in Open Files',
|
||||||
}
|
}
|
||||||
end, { desc = '[S]earch [/] in Open Files' })
|
end, { desc = '[S]earch [/] in Open Files' })
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>sn', function()
|
vim.keymap.set('n', '<leader>sn', function()
|
||||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||||
end, { desc = '[S]earch [N]eovim files' })
|
end, { desc = '[S]earch [N]eovim files' })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ -- Lazydev: For developing local Lua plugins with lazy.nvim
|
||||||
'folke/lazydev.nvim',
|
'folke/lazydev.nvim',
|
||||||
ft = 'lua',
|
ft = 'lua',
|
||||||
opts = {
|
opts = {
|
||||||
|
@ -278,10 +314,14 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
-- 4. LSP & Autocompletion Configuration
|
||||||
|
------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ 'williamboman/mason.nvim', opts = {} },
|
{ 'williamboman/mason.nvim', opts = { ensure_installed = { 'prettier', 'stylua', 'eslint', 'eslint_d' } } },
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
@ -289,13 +329,13 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require('mason').setup()
|
require('mason').setup()
|
||||||
|
-- Added 'html' to the list of LSP servers for HTML intellisense.
|
||||||
require('mason-lspconfig').setup {
|
require('mason-lspconfig').setup {
|
||||||
ensure_installed = { 'ts_ls', 'tailwindcss', 'cssls', 'lua_ls' },
|
ensure_installed = { 'ts_ls', 'tailwindcss', 'cssls', 'lua_ls', 'html' },
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
}
|
}
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||||
|
|
||||||
if vim.g.have_nerd_font then
|
if vim.g.have_nerd_font then
|
||||||
local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
|
local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
|
||||||
for type, icon in pairs(signs) do
|
for type, icon in pairs(signs) do
|
||||||
|
@ -303,16 +343,13 @@ require('lazy').setup({
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local servers = {
|
local servers = {
|
||||||
ts_ls = {
|
ts_ls = {
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
client.server_capabilities.documentFormattingProvider = false
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
|
|
||||||
local map = function(keys, func, desc)
|
local map = function(keys, func, desc)
|
||||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = 'LSP: ' .. desc })
|
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = 'LSP: ' .. desc })
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
|
@ -322,7 +359,6 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
map('<leader>oi', function()
|
map('<leader>oi', function()
|
||||||
vim.lsp.buf.code_action {
|
vim.lsp.buf.code_action {
|
||||||
context = { only = { 'source.organizeImports' }, diagnostics = {} },
|
context = { only = { 'source.organizeImports' }, diagnostics = {} },
|
||||||
|
@ -352,11 +388,10 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
html = {}, -- HTML LSP for intellisense
|
||||||
}
|
}
|
||||||
|
|
||||||
local ensure_installed = vim.tbl_keys(servers)
|
local ensure_installed = vim.tbl_keys(servers)
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
require('mason-lspconfig').setup {
|
require('mason-lspconfig').setup {
|
||||||
ensure_installed = ensure_installed,
|
ensure_installed = ensure_installed,
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
|
@ -370,40 +405,8 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'stevearc/conform.nvim',
|
{ -- nvim-cmp: Autocompletion engine configuration
|
||||||
event = { 'BufWritePre' },
|
|
||||||
cmd = { 'ConformInfo' },
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
'<leader>f',
|
|
||||||
function()
|
|
||||||
require('conform').format { async = true, lsp_format = 'fallback' }
|
|
||||||
end,
|
|
||||||
mode = '',
|
|
||||||
desc = '[F]ormat buffer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
notify_on_error = false,
|
|
||||||
format_on_save = function(bufnr)
|
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
|
||||||
return {
|
|
||||||
timeout_ms = 500,
|
|
||||||
lsp_format = disable_filetypes[vim.bo[bufnr].filetype] and 'never' or 'fallback',
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
formatters_by_ft = {
|
|
||||||
lua = { 'stylua' },
|
|
||||||
javascript = { 'prettier' },
|
|
||||||
typescript = { 'prettier' },
|
|
||||||
css = { 'prettier' },
|
|
||||||
scss = { 'prettier' },
|
|
||||||
html = { 'prettier' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
event = 'InsertEnter',
|
event = 'InsertEnter',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
@ -426,14 +429,13 @@ require('lazy').setup({
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
local luasnip = require 'luasnip'
|
local luasnip = require 'luasnip'
|
||||||
luasnip.config.setup {}
|
luasnip.config.setup {}
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
luasnip.lsp_expand(args.body)
|
luasnip.lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
completion = { completeopt = 'menu,menuone,noinsert' },
|
||||||
|
|
||||||
mapping = cmp.mapping.preset.insert {
|
mapping = cmp.mapping.preset.insert {
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
@ -452,7 +454,6 @@ require('lazy').setup({
|
||||||
end
|
end
|
||||||
end, { 'i', 's' }),
|
end, { 'i', 's' }),
|
||||||
},
|
},
|
||||||
|
|
||||||
sources = cmp.config.sources {
|
sources = cmp.config.sources {
|
||||||
{ name = 'lazydev', group_index = 0 },
|
{ name = 'lazydev', group_index = 0 },
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
|
@ -463,47 +464,45 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ -- 🎨 Colorscheme
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
-- 5. Look & Feel: Colorscheme, Todo Comments, and Mini Plugins
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
{ -- Colorscheme: Tokyonight with custom settings
|
||||||
'folke/tokyonight.nvim',
|
'folke/tokyonight.nvim',
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
init = function()
|
init = function()
|
||||||
-- Load colorscheme with specific style
|
|
||||||
vim.cmd.colorscheme 'tokyonight-night'
|
vim.cmd.colorscheme 'tokyonight-night'
|
||||||
-- Customize Comment color (removes italic)
|
|
||||||
vim.cmd.hi 'Comment gui=none'
|
vim.cmd.hi 'Comment gui=none'
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- ✅ Highlight TODOs, FIXMEs, and other comments
|
|
||||||
{
|
{ -- Todo-comments: Highlight TODOs and FIXMEs
|
||||||
'folke/todo-comments.nvim',
|
'folke/todo-comments.nvim',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
opts = { signs = false },
|
opts = { signs = false },
|
||||||
},
|
},
|
||||||
{ -- 🛠️ mini.nvim utility plugins (better text objects, surround, and statusline)
|
|
||||||
|
{ -- mini.nvim: Additional utilities (text objects, surround, statusline)
|
||||||
'echasnovski/mini.nvim',
|
'echasnovski/mini.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
-- Setup mini.ai for better text objects
|
require('mini.ai').setup { n_lines = 500 }
|
||||||
require('mini.ai').setup {
|
|
||||||
n_lines = 500,
|
|
||||||
}
|
|
||||||
-- Setup mini.surround for surrounding text objects
|
|
||||||
require('mini.surround').setup()
|
require('mini.surround').setup()
|
||||||
|
|
||||||
-- Setup mini.statusline for a better status line
|
|
||||||
require('mini.statusline').setup {
|
require('mini.statusline').setup {
|
||||||
use_icons = vim.g.have_nerd_font,
|
use_icons = vim.g.have_nerd_font,
|
||||||
content = {
|
content = {
|
||||||
active = function()
|
active = function()
|
||||||
return '%2l:%-2v' -- line:column display
|
return '%2l:%-2v'
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
|
{ -- Treesitter: Improved syntax highlighting and more
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
build = ':tsupdate',
|
build = ':TSUpdate',
|
||||||
main = 'nvim-treesitter.configs',
|
main = 'nvim-treesitter.configs',
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
|
@ -525,13 +524,15 @@ require('lazy').setup({
|
||||||
'vimdoc',
|
'vimdoc',
|
||||||
},
|
},
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
highlight = { enable = true, additional_vim_regex_highlighting = { 'ruby' } },
|
||||||
enable = true,
|
|
||||||
additional_vim_regex_highlighting = { 'ruby' },
|
|
||||||
},
|
|
||||||
indent = { enable = true, disable = { 'ruby' } },
|
indent = { enable = true, disable = { 'ruby' } },
|
||||||
|
fold = { enable = true }, -- Enable Treesitter-based folding
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
-- 6. UI Extras
|
||||||
|
------------------------------------------------------------------------------
|
||||||
ui = {
|
ui = {
|
||||||
icons = vim.g.have_nerd_font and {} or {
|
icons = vim.g.have_nerd_font and {} or {
|
||||||
cmd = '⌘',
|
cmd = '⌘',
|
||||||
|
@ -549,4 +550,4 @@ require('lazy').setup({
|
||||||
lazy = '💤 ',
|
lazy = '💤 ',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
|
@ -8,23 +8,23 @@
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" },
|
"conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" },
|
||||||
"copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" },
|
"copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" },
|
||||||
"fidget.nvim": { "branch": "main", "commit": "3fa10de61546fd0a98faac3084a6c0db612adaf8" },
|
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "9772ce68a9a6d156f3f2166bfd0a17a09ab37eba" },
|
"gitsigns.nvim": { "branch": "main", "commit": "c23bbd3ed2c7a3fdc3399e97e24f9e158f57612f" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "7527af40ddd4a93a02911be570b32609b9d4ea53" },
|
"lazy.nvim": { "branch": "main", "commit": "f15a93907ddad3d9139aea465ae18336d87f5ce6" },
|
||||||
"lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" },
|
"lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" },
|
||||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "374c78d3ebb5c53f43ea6bd906b6587b5e899b9e" },
|
"mason-tool-installer.nvim": { "branch": "main", "commit": "374c78d3ebb5c53f43ea6bd906b6587b5e899b9e" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||||
"mini.nvim": { "branch": "main", "commit": "87fc38a8a2b8d498cecb021d057a38ea2e9f5a79" },
|
"mini.nvim": { "branch": "main", "commit": "d479cf109eeff8a7e0bf978079ea1dd2171648a0" },
|
||||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "3d02855468f94bf435db41b661b58ec4f48a06b7" },
|
"nvim-autopairs": { "branch": "master", "commit": "3d02855468f94bf435db41b661b58ec4f48a06b7" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "12b846bedbc7221e833b5e6611de21917d7d9184" },
|
"nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "66bc018936c6ff76beb75f89d986af6442db4001" },
|
"nvim-lspconfig": { "branch": "master", "commit": "75edb91a3d2deabe76a9911cde2c13d411b3b097" },
|
||||||
"nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" },
|
"nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "70825f23db61ecd900c4cfea169bffe931926a9d" },
|
"nvim-tree.lua": { "branch": "master", "commit": "70825f23db61ecd900c4cfea169bffe931926a9d" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "9e0b5e7f0d148963d6ec71c48cec1a3f8607d619" },
|
"nvim-treesitter": { "branch": "master", "commit": "62911c78a868bac24c8a86f2c1c412d0b799f885" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" },
|
"nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
|
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
|
||||||
|
|
|
@ -21,3 +21,10 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
vim.highlight.on_yank()
|
vim.highlight.on_yank()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Keybindings for folding
|
||||||
|
vim.keymap.set('n', 'zc', 'zc', { desc = 'Close fold' }) -- Collapse current fold
|
||||||
|
vim.keymap.set('n', 'zo', 'zo', { desc = 'Open fold' }) -- Open current fold
|
||||||
|
vim.keymap.set('n', 'za', 'za', { desc = 'Toggle fold' }) -- Toggle fold open/close
|
||||||
|
vim.keymap.set('n', 'zR', 'zR', { desc = 'Open all folds' }) -- Open all folds
|
||||||
|
vim.keymap.set('n', 'zM', 'zM', { desc = 'Close all folds' }) -- Close all folds
|
||||||
|
|
540
lua/plugins.lua
540
lua/plugins.lua
|
@ -1,540 +0,0 @@
|
||||||
-- local M = {}
|
|
||||||
--
|
|
||||||
-- M.spec = {
|
|
||||||
-- {
|
|
||||||
-- 'tpope/vim-sleuth', -- Automatically set the 'shiftwidth' and 'expandtab' options based on the current file
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'lewis6991/gitsigns.nvim', -- Git signs in the sign column
|
|
||||||
-- opts = {
|
|
||||||
-- signs = {
|
|
||||||
-- add = { text = '+' },
|
|
||||||
-- change = { text = '' },
|
|
||||||
-- delete = { text = '_' },
|
|
||||||
-- topdelete = { text = '‾' },
|
|
||||||
-- changedelete = { text = '' },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'folke/which-key.nvim',
|
|
||||||
-- event = 'VimEnter',
|
|
||||||
-- opts = {
|
|
||||||
-- delay = 0,
|
|
||||||
-- icons = {
|
|
||||||
-- mappings = vim.g.have_nerd_font,
|
|
||||||
-- keys = vim.g.have_nerd_font and {} or {
|
|
||||||
-- Up = '<Up> ',
|
|
||||||
-- Down = '<Down> ',
|
|
||||||
-- Left = '<Left> ',
|
|
||||||
-- Right = '<Right> ',
|
|
||||||
-- C = '<C-…> ',
|
|
||||||
-- M = '<M-…> ',
|
|
||||||
-- D = '<D-…> ',
|
|
||||||
-- S = '<S-…> ',
|
|
||||||
-- CR = '<CR> ',
|
|
||||||
-- Esc = '<Esc> ',
|
|
||||||
-- ScrollWheelDown = '<ScrollWheelDown> ',
|
|
||||||
-- ScrollWheelUp = '<ScrollWheelUp> ',
|
|
||||||
-- NL = '<NL> ',
|
|
||||||
-- BS = '<BS> ',
|
|
||||||
-- Space = '<Space> ',
|
|
||||||
-- Tab = '<Tab> ',
|
|
||||||
-- F1 = '<F1>',
|
|
||||||
-- F2 = '<F2>',
|
|
||||||
-- F3 = '<F3>',
|
|
||||||
-- F4 = '<F4>',
|
|
||||||
-- F5 = '<F5>',
|
|
||||||
-- F6 = '<F6>',
|
|
||||||
-- F7 = '<F7>',
|
|
||||||
-- F8 = '<F8>',
|
|
||||||
-- F9 = '<F9>',
|
|
||||||
-- F10 = '<F10>',
|
|
||||||
-- F11 = '<F11>',
|
|
||||||
-- F12 = '<F12>',
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- spec = {
|
|
||||||
-- { '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
|
||||||
-- { '<leader>d', group = '[D]ocument' },
|
|
||||||
-- { '<leader>r', group = '[R]ename' },
|
|
||||||
-- { '<leader>s', group = '[S]earch' },
|
|
||||||
-- { '<leader>w', group = '[W]orkspace' },
|
|
||||||
-- { '<leader>t', group = '[T]oggle' },
|
|
||||||
-- { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'nvim-tree/nvim-tree.lua',
|
|
||||||
-- event = 'VimEnter',
|
|
||||||
-- config = function()
|
|
||||||
-- require('nvim-tree').setup {
|
|
||||||
-- renderer = {
|
|
||||||
-- icons = {
|
|
||||||
-- glyphs = {
|
|
||||||
-- default = '',
|
|
||||||
-- symlink = '',
|
|
||||||
-- folder = {
|
|
||||||
-- arrow_open = '',
|
|
||||||
-- arrow_closed = '',
|
|
||||||
-- default = '',
|
|
||||||
-- open = '',
|
|
||||||
-- empty = '',
|
|
||||||
-- empty_open = '',
|
|
||||||
-- symlink = '',
|
|
||||||
-- },
|
|
||||||
-- git = {
|
|
||||||
-- unstaged = '✗',
|
|
||||||
-- staged = '✓',
|
|
||||||
-- unmerged = '',
|
|
||||||
-- renamed = '➜',
|
|
||||||
-- untracked = '★',
|
|
||||||
-- deleted = '',
|
|
||||||
-- ignored = '◌',
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
-- vim.keymap.set('n', '<leader>e', '<cmd>NvimTreeToggle<CR>', { desc = 'Toggle File Explorer' })
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'wakatime/vim-wakatime',
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'github/copilot.vim',
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'jose-elias-alvarez/null-ls.nvim',
|
|
||||||
-- dependencies = { 'nvim-lua/plenary.nvim' },
|
|
||||||
-- config = function()
|
|
||||||
-- local null_ls = require 'null-ls'
|
|
||||||
-- null_ls.setup {
|
|
||||||
-- sources = {
|
|
||||||
-- null_ls.builtins.formatting.prettier,
|
|
||||||
-- null_ls.builtins.diagnostics.eslint,
|
|
||||||
-- null_ls.builtins.code_actions.eslint,
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'nvim-lualine/lualine.nvim',
|
|
||||||
-- dependencies = { 'nvim-tree/nvim-web-devicons' },
|
|
||||||
-- config = function()
|
|
||||||
-- require('lualine').setup {
|
|
||||||
-- options = {
|
|
||||||
-- theme = 'auto',
|
|
||||||
-- section_separators = '',
|
|
||||||
-- component_separators = '',
|
|
||||||
-- },
|
|
||||||
-- sections = {
|
|
||||||
-- lualine_a = { 'mode' },
|
|
||||||
-- lualine_b = { 'branch', 'diff', 'diagnostics' },
|
|
||||||
-- lualine_c = { 'filename' },
|
|
||||||
-- lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
|
||||||
-- lualine_y = { 'progress' },
|
|
||||||
-- lualine_z = { 'location' },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'lewis6991/gitsigns.nvim',
|
|
||||||
-- config = function()
|
|
||||||
-- require('gitsigns').setup {
|
|
||||||
-- current_line_blame = true,
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'mfussenegger/nvim-dap',
|
|
||||||
-- config = function()
|
|
||||||
-- local dap = require 'dap'
|
|
||||||
-- dap.adapters.node2 = {
|
|
||||||
-- type = 'executable',
|
|
||||||
-- command = 'node',
|
|
||||||
-- args = { os.getenv 'HOME' .. '/.local/share/nvim/mason/packages/node-debug2-adapter/out/src/nodeDebug.js' },
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- dap.configurations.javascript = {
|
|
||||||
-- {
|
|
||||||
-- name = 'Launch Node.js',
|
|
||||||
-- type = 'node2',
|
|
||||||
-- request = 'launch',
|
|
||||||
-- program = '${file}',
|
|
||||||
-- cwd = vim.fn.getcwd(),
|
|
||||||
-- sourceMaps = true,
|
|
||||||
-- protocol = 'inspector',
|
|
||||||
-- console = 'integratedTerminal',
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- {
|
|
||||||
-- 'numToStr/Comment.nvim',
|
|
||||||
-- config = function()
|
|
||||||
-- require('Comment').setup()
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- {
|
|
||||||
-- 'windwp/nvim-autopairs',
|
|
||||||
-- event = 'InsertEnter',
|
|
||||||
-- config = function()
|
|
||||||
-- require('nvim-autopairs').setup {}
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- {
|
|
||||||
-- 'nvim-pack/nvim-spectre',
|
|
||||||
-- dependencies = { 'nvim-lua/plenary.nvim' },
|
|
||||||
-- config = function()
|
|
||||||
-- require('spectre').setup()
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'nvim-telescope/telescope.nvim',
|
|
||||||
-- event = 'VimEnter',
|
|
||||||
-- branch = '0.1.x',
|
|
||||||
-- dependencies = {
|
|
||||||
-- 'nvim-lua/plenary.nvim',
|
|
||||||
-- { -- If encountering errors, see telescope-fzf-native README for installation instructions
|
|
||||||
-- 'nvim-telescope/telescope-fzf-native.nvim',
|
|
||||||
-- build = 'make',
|
|
||||||
-- cond = function()
|
|
||||||
-- return vim.fn.executable 'make' == 1
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- { 'nvim-telescope/telescope-ui-select.nvim' },
|
|
||||||
-- { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
|
||||||
-- },
|
|
||||||
-- config = function()
|
|
||||||
-- require('telescope').setup {
|
|
||||||
-- extensions = {
|
|
||||||
-- ['ui-select'] = {
|
|
||||||
-- require('telescope.themes').get_dropdown(),
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
-- pcall(require('telescope').load_extension, 'fzf')
|
|
||||||
-- pcall(require('telescope').load_extension, 'ui-select')
|
|
||||||
--
|
|
||||||
-- local builtin = require 'telescope.builtin'
|
|
||||||
-- vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
|
||||||
-- vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
|
||||||
-- vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
|
||||||
-- vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
|
||||||
-- vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
|
||||||
-- vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
|
||||||
-- vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
|
||||||
-- vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
|
||||||
-- vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
|
||||||
-- vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
|
||||||
--
|
|
||||||
-- vim.keymap.set('n', '<leader>/', function()
|
|
||||||
-- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
|
||||||
-- winblend = 10,
|
|
||||||
-- previewer = false,
|
|
||||||
-- })
|
|
||||||
-- end, { desc = '[/] Fuzzily search in current buffer' })
|
|
||||||
--
|
|
||||||
-- vim.keymap.set('n', '<leader>s/', function()
|
|
||||||
-- builtin.live_grep {
|
|
||||||
-- grep_open_files = true,
|
|
||||||
-- prompt_title = 'Live Grep in Open Files',
|
|
||||||
-- }
|
|
||||||
-- end, { desc = '[S]earch [/] in Open Files' })
|
|
||||||
--
|
|
||||||
-- vim.keymap.set('n', '<leader>sn', function()
|
|
||||||
-- builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
|
||||||
-- end, { desc = '[S]earch [N]eovim files' })
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- {
|
|
||||||
-- 'folke/lazydev.nvim',
|
|
||||||
-- ft = 'lua',
|
|
||||||
-- opts = {
|
|
||||||
-- library = {
|
|
||||||
-- { path = '${3rd}/luv/library', words = { 'vim%.uv' } },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'neovim/nvim-lspconfig',
|
|
||||||
-- dependencies = {
|
|
||||||
-- { 'williamboman/mason.nvim', opts = {} },
|
|
||||||
-- 'williamboman/mason-lspconfig.nvim',
|
|
||||||
-- 'WhoIsSethDaniel/mason-tool-installer.nvim',
|
|
||||||
-- { 'j-hui/fidget.nvim', opts = {} },
|
|
||||||
-- 'hrsh7th/cmp-nvim-lsp',
|
|
||||||
-- },
|
|
||||||
-- config = function()
|
|
||||||
-- require('mason').setup()
|
|
||||||
-- require('mason-lspconfig').setup {
|
|
||||||
-- ensure_installed = { 'ts_ls', 'tailwindcss', 'cssls', 'lua_ls' },
|
|
||||||
-- automatic_installation = true,
|
|
||||||
-- }
|
|
||||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
-- capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
|
||||||
--
|
|
||||||
-- if vim.g.have_nerd_font then
|
|
||||||
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
|
|
||||||
-- for type, icon in pairs(signs) do
|
|
||||||
-- local hl = 'DiagnosticSign' .. type
|
|
||||||
-- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- local servers = {
|
|
||||||
-- ts_ls = {
|
|
||||||
-- on_attach = function(client, bufnr)
|
|
||||||
-- client.server_capabilities.documentFormattingProvider = false
|
|
||||||
--
|
|
||||||
-- local map = function(keys, func, desc)
|
|
||||||
-- vim.keymap.set('n', keys, func, { buffer = bufnr, desc = 'LSP: ' .. desc })
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
-- buffer = bufnr,
|
|
||||||
-- callback = function()
|
|
||||||
-- vim.lsp.buf.code_action {
|
|
||||||
-- context = { only = { 'source.fixAll' }, diagnostics = {} },
|
|
||||||
-- apply = true,
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- map('<leader>oi', function()
|
|
||||||
-- vim.lsp.buf.code_action {
|
|
||||||
-- context = { only = { 'source.organizeImports' }, diagnostics = {} },
|
|
||||||
-- apply = true,
|
|
||||||
-- }
|
|
||||||
-- end, '[O]rganize [I]mports')
|
|
||||||
-- end,
|
|
||||||
-- capabilities = capabilities,
|
|
||||||
-- settings = {
|
|
||||||
-- typescript = {
|
|
||||||
-- inlayHints = { includeInlayParameterNameHints = 'all' },
|
|
||||||
-- preferences = { importModuleSpecifierPreference = 'non-relative', quotePreference = 'single' },
|
|
||||||
-- },
|
|
||||||
-- javascript = {
|
|
||||||
-- preferences = { importModuleSpecifierPreference = 'non-relative', quotePreference = 'single' },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- tailwindcss = {
|
|
||||||
-- filetypes = { 'html', 'css', 'scss', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' },
|
|
||||||
-- },
|
|
||||||
-- cssls = {},
|
|
||||||
-- lua_ls = {
|
|
||||||
-- settings = {
|
|
||||||
-- Lua = {
|
|
||||||
-- completion = { callSnippet = 'Replace' },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- local ensure_installed = vim.tbl_keys(servers)
|
|
||||||
-- require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
|
||||||
--
|
|
||||||
-- require('mason-lspconfig').setup {
|
|
||||||
-- ensure_installed = ensure_installed,
|
|
||||||
-- automatic_installation = true,
|
|
||||||
-- handlers = {
|
|
||||||
-- function(server_name)
|
|
||||||
-- local server = servers[server_name] or {}
|
|
||||||
-- server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
|
||||||
-- require('lspconfig')[server_name].setup(server)
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'stevearc/conform.nvim',
|
|
||||||
-- event = { 'BufWritePre' },
|
|
||||||
-- cmd = { 'ConformInfo' },
|
|
||||||
-- keys = {
|
|
||||||
-- {
|
|
||||||
-- '<leader>f',
|
|
||||||
-- function()
|
|
||||||
-- require('conform').format { async = true, lsp_format = 'fallback' }
|
|
||||||
-- end,
|
|
||||||
-- mode = '',
|
|
||||||
-- desc = '[F]ormat buffer',
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- opts = {
|
|
||||||
-- notify_on_error = false,
|
|
||||||
-- format_on_save = function(bufnr)
|
|
||||||
-- local disable_filetypes = { c = true, cpp = true }
|
|
||||||
-- return {
|
|
||||||
-- timeout_ms = 500,
|
|
||||||
-- lsp_format = disable_filetypes[vim.bo[bufnr].filetype] and 'never' or 'fallback',
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- formatters_by_ft = {
|
|
||||||
-- lua = { 'stylua' },
|
|
||||||
-- javascript = { 'prettier' },
|
|
||||||
-- typescript = { 'prettier' },
|
|
||||||
-- css = { 'prettier' },
|
|
||||||
-- scss = { 'prettier' },
|
|
||||||
-- html = { 'prettier' },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'hrsh7th/nvim-cmp',
|
|
||||||
-- event = 'InsertEnter',
|
|
||||||
-- dependencies = {
|
|
||||||
-- {
|
|
||||||
-- 'L3MON4D3/LuaSnip',
|
|
||||||
-- build = (function()
|
|
||||||
-- if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
|
||||||
-- return
|
|
||||||
-- end
|
|
||||||
-- return 'make install_jsregexp'
|
|
||||||
-- end)(),
|
|
||||||
-- },
|
|
||||||
-- 'saadparwaiz1/cmp_luasnip',
|
|
||||||
-- 'hrsh7th/cmp-nvim-lsp',
|
|
||||||
-- 'hrsh7th/cmp-path',
|
|
||||||
-- 'hrsh7th/cmp-buffer',
|
|
||||||
-- 'hrsh7th/cmp-cmdline',
|
|
||||||
-- },
|
|
||||||
-- config = function()
|
|
||||||
-- local cmp = require 'cmp'
|
|
||||||
-- local luasnip = require 'luasnip'
|
|
||||||
-- luasnip.config.setup {}
|
|
||||||
-- cmp.setup {
|
|
||||||
-- snippet = {
|
|
||||||
-- expand = function(args)
|
|
||||||
-- luasnip.lsp_expand(args.body)
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- completion = { completeopt = 'menu,menuone,noinsert' },
|
|
||||||
--
|
|
||||||
-- mapping = cmp.mapping.preset.insert {
|
|
||||||
-- ['<C-n>'] = cmp.mapping.select_next_item(),
|
|
||||||
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
||||||
-- ['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
-- ['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
|
|
||||||
-- ['<C-Space>'] = cmp.mapping.complete {},
|
|
||||||
-- ['<C-l>'] = cmp.mapping(function()
|
|
||||||
-- if luasnip.expand_or_locally_jumpable() then
|
|
||||||
-- luasnip.expand_or_jump()
|
|
||||||
-- end
|
|
||||||
-- end, { 'i', 's' }),
|
|
||||||
-- ['<C-h>'] = cmp.mapping(function()
|
|
||||||
-- if luasnip.locally_jumpable(-1) then
|
|
||||||
-- luasnip.jump(-1)
|
|
||||||
-- end
|
|
||||||
-- end, { 'i', 's' }),
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- sources = cmp.config.sources {
|
|
||||||
-- { name = 'lazydev', group_index = 0 },
|
|
||||||
-- { name = 'nvim_lsp' },
|
|
||||||
-- { name = 'luasnip' },
|
|
||||||
-- { name = 'path' },
|
|
||||||
-- { name = 'buffer' },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- { -- 🎨 Colorscheme
|
|
||||||
-- 'folke/tokyonight.nvim',
|
|
||||||
-- priority = 1000,
|
|
||||||
-- init = function()
|
|
||||||
-- -- Load colorscheme with specific style
|
|
||||||
-- vim.cmd.colorscheme 'tokyonight-night'
|
|
||||||
-- -- Customize Comment color (removes italic)
|
|
||||||
-- vim.cmd.hi 'Comment gui=none'
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- -- ✅ Highlight TODOs, FIXMEs, and other comments
|
|
||||||
-- {
|
|
||||||
-- 'folke/todo-comments.nvim',
|
|
||||||
-- event = 'VimEnter',
|
|
||||||
-- dependencies = { 'nvim-lua/plenary.nvim' },
|
|
||||||
-- opts = { signs = false },
|
|
||||||
-- },
|
|
||||||
-- { -- 🛠️ mini.nvim utility plugins (better text objects, surround, and statusline)
|
|
||||||
-- 'echasnovski/mini.nvim',
|
|
||||||
-- config = function()
|
|
||||||
-- -- Setup mini.ai for better text objects
|
|
||||||
-- require('mini.ai').setup {
|
|
||||||
-- n_lines = 500,
|
|
||||||
-- }
|
|
||||||
-- -- Setup mini.surround for surrounding text objects
|
|
||||||
-- require('mini.surround').setup()
|
|
||||||
--
|
|
||||||
-- -- Setup mini.statusline for a better status line
|
|
||||||
-- require('mini.statusline').setup {
|
|
||||||
-- use_icons = vim.g.have_nerd_font,
|
|
||||||
-- content = {
|
|
||||||
-- active = function()
|
|
||||||
-- return '%2l:%-2v' -- line:column display
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- 'nvim-treesitter/nvim-treesitter',
|
|
||||||
-- build = ':tsupdate',
|
|
||||||
-- main = 'nvim-treesitter.configs',
|
|
||||||
-- opts = {
|
|
||||||
-- ensure_installed = {
|
|
||||||
-- 'bash',
|
|
||||||
-- 'c',
|
|
||||||
-- 'diff',
|
|
||||||
-- 'html',
|
|
||||||
-- 'css',
|
|
||||||
-- 'javascript',
|
|
||||||
-- 'typescript',
|
|
||||||
-- 'tsx',
|
|
||||||
-- 'json',
|
|
||||||
-- 'lua',
|
|
||||||
-- 'luadoc',
|
|
||||||
-- 'markdown',
|
|
||||||
-- 'markdown_inline',
|
|
||||||
-- 'query',
|
|
||||||
-- 'vim',
|
|
||||||
-- 'vimdoc',
|
|
||||||
-- },
|
|
||||||
-- auto_install = true,
|
|
||||||
-- highlight = {
|
|
||||||
-- enable = true,
|
|
||||||
-- additional_vim_regex_highlighting = { 'ruby' },
|
|
||||||
-- },
|
|
||||||
-- indent = { enable = true, disable = { 'ruby' } },
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- ui = {
|
|
||||||
-- icons = vim.g.have_nerd_font and {} or {
|
|
||||||
-- cmd = '⌘',
|
|
||||||
-- config = '🛠',
|
|
||||||
-- event = '📅',
|
|
||||||
-- ft = '📂',
|
|
||||||
-- init = '⚙',
|
|
||||||
-- keys = '🗝',
|
|
||||||
-- plugin = '🔌',
|
|
||||||
-- runtime = '💻',
|
|
||||||
-- require = '🌙',
|
|
||||||
-- source = '📄',
|
|
||||||
-- start = '🚀',
|
|
||||||
-- task = '📌',
|
|
||||||
-- lazy = '💤 ',
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- return M
|
|
|
@ -1,14 +1,11 @@
|
||||||
vim.g.have_nerd_font = true
|
vim.g.have_nerd_font = true
|
||||||
vim.scriptencoding = 'utf-8'
|
|
||||||
|
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
vim.opt.mouse = 'a'
|
vim.opt.mouse = 'a'
|
||||||
vim.opt.showmode = false
|
vim.opt.showmode = false
|
||||||
vim.opt.fileencoding = 'utf-8'
|
|
||||||
vim.opt.title = true
|
vim.opt.title = true
|
||||||
vim.opt.clipboard = 'unnamedplus'
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
vim.opt.breakindent = true
|
vim.opt.breakindent = true
|
||||||
vim.opt.undofile = true
|
vim.opt.undofile = true
|
||||||
vim.opt.ignorecase = true
|
vim.opt.ignorecase = true
|
||||||
|
@ -19,7 +16,7 @@ vim.opt.shiftwidth = 2
|
||||||
vim.opt.autoindent = true
|
vim.opt.autoindent = true
|
||||||
vim.opt.smartindent = true
|
vim.opt.smartindent = true
|
||||||
vim.opt.signcolumn = 'yes'
|
vim.opt.signcolumn = 'yes'
|
||||||
vim.opt.updatetime = 250
|
vim.opt.updatetime = 200
|
||||||
vim.opt.timeoutlen = 300
|
vim.opt.timeoutlen = 300
|
||||||
vim.opt.splitright = true
|
vim.opt.splitright = true
|
||||||
vim.opt.splitbelow = true
|
vim.opt.splitbelow = true
|
||||||
|
@ -28,3 +25,31 @@ vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||||
vim.opt.inccommand = 'split'
|
vim.opt.inccommand = 'split'
|
||||||
vim.opt.cursorline = true
|
vim.opt.cursorline = true
|
||||||
vim.opt.scrolloff = 10
|
vim.opt.scrolloff = 10
|
||||||
|
vim.opt.backspace = { 'indent', 'eol', 'start' }
|
||||||
|
vim.opt.path:append { '**' }
|
||||||
|
vim.opt.wildignore:append { '*/node_modules/*' }
|
||||||
|
vim.opt.formatoptions:append { 'r' }
|
||||||
|
|
||||||
|
-- Enable folding in Neovim
|
||||||
|
vim.opt.foldmethod = 'expr'
|
||||||
|
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||||
|
vim.opt.foldlevel = 99 -- Keep folds open by default
|
||||||
|
vim.opt.foldcolumn = '1' -- Show fold column left of line numbers
|
||||||
|
|
||||||
|
vim.opt.foldtext = 'v:lua.custom_foldtext()' -- Custom fold text function
|
||||||
|
|
||||||
|
-- Function to change fold symbols
|
||||||
|
function _G.custom_foldtext()
|
||||||
|
local line = vim.fn.getline(vim.v.foldstart) -- Get the first line of the fold
|
||||||
|
local fold_size = vim.v.foldend - vim.v.foldstart + 1
|
||||||
|
return line .. ' (' .. fold_size .. ' lines) ' -- Display fold size
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Customize fold markers in fold column
|
||||||
|
vim.opt.statuscolumn = '%C' -- Customize fold column symbols
|
||||||
|
vim.opt.fillchars:append {
|
||||||
|
foldopen = '▾', -- Down arrow for open folds
|
||||||
|
foldclose = '▸', -- Right arrow for closed folds
|
||||||
|
foldsep = ' ', -- Space between folds
|
||||||
|
fold = ' ', -- Empty space for better visuals
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue