More configuration updates

This commit is contained in:
Hazem Krimi
2025-02-13 02:01:56 +01:00
parent 5b20f2406f
commit d19a34bcfd
14 changed files with 391 additions and 173 deletions
+10
View File
@@ -0,0 +1,10 @@
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
+26
View File
@@ -0,0 +1,26 @@
return {
'goolord/alpha-nvim',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
config = function()
local alpha = require 'alpha'
local dashboard = require 'alpha.themes.startify'
dashboard.section.header.val = {
[[ ]],
[[  ]],
[[ ████ ██████ █████ ██ ]],
[[ ███████████ █████  ]],
[[ █████████ ███████████████████ ███ ███████████ ]],
[[ █████████ ███ █████████████ █████ ██████████████ ]],
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
[[ ]],
}
alpha.setup(dashboard.opts)
end,
}
+5 -2
View File
@@ -11,8 +11,8 @@ return {
themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default
numbers = 'none', -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
close_command = 'Bdelete! %d', -- can be a string | function, see "Mouse actions"
buffer_close_icon = '',
close_icon = '',
buffer_close_icon = '󰅖',
close_icon = '',
path_components = 1, -- Show only the file name without the directory
modified_icon = '',
left_trunc_marker = '',
@@ -40,6 +40,9 @@ return {
maximum_padding = 5,
maximum_length = 15,
sort_by = 'insert_at_end',
pick = {
alphabet = 'abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ1234567890',
},
},
highlights = {
separator = {
+7 -7
View File
@@ -1,9 +1,9 @@
return {
'folke/tokyonight.nvim',
lazy = false,
priority = 1000,
init = function()
vim.cmd.colorscheme 'tokyonight-night'
vim.cmd.hi 'Comment gui=none'
end,
'folke/tokyonight.nvim',
lazy = false,
priority = 1000,
init = function()
vim.cmd.colorscheme 'tokyonight-night'
vim.cmd.hi 'Comment gui=none'
end,
}
-3
View File
@@ -1,3 +0,0 @@
return {
'github/copilot.vim',
}
+105
View File
@@ -0,0 +1,105 @@
return {
{
'mfussenegger/nvim-dap',
dependencies = {
'rcarriga/nvim-dap-ui',
'theHamsta/nvim-dap-virtual-text',
'nvim-neotest/nvim-nio',
'williamboman/mason.nvim',
},
config = function()
local dap = require 'dap'
local ui = require 'dapui'
require('dapui').setup()
require('nvim-dap-virtual-text').setup()
dap.adapters.chrome = {
type = 'executable',
command = 'node',
args = { os.getenv 'HOME' .. '/.local/share/nvim/mason/packages/chrome-debug-adapter/out/src/chromeDebug.js' },
}
dap.configurations.javascriptreact = {
{
type = 'chrome',
request = 'launch',
name = 'Launch in Brave',
webRoot = '${workspaceFolder}',
runtimeExecutable = '/snap/bin/brave',
sourceMaps = true,
userDataDir = true,
url = function()
local co = coroutine.running()
return coroutine.create(function()
vim.ui.input({
prompt = 'Enter URL: ',
default = 'http://localhost:3000',
}, function(url)
if url == nil or url == '' then
return
else
coroutine.resume(co, url)
end
end)
end)
end,
},
}
dap.configurations.typescriptreact = {
{
type = 'chrome',
request = 'launch',
name = 'Launch in Brave',
webRoot = '${workspaceFolder}',
runtimeExecutable = '/snap/bin/brave',
sourceMaps = true,
userDataDir = true,
url = function()
local co = coroutine.running()
return coroutine.create(function()
vim.ui.input({
prompt = 'Enter URL: ',
default = 'http://localhost:3000',
}, function(url)
if url == nil or url == '' then
return
else
coroutine.resume(co, url)
end
end)
end)
end,
},
}
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint)
vim.keymap.set('n', '<leader>gb', dap.run_to_cursor)
-- Eval var under cursor
vim.keymap.set('n', '<leader>?', function()
require('dapui').eval(nil, { enter = true })
end)
vim.keymap.set('n', '<F1>', dap.continue)
vim.keymap.set('n', '<F2>', dap.step_into)
vim.keymap.set('n', '<F3>', dap.step_over)
vim.keymap.set('n', '<F4>', dap.step_out)
vim.keymap.set('n', '<F5>', dap.step_back)
vim.keymap.set('n', '<F6>', dap.restart)
dap.listeners.before.attach.dapui_config = function()
ui.open()
end
dap.listeners.before.launch.dapui_config = function()
ui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
ui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
ui.close()
end
end,
},
}
+44
View File
@@ -0,0 +1,44 @@
return {
'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)
-- -- Disable "format_on_save lsp_fallback" for languages that don't
-- -- have a well standardized coding style. You can add additional
-- -- languages here or re-enable it for the disabled ones.
-- local disable_filetypes = { c = true, cpp = true }
-- local lsp_format_opt
-- if disable_filetypes[vim.bo[bufnr].filetype] then
-- lsp_format_opt = 'never'
-- else
-- lsp_format_opt = 'fallback'
-- end
-- return {
-- timeout_ms = 500,
-- lsp_format = lsp_format_opt,
-- }
-- end,
formatters_by_ft = {
lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
javascript = { 'prettierd', 'prettier', stop_after_first = true },
html = { 'prettierd', 'prettier', stop_after_first = true },
css = { 'prettierd', 'prettier', stop_after_first = true },
},
},
}
+3 -3
View File
@@ -163,10 +163,9 @@ return {
--
-- But for many setups, the LSP (`tsserver`) will work just fine
ts_ls = {}, -- tsserver is deprecated
html = { filetypes = { 'html', 'twig', 'hbs' } },
html = {},
cssls = {},
dockerls = {},
sqlls = {},
jsonls = {},
yamlls = {},
gopls = {},
@@ -208,7 +207,8 @@ return {
-- for you, so that they are available from within Neovim.
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code
'stylua',
'prettier',
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
+8
View File
@@ -37,4 +37,12 @@ return {
require('colorizer').setup()
end,
},
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
{
'github/copilot.vim',
config = function()
vim.keymap.set('n', '<leader>ec', ':Copilot enable<CR>', { desc = 'Enable Copilot', noremap = false, silent = true })
vim.keymap.set('n', '<leader>dc', ':Copilot disable<CR>', { desc = 'Disable Copilot', noremap = false, silent = true })
end,
},
}
@@ -1,44 +1,44 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
'nvim-neo-tree/neo-tree.nvim',
branch = 'v3.x',
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
-- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information
{
"s1n7ax/nvim-window-picker", -- for open_with_window_picker keymaps
version = "2.*",
's1n7ax/nvim-window-picker', -- for open_with_window_picker keymaps
version = '2.*',
config = function()
require("window-picker").setup({
require('window-picker').setup {
filter_rules = {
include_current_win = false,
autoselect_one = true,
-- filter using buffer options
bo = {
-- if the file type is one of following, the window will be ignored
filetype = { "neo-tree", "neo-tree-popup", "notify" },
filetype = { 'neo-tree', 'neo-tree-popup', 'notify' },
-- if the buffer type is one of following, the window will be ignored
buftype = { "terminal", "quickfix" },
buftype = { 'terminal', 'quickfix' },
},
},
})
}
end,
},
},
config = function()
-- If you want icons for diagnostic errors, you'll need to define them somewhere:
vim.fn.sign_define("DiagnosticSignError", { text = "", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignHint", { text = "󰌵", texthl = "DiagnosticSignHint" })
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = '󰌵', texthl = 'DiagnosticSignHint' })
require("neo-tree").setup({
require('neo-tree').setup {
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab
popup_border_style = "rounded",
popup_border_style = 'rounded',
enable_git_status = true,
enable_diagnostics = true,
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
open_files_do_not_replace_types = { 'terminal', 'trouble', 'qf' }, -- when opening files, do not use windows containing these filetypes or buftypes
open_files_using_relative_paths = false,
sort_case_insensitive = false, -- used when sorting files and directories in the tree
sort_function = nil, -- use a custom function for sorting files and directories in the tree
@@ -58,23 +58,23 @@ return {
padding = 1, -- extra padding on left hand side
-- indent guides
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
indent_marker = '',
last_indent_marker = '',
highlight = 'NeoTreeIndentMarker',
-- expander config, needed for nesting files
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
expander_collapsed = '',
expander_expanded = '',
expander_highlight = 'NeoTreeExpander',
},
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "󰜌",
folder_closed = '',
folder_open = '',
folder_empty = '󰜌',
provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available
if node.type == "file" or node.type == "terminal" then
local success, web_devicons = pcall(require, "nvim-web-devicons")
local name = node.type == "terminal" and "terminal" or node.name
if node.type == 'file' or node.type == 'terminal' then
local success, web_devicons = pcall(require, 'nvim-web-devicons')
local name = node.type == 'terminal' and 'terminal' or node.name
if success then
local devicon, hl = web_devicons.get_icon(name)
icon.text = devicon or icon.text
@@ -84,31 +84,31 @@ return {
end,
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
-- then these will never be used.
default = "*",
highlight = "NeoTreeFileIcon",
default = '*',
highlight = 'NeoTreeFileIcon',
},
modified = {
symbol = "[+]",
highlight = "NeoTreeModified",
symbol = '[+]',
highlight = 'NeoTreeModified',
},
name = {
trailing_slash = false,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
highlight = 'NeoTreeFileName',
},
git_status = {
symbols = {
-- Change type
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "", -- this can only be used in the git_status source
renamed = "󰁕", -- this can only be used in the git_status source
added = '', -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = '', -- or "", but this is redundant info if you use git_status_colors on the name
deleted = '', -- this can only be used in the git_status source
renamed = '󰁕', -- this can only be used in the git_status source
-- Status type
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
conflict = "",
untracked = '',
ignored = '',
unstaged = '󰄱',
staged = '',
conflict = '',
},
},
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
@@ -141,65 +141,65 @@ return {
-- see `:h neo-tree-custom-commands-global`
commands = {},
window = {
position = "left",
position = 'current',
width = 40,
mapping_options = {
noremap = true,
nowait = true,
},
mappings = {
["<space>"] = {
"toggle_node",
['<space>'] = {
'toggle_node',
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
},
["<2-LeftMouse>"] = "open",
["<cr>"] = "open",
["<esc>"] = "cancel", -- close preview or floating neo-tree window
["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } },
['<2-LeftMouse>'] = 'open',
['<cr>'] = 'open',
['<esc>'] = 'cancel', -- close preview or floating neo-tree window
['P'] = { 'toggle_preview', config = { use_float = true, use_image_nvim = true } },
-- Read `# Preview Mode` for more information
["l"] = "focus_preview",
["S"] = "open_split",
["s"] = "open_vsplit",
['l'] = 'focus_preview',
['S'] = 'open_split',
['s'] = 'open_vsplit',
-- ["S"] = "split_with_window_picker",
-- ["s"] = "vsplit_with_window_picker",
["t"] = "open_tabnew",
['t'] = 'open_tabnew',
-- ["<cr>"] = "open_drop",
-- ["t"] = "open_tab_drop",
["w"] = "open_with_window_picker",
['w'] = 'open_with_window_picker',
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
["C"] = "close_node",
['C'] = 'close_node',
-- ['C'] = 'close_all_subnodes',
["z"] = "close_all_nodes",
['z'] = 'close_all_nodes',
--["Z"] = "expand_all_nodes",
["a"] = {
"add",
['a'] = {
'add',
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
config = {
show_path = "none", -- "none", "relative", "absolute"
show_path = 'none', -- "none", "relative", "absolute"
},
},
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
["d"] = "delete",
["r"] = "rename",
["b"] = "rename_basename",
["y"] = "copy_to_clipboard",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
['A'] = 'add_directory', -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
['d'] = 'delete',
['r'] = 'rename',
['b'] = 'rename_basename',
['y'] = 'copy_to_clipboard',
['x'] = 'cut_to_clipboard',
['p'] = 'paste_from_clipboard',
['c'] = 'copy', -- takes text input for destination, also accepts the optional config.show_path option like "add":
-- ["c"] = {
-- "copy",
-- config = {
-- show_path = "none" -- "none", "relative", "absolute"
-- }
--}
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
["q"] = "close_window",
["R"] = "refresh",
["?"] = "show_help",
["<"] = "prev_source",
[">"] = "next_source",
["i"] = "show_file_details",
['m'] = 'move', -- takes text input for destination, also accepts the optional config.show_path option like "add".
['q'] = 'close_window',
['R'] = 'refresh',
['?'] = 'show_help',
['<'] = 'prev_source',
['>'] = 'next_source',
['i'] = 'show_file_details',
-- ["i"] = {
-- "show_file_details",
-- -- format strings of the timestamps shown for date created and last modified (see `:h os.date()`)
@@ -246,42 +246,42 @@ return {
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
},
group_empty_dirs = false, -- when true, empty folders will be grouped together
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
-- in whatever position is specified in window.position
-- "open_current", -- netrw disabled, opening a directory opens within the
-- window like netrw would, regardless of window.position
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
hijack_netrw_behavior = 'open_default', -- netrw disabled, opening a directory opens neo-tree
-- in whatever position is specified in window.position
-- "open_current", -- netrw disabled, opening a directory opens within the
-- window like netrw would, regardless of window.position
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
-- instead of relying on nvim autocmd events.
window = {
mappings = {
["<bs>"] = "navigate_up",
["."] = "set_root",
["H"] = "toggle_hidden",
["/"] = "fuzzy_finder",
["D"] = "fuzzy_finder_directory",
["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm
['<bs>'] = 'navigate_up',
['.'] = 'set_root',
['H'] = 'toggle_hidden',
['/'] = 'fuzzy_finder',
['D'] = 'fuzzy_finder_directory',
['#'] = 'fuzzy_sorter', -- fuzzy sorting using the fzy algorithm
-- ["D"] = "fuzzy_sorter_directory",
["f"] = "filter_on_submit",
["<c-x>"] = "clear_filter",
["[g"] = "prev_git_modified",
["]g"] = "next_git_modified",
["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } },
["oc"] = { "order_by_created", nowait = false },
["od"] = { "order_by_diagnostics", nowait = false },
["og"] = { "order_by_git_status", nowait = false },
["om"] = { "order_by_modified", nowait = false },
["on"] = { "order_by_name", nowait = false },
["os"] = { "order_by_size", nowait = false },
["ot"] = { "order_by_type", nowait = false },
['f'] = 'filter_on_submit',
['<c-x>'] = 'clear_filter',
['[g'] = 'prev_git_modified',
[']g'] = 'next_git_modified',
['o'] = { 'show_help', nowait = false, config = { title = 'Order by', prefix_key = 'o' } },
['oc'] = { 'order_by_created', nowait = false },
['od'] = { 'order_by_diagnostics', nowait = false },
['og'] = { 'order_by_git_status', nowait = false },
['om'] = { 'order_by_modified', nowait = false },
['on'] = { 'order_by_name', nowait = false },
['os'] = { 'order_by_size', nowait = false },
['ot'] = { 'order_by_type', nowait = false },
-- ['<key>'] = function(state) ... end,
},
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
["<down>"] = "move_cursor_down",
["<C-n>"] = "move_cursor_down",
["<up>"] = "move_cursor_up",
["<C-p>"] = "move_cursor_up",
["<esc>"] = "close",
['<down>'] = 'move_cursor_down',
['<C-n>'] = 'move_cursor_down',
['<up>'] = 'move_cursor_up',
['<C-p>'] = 'move_cursor_up',
['<esc>'] = 'close',
-- ['<key>'] = function(state, scroll_padding) ... end,
},
},
@@ -298,43 +298,43 @@ return {
show_unloaded = true,
window = {
mappings = {
["bd"] = "buffer_delete",
["<bs>"] = "navigate_up",
["."] = "set_root",
["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } },
["oc"] = { "order_by_created", nowait = false },
["od"] = { "order_by_diagnostics", nowait = false },
["om"] = { "order_by_modified", nowait = false },
["on"] = { "order_by_name", nowait = false },
["os"] = { "order_by_size", nowait = false },
["ot"] = { "order_by_type", nowait = false },
['bd'] = 'buffer_delete',
['<bs>'] = 'navigate_up',
['.'] = 'set_root',
['o'] = { 'show_help', nowait = false, config = { title = 'Order by', prefix_key = 'o' } },
['oc'] = { 'order_by_created', nowait = false },
['od'] = { 'order_by_diagnostics', nowait = false },
['om'] = { 'order_by_modified', nowait = false },
['on'] = { 'order_by_name', nowait = false },
['os'] = { 'order_by_size', nowait = false },
['ot'] = { 'order_by_type', nowait = false },
},
},
},
git_status = {
window = {
position = "float",
position = 'float',
mappings = {
["A"] = "git_add_all",
["gu"] = "git_unstage_file",
["ga"] = "git_add_file",
["gr"] = "git_revert_file",
["gc"] = "git_commit",
["gp"] = "git_push",
["gg"] = "git_commit_and_push",
["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } },
["oc"] = { "order_by_created", nowait = false },
["od"] = { "order_by_diagnostics", nowait = false },
["om"] = { "order_by_modified", nowait = false },
["on"] = { "order_by_name", nowait = false },
["os"] = { "order_by_size", nowait = false },
["ot"] = { "order_by_type", nowait = false },
['A'] = 'git_add_all',
['gu'] = 'git_unstage_file',
['ga'] = 'git_add_file',
['gr'] = 'git_revert_file',
['gc'] = 'git_commit',
['gp'] = 'git_push',
['gg'] = 'git_commit_and_push',
['o'] = { 'show_help', nowait = false, config = { title = 'Order by', prefix_key = 'o' } },
['oc'] = { 'order_by_created', nowait = false },
['od'] = { 'order_by_diagnostics', nowait = false },
['om'] = { 'order_by_modified', nowait = false },
['on'] = { 'order_by_name', nowait = false },
['os'] = { 'order_by_size', nowait = false },
['ot'] = { 'order_by_type', nowait = false },
},
},
},
})
}
vim.cmd([[nnoremap \ :Neotree reveal<cr>]])
vim.cmd [[nnoremap \ :Neotree reveal<cr>]]
vim.keymap.set('n', '<leader>ts', ':Neotree toggle position=left<CR>', { noremap = true, silent = true })
end,
}
+9
View File
@@ -0,0 +1,9 @@
return {
'MeanderingProgrammer/render-markdown.nvim',
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {},
}