From 7f5fbbf08b361022ad440454f00128ca0169fea7 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 5 Mar 2024 12:24:50 +0530 Subject: [PATCH] apply fmt --- filetype.lua | 12 +- init.lua | 50 +-- lua/basic.lua | 8 +- lua/core.lua | 206 ++++++------ lua/custom_keys.lua | 110 +++---- lua/custom_opts.lua | 40 +-- lua/languages/go.lua | 42 +-- lua/languages/luau.lua | 66 ++-- lua/languages/markdown.lua | 12 +- lua/languages/rust.lua | 320 +++++++++---------- lua/plugins/autocmp/config.lua | 144 ++++----- lua/plugins/bufferline/config.lua | 64 ++-- lua/plugins/coding.lua | 154 ++++----- lua/plugins/colorschemes.lua | 54 ++-- lua/plugins/find.lua | 28 +- lua/plugins/git.lua | 26 +- lua/plugins/highlight.lua | 82 ++--- lua/plugins/lsp.lua | 192 +++++------ lua/plugins/lspconfig/config.lua | 72 ++--- lua/plugins/lualine/config.lua | 250 +++++++-------- lua/plugins/neo-tree/config.lua | 388 +++++++++++------------ lua/plugins/noice/config.lua | 188 +++++------ lua/plugins/nvim-web-devicons/config.lua | 84 ++--- lua/plugins/smart-split/config.lua | 30 +- lua/plugins/start_screen.lua | 90 +++--- lua/plugins/terminal.lua | 100 +++--- lua/plugins/utils.lua | 196 ++++++------ lua/plugins/view.lua | 182 +++++------ 28 files changed, 1584 insertions(+), 1606 deletions(-) diff --git a/filetype.lua b/filetype.lua index ad594e1..d4d1a24 100644 --- a/filetype.lua +++ b/filetype.lua @@ -1,6 +1,6 @@ -vim.filetype.add({ - extension = { - mdx = "mdx", - luau = "luau" - }, -}) +vim.filetype.add { + extension = { + mdx = "mdx", + luau = "luau", + }, +} diff --git a/init.lua b/init.lua index 2c31fab..0e54d30 100644 --- a/init.lua +++ b/init.lua @@ -1,38 +1,38 @@ -- Basic settings -require("basic") +require "basic" -- Load plugins -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) + vim.fn.system { + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + } end vim.opt.rtp:prepend(lazypath) vim.g.mapleader = require("custom_keys").leader vim.g.maplocalleader = "\\" -require("lazy").setup({ - spec = { - { import = "plugins" }, - { import = "languages" }, - { import = "my_plugins" }, - }, - ui = { - border = "rounded", - }, - change_detection = { - enabled = true, - notify = false, -- get a notification when changes are found - }, -}) +require("lazy").setup { + spec = { + { import = "plugins" }, + { import = "languages" }, + { import = "my_plugins" }, + }, + ui = { + border = "rounded", + }, + change_detection = { + enabled = true, + notify = false, -- get a notification when changes are found + }, +} -- Final settings -require("core") +require "core" pcall(require, "custom") diff --git a/lua/basic.lua b/lua/basic.lua index 7704f52..e98fca1 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -1,4 +1,4 @@ -HOME = os.getenv("HOME") +HOME = os.getenv "HOME" vim.opt.termguicolors = true vim.opt.cursorline = true @@ -62,7 +62,7 @@ vim.opt.swapfile = false -- do not use swap file -- Commands mode vim.opt.wildmenu = true -- on TAB, complete options for system command vim.opt.wildignore = - "deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc" + "deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc" -- Only show cursorline in the current window and in normal mode. -- vim.cmd([[ @@ -75,11 +75,11 @@ vim.opt.wildignore = -- augroup END -- ]]) -vim.cmd([[ +vim.cmd [[ set noeb set t_Co=256 filetype plugin indent on exec "nohlsearch" syntax enable syntax on -]]) +]] diff --git a/lua/core.lua b/lua/core.lua index 0ac82e9..704e340 100644 --- a/lua/core.lua +++ b/lua/core.lua @@ -1,152 +1,128 @@ -local keys = require("custom_keys") -local opts = require("custom_opts") +local keys = require "custom_keys" +local opts = require "custom_opts" -- Setup keymapping local function set_keymap() - local map = vim.keymap.set - local option = { noremap = true, silent = true } + local map = vim.keymap.set + local option = { noremap = true, silent = true } - vim.o.guifont = "CaskaydiaCove Nerd Font Mono:h13" + vim.o.guifont = "CaskaydiaCove Nerd Font Mono:h13" - map("n", keys.jump_left_window, "h", option) - map("n", keys.jump_down_window, "j", option) - map("n", keys.jump_up_window, "k", option) - map("n", keys.jump_right_window, "l", option) + map("n", keys.jump_left_window, "h", option) + map("n", keys.jump_down_window, "j", option) + map("n", keys.jump_up_window, "k", option) + map("n", keys.jump_right_window, "l", option) - vim.cmd([[ + vim.cmd [[ " press esc to cancel search highlight nnoremap :nohlsearch:echo - ]]) + ]] - -- Remove the `~` for blank lines by setting its color to be the same as background - vim.cmd("hi NonText guifg=bg") + -- Remove the `~` for blank lines by setting its color to be the same as background + vim.cmd "hi NonText guifg=bg" - -- for markdown file - vim.cmd([[ + -- for markdown file + vim.cmd [[ " optimized up and down move when set wrap for markdown file autocmd FileType markdown noremap j gj autocmd FileType markdown noremap k gk autocmd FileType markdown setlocal wrap - ]]) + ]] - -- Supported by bufdelete - vim.cmd([[ + -- Supported by bufdelete + vim.cmd [[ cnoreabbrev bdelete Bdelete cnoreabbrev bdelete! Bdelete! cnoreabbrev bwipeout Bwipeout cnoreabbrev bwipeout! Bwipeout! - ]]) + ]] - -- Supported by bufferline - map("n", keys.pick_tab, ":BufferLinePick", option) + -- Supported by bufferline + map("n", keys.pick_tab, ":BufferLinePick", option) - -- Supported by nvim-tree - map("n", keys.file_explorer, ":Neotree position=left source=filesystem action=show toggle=true", option) - map("n", keys.git_status, ":Neotree position=float source=git_status action=show toggle=true", option) + -- Supported by nvim-tree + map("n", keys.file_explorer, ":Neotree position=left source=filesystem action=show toggle=true", option) + map("n", keys.git_status, ":Neotree position=float source=git_status action=show toggle=true", option) - -- Supported by aerial - map("n", keys.outline, ":AerialToggle! right", option) + -- Supported by aerial + map("n", keys.outline, ":AerialToggle! right", option) - -- Supported by diffview - map("n", keys.diff_open, ":DiffviewOpen", option) - map("n", keys.diff_close, ":DiffviewClose", option) + -- Supported by diffview + map("n", keys.diff_open, ":DiffviewOpen", option) + map("n", keys.diff_close, ":DiffviewClose", option) - -- Supported by toggleterm - -- float terminal - local float_terminal_default = require("toggleterm.terminal").Terminal:new({ - direction = "float", - on_open = function(term) - -- forced to change the working dir for terminal - -- This will solve the problem of not updating the directory when switching sessions. - local cwd = vim.fn.getcwd() - if cwd ~= term.dir then - term:change_dir(cwd) - end - -- when float term opened, disable bottom terminal - vim.api.nvim_del_keymap("t", keys.terminal_bottom) - vim.cmd("startinsert!") - end, - on_close = function(t, job, exit_code, name) - -- when float term closed, enable bottom terminal - map("t", keys.terminal_bottom, ":lua _bottom_term_toggle()", option) - end, - }) - function _float_term_toggle() - float_terminal_default:toggle() - end + -- Supported by toggleterm + -- float terminal + local float_terminal_default = require("toggleterm.terminal").Terminal:new { + direction = "float", + on_open = function(term) + -- forced to change the working dir for terminal + -- This will solve the problem of not updating the directory when switching sessions. + local cwd = vim.fn.getcwd() + if cwd ~= term.dir then + term:change_dir(cwd) + end + -- when float term opened, disable bottom terminal + vim.api.nvim_del_keymap("t", keys.terminal_bottom) + vim.cmd "startinsert!" + end, + on_close = function(t, job, exit_code, name) + -- when float term closed, enable bottom terminal + map("t", keys.terminal_bottom, ":lua _bottom_term_toggle()", option) + end, + } + function _float_term_toggle() + float_terminal_default:toggle() + end - -- bottom terminal - local bottom_terminal_default = require("toggleterm.terminal").Terminal:new({ - direction = "horizontal", - on_open = function(term) - -- forced to change the working dir for terminal - -- This will solve the problem of not updating the directory when switching sessions. - local cwd = vim.fn.getcwd() - if cwd ~= term.dir then - term:change_dir(cwd) - end + -- bottom terminal + local bottom_terminal_default = require("toggleterm.terminal").Terminal:new { + direction = "horizontal", + on_open = function(term) + -- forced to change the working dir for terminal + -- This will solve the problem of not updating the directory when switching sessions. + local cwd = vim.fn.getcwd() + if cwd ~= term.dir then + term:change_dir(cwd) + end - -- set keymapping - local opts = { buffer = 0 } - vim.api.nvim_buf_set_keymap( - term.bufnr, - "t", - "", - [[wincmd h]], - { noremap = true, silent = true } - ) - vim.api.nvim_buf_set_keymap( - term.bufnr, - "t", - "", - [[wincmd j]], - { noremap = true, silent = true } - ) - vim.api.nvim_buf_set_keymap( - term.bufnr, - "t", - "", - [[wincmd k]], - { noremap = true, silent = true } - ) - vim.api.nvim_buf_set_keymap( - term.bufnr, - "t", - "", - [[wincmd l]], - { noremap = true, silent = true } - ) - vim.cmd("startinsert!") - end, - on_exit = function(t, job, exit_code, name) - vim.cmd("quit!") - end, - }) - function _bottom_term_toggle() - bottom_terminal_default:toggle() - end + -- set keymapping + local opts = { buffer = 0 } + vim.api.nvim_buf_set_keymap(term.bufnr, "t", "", [[wincmd h]], { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap(term.bufnr, "t", "", [[wincmd j]], { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap(term.bufnr, "t", "", [[wincmd k]], { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap(term.bufnr, "t", "", [[wincmd l]], { noremap = true, silent = true }) + vim.cmd "startinsert!" + end, + on_exit = function(t, job, exit_code, name) + vim.cmd "quit!" + end, + } + function _bottom_term_toggle() + bottom_terminal_default:toggle() + end - map("n", keys.terminal_float, ":lua _float_term_toggle()", option) - map("t", keys.terminal_float, ":lua _float_term_toggle()", option) - map("n", keys.terminal_bottom, ":lua _bottom_term_toggle()", option) - map("t", keys.terminal_bottom, ":lua _bottom_term_toggle()", option) + map("n", keys.terminal_float, ":lua _float_term_toggle()", option) + map("t", keys.terminal_float, ":lua _float_term_toggle()", option) + map("n", keys.terminal_bottom, ":lua _bottom_term_toggle()", option) + map("t", keys.terminal_bottom, ":lua _bottom_term_toggle()", option) - vim.cmd([[ + vim.cmd [[ command! Termfloat :lua _float_term_toggle() - ]]) - vim.cmd([[cnoreabbrev terminal Termfloat]]) + ]] + vim.cmd [[cnoreabbrev terminal Termfloat]] - -- Supported by nvim-session-manager - map("n", keys.switch_session, ":SessionManager load_session", option) + -- Supported by nvim-session-manager + map("n", keys.switch_session, ":SessionManager load_session", option) end -- Set up transparency local function set_transparency() - local transparency = opts.window_transparency - -- Setup global transparency for float window. - vim.api.nvim_command(string.format("autocmd FileType * set winblend=%d", transparency)) - -- Setup global transparency for popup menu. - vim.o.pumblend = transparency + local transparency = opts.window_transparency + -- Setup global transparency for float window. + vim.api.nvim_command(string.format("autocmd FileType * set winblend=%d", transparency)) + -- Setup global transparency for popup menu. + vim.o.pumblend = transparency end -- Set up auto command diff --git a/lua/custom_keys.lua b/lua/custom_keys.lua index 69eefc5..bd4b2b4 100644 --- a/lua/custom_keys.lua +++ b/lua/custom_keys.lua @@ -2,69 +2,69 @@ -- You can edit the default settings of the shortcut keys here -- return { - -- The default '' is the space. - leader = " ", + -- The default '' is the space. + leader = " ", - -- Use the shortcut to switch/jump window. - jump_left_window = "", - jump_right_window = "", - jump_up_window = "", - jump_down_window = "", + -- Use the shortcut to switch/jump window. + jump_left_window = "", + jump_right_window = "", + jump_up_window = "", + jump_down_window = "", - -- View other usage of the plugin: https://github.com/akinsho/bufferline.nvim - -- Use the shortcut to pick a buffer tab. - pick_tab = "tt", + -- View other usage of the plugin: https://github.com/akinsho/bufferline.nvim + -- Use the shortcut to pick a buffer tab. + pick_tab = "tt", - -- View other usage of the plugin: https://github.com/nvim-neo-tree/neo-tree.nvim - -- Use the shortcut to open or close file explorer. - file_explorer = "", - -- Use the shortcut to open or close git status on a float window. - git_status = "", + -- View other usage of the plugin: https://github.com/nvim-neo-tree/neo-tree.nvim + -- Use the shortcut to open or close file explorer. + file_explorer = "", + -- Use the shortcut to open or close git status on a float window. + git_status = "", - -- View other usage of the plugin: https://github.com/stevearc/aerial.nvim - -- Use the shortcut to open or close the outline, it need to call the lsp server. - outline = "", + -- View other usage of the plugin: https://github.com/stevearc/aerial.nvim + -- Use the shortcut to open or close the outline, it need to call the lsp server. + outline = "", - -- View other usage of the plugin: https://github.com/akinsho/toggleterm.nvim - -- Use the shortcut to open or close the terminal. - terminal_float = "", -- open terminal in a float window - terminal_bottom = "", -- open terminal at the bottom + -- View other usage of the plugin: https://github.com/akinsho/toggleterm.nvim + -- Use the shortcut to open or close the terminal. + terminal_float = "", -- open terminal in a float window + terminal_bottom = "", -- open terminal at the bottom - -- View other usage of the plugin: https://github.com/Shatur/neovim-session-manager - -- Use the shortcut to switch a session. - switch_session = "ss", + -- View other usage of the plugin: https://github.com/Shatur/neovim-session-manager + -- Use the shortcut to switch a session. + switch_session = "ss", - -- View other usage of the plugin: https://github.com/nvim-telescope/telescope.nvim - -- Use the shortcut to find, search files and find buffers. - find_files = "ff", - live_grep = "gg", - search_cursor = "cc", - find_buffer = "bb", - -- Use the to close telescope window. is the default setting, can't edit it here. - -- close_telescope = "", + -- View other usage of the plugin: https://github.com/nvim-telescope/telescope.nvim + -- Use the shortcut to find, search files and find buffers. + find_files = "ff", + live_grep = "gg", + search_cursor = "cc", + find_buffer = "bb", + -- Use the to close telescope window. is the default setting, can't edit it here. + -- close_telescope = "", - -- View other usage of the plugin: https://github.com/sindrets/diffview.nvim - -- Use the shortcut to open 'git diff'. - diff_open = "df", - -- Use the shortcut to close 'git diff'. - diff_close = "dc", + -- View other usage of the plugin: https://github.com/sindrets/diffview.nvim + -- Use the shortcut to open 'git diff'. + diff_open = "df", + -- Use the shortcut to close 'git diff'. + diff_close = "dc", - -- View other usage of the plugin: https://github.com/mrjones2014/smart-splits.nvim - -- Use the shortcut to resize the window, - resize_left = "", - resize_down = "", - resize_up = "", - resize_right = "", + -- View other usage of the plugin: https://github.com/mrjones2014/smart-splits.nvim + -- Use the shortcut to resize the window, + resize_left = "", + resize_down = "", + resize_up = "", + resize_right = "", - -- View other usage of the plugin: https://github.com/neovim/nvim-lspconfig - -- Goto - goto_definition = "gd", - goto_references = "gr", - goto_declaration = "gD", - goto_impl = "gi", - -- goto_back = "", - -- Use the shortcut to rename the code symbols. - lsp_rename = "re", - -- Use the shortcut to format your codes. - format = "ft", + -- View other usage of the plugin: https://github.com/neovim/nvim-lspconfig + -- Goto + goto_definition = "gd", + goto_references = "gr", + goto_declaration = "gD", + goto_impl = "gi", + -- goto_back = "", + -- Use the shortcut to rename the code symbols. + lsp_rename = "re", + -- Use the shortcut to format your codes. + format = "ft", } diff --git a/lua/custom_opts.lua b/lua/custom_opts.lua index 7de1c3f..6cd851d 100644 --- a/lua/custom_opts.lua +++ b/lua/custom_opts.lua @@ -1,26 +1,26 @@ local function strsplit(inputstr, sep) - if sep == nil then - sep = "%s" - end - local t={} - for str in string.gmatch(inputstr, "([^"..sep.."]+)") do - table.insert(t, str) - end - return t + if sep == nil then + sep = "%s" + end + local t = {} + for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do + table.insert(t, str) + end + return t end return { - file_explorer_title = "🥷 File Explorer", - tab_style = "thin", -- options: thin, thick, slope, slant - terminal_size = 0.7, -- control the float terminal only - window_transparency = 0, - auto_open_outline = false, -- options: true, false - cmdline_view = "cmdline", -- options: cmdline, cmdline_popup - close_message_notify = false, + file_explorer_title = "🥷 File Explorer", + tab_style = "thin", -- options: thin, thick, slope, slant + terminal_size = 0.7, -- control the float terminal only + window_transparency = 0, + auto_open_outline = false, -- options: true, false + cmdline_view = "cmdline", -- options: cmdline, cmdline_popup + close_message_notify = false, - -- Starting screen header. - home_header = - strsplit([[ + -- Starting screen header. + home_header = strsplit( + [[ ⢀⠀⢀⣀⣠⣤⣤⣤⣤⣤⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣠⣠⣤⣤⣤⣤⣀⠲⢦⣄⡀⠀⠀ ⡶⢟⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠰⣷⣷⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣬⡛⢷⣔ ⣾⡿⠟⠋⠉⠁⠀⡀⠀⠀⠀⠀⠈⠉⠉⠙⠛⢻⠛⠛⠋⠀⠀⠀⠀⠀⠀⠀⠈⠙⢛⣛⣛⣛⣛⣉⢉⣉⡀⠀⠀⠀⠀⠀⠈⠉⠛⢿⣷⣝ @@ -40,5 +40,7 @@ return { ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠟⠛⠛⠛⠛⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠇⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠋⠀⠀⠀⠀⠀⠀⠀ - ]], "\n") + ]], + "\n" + ), } diff --git a/lua/languages/go.lua b/lua/languages/go.lua index 92dd425..cc534ff 100644 --- a/lua/languages/go.lua +++ b/lua/languages/go.lua @@ -1,23 +1,23 @@ return { - { - "ray-x/go.nvim", - dependencies = { -- optional packages - "ray-x/guihua.lua", - "neovim/nvim-lspconfig", - "nvim-treesitter/nvim-treesitter", - }, - config = function() - require("go").setup({ - run_in_floaterm = true, - floaterm = { - posititon = "center", -- one of {`top`, `bottom`, `left`, `right`, `center`, `auto`} - width = 0.45, -- width of float window if not auto - height = 0.98, -- height of float window if not auto - }, - }) - end, - event = { "CmdlineEnter" }, - ft = { "go", "gomod" }, - build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries - }, + { + "ray-x/go.nvim", + dependencies = { -- optional packages + "ray-x/guihua.lua", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("go").setup { + run_in_floaterm = true, + floaterm = { + posititon = "center", -- one of {`top`, `bottom`, `left`, `right`, `center`, `auto`} + width = 0.45, -- width of float window if not auto + height = 0.98, -- height of float window if not auto + }, + } + end, + event = { "CmdlineEnter" }, + ft = { "go", "gomod" }, + build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries + }, } diff --git a/lua/languages/luau.lua b/lua/languages/luau.lua index 06971c4..262d480 100644 --- a/lua/languages/luau.lua +++ b/lua/languages/luau.lua @@ -1,37 +1,37 @@ return { - "lopi-py/luau-lsp.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - }, + "lopi-py/luau-lsp.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, - config = function() - require("luau-lsp").setup({ - fflags = { - sync = true, -- sync currently enabled fflags with roblox's published fflags - override = { - DebugLuauDeferredConstraintResolution = true, - }, - }, + config = function() + require("luau-lsp").setup { + fflags = { + sync = true, -- sync currently enabled fflags with roblox's published fflags + override = { + DebugLuauDeferredConstraintResolution = true, + }, + }, - server = { - settings = { - -- https://github.com/folke/neoconf.nvim/blob/main/schemas/luau_lsp.json - ["luau-lsp"] = { - require = { - mode = "relativeToFile", - directoryAliases = { ["@lune"] = "~/.lune/.typedefs/0.8.0/" }, - }, - completion = { - imports = { - enabled = true, -- enable auto imports - }, - }, - }, - }, - }, - types = { - roblox = false, - }, - }) - end, + server = { + settings = { + -- https://github.com/folke/neoconf.nvim/blob/main/schemas/luau_lsp.json + ["luau-lsp"] = { + require = { + mode = "relativeToFile", + directoryAliases = { ["@lune"] = "~/.lune/.typedefs/0.8.0/" }, + }, + completion = { + imports = { + enabled = true, -- enable auto imports + }, + }, + }, + }, + }, + types = { + roblox = false, + }, + } + end, } diff --git a/lua/languages/markdown.lua b/lua/languages/markdown.lua index d542024..58a6edf 100644 --- a/lua/languages/markdown.lua +++ b/lua/languages/markdown.lua @@ -1,8 +1,8 @@ return { - { - "iamcco/markdown-preview.nvim", - build = function() - vim.fn["mkdp#util#install"]() - end, - }, + { + "iamcco/markdown-preview.nvim", + build = function() + vim.fn["mkdp#util#install"]() + end, + }, } diff --git a/lua/languages/rust.lua b/lua/languages/rust.lua index 6069fba..d5becaf 100644 --- a/lua/languages/rust.lua +++ b/lua/languages/rust.lua @@ -1,184 +1,184 @@ return { - { 'rust-lang/rust.vim' }, - { - "simrat39/rust-tools.nvim", - lazy = true, - config = function() - local rt = require("rust-tools") - rt.setup({ - tools = { -- rust-tools options + { "rust-lang/rust.vim" }, + { + "simrat39/rust-tools.nvim", + lazy = true, + config = function() + local rt = require "rust-tools" + rt.setup { + tools = { -- rust-tools options - -- how to execute terminal commands - -- options right now: termopen / quickfix - executor = require("rust-tools.executors").quickfix, + -- how to execute terminal commands + -- options right now: termopen / quickfix + executor = require("rust-tools.executors").quickfix, - -- callback to execute once rust-analyzer is done initializing the workspace - -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" - on_initialized = nil, + -- callback to execute once rust-analyzer is done initializing the workspace + -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" + on_initialized = nil, - -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. - reload_workspace_from_cargo_toml = true, + -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. + reload_workspace_from_cargo_toml = true, - -- These apply to the default RustSetInlayHints command - inlay_hints = { - -- automatically set inlay hints (type hints) - -- default: true - auto = true, + -- These apply to the default RustSetInlayHints command + inlay_hints = { + -- automatically set inlay hints (type hints) + -- default: true + auto = true, - -- Only show inlay hints for the current line - only_current_line = false, + -- Only show inlay hints for the current line + only_current_line = false, - -- whether to show parameter hints with the inlay hints or not - -- default: true - show_parameter_hints = true, + -- whether to show parameter hints with the inlay hints or not + -- default: true + show_parameter_hints = true, - -- prefix for parameter hints - -- default: "<-" - parameter_hints_prefix = "<- ", + -- prefix for parameter hints + -- default: "<-" + parameter_hints_prefix = "<- ", - -- prefix for all the other hints (type, chaining) - -- default: "=>" - other_hints_prefix = "=> ", + -- prefix for all the other hints (type, chaining) + -- default: "=>" + other_hints_prefix = "=> ", - -- whether to align to the length of the longest line in the file - max_len_align = false, + -- whether to align to the length of the longest line in the file + max_len_align = false, - -- padding from the left if max_len_align is true - max_len_align_padding = 1, + -- padding from the left if max_len_align is true + max_len_align_padding = 1, - -- whether to align to the extreme right or not - right_align = false, + -- whether to align to the extreme right or not + right_align = false, - -- padding from the right if right_align is true - right_align_padding = 7, + -- padding from the right if right_align is true + right_align_padding = 7, - -- The color of the hints - highlight = "Comment", - }, + -- The color of the hints + highlight = "Comment", + }, - -- options same as lsp hover / vim.lsp.util.open_floating_preview() - hover_actions = { + -- options same as lsp hover / vim.lsp.util.open_floating_preview() + hover_actions = { - -- the border that is used for the hover window - -- see vim.api.nvim_open_win() - border = { - { "╭", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╮", "FloatBorder" }, - { "│", "FloatBorder" }, - { "╯", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╰", "FloatBorder" }, - { "│", "FloatBorder" }, - }, + -- the border that is used for the hover window + -- see vim.api.nvim_open_win() + border = { + { "╭", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, + { "╯", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, + { "│", "FloatBorder" }, + }, - -- Maximal width of the hover window. Nil means no max. - max_width = nil, + -- Maximal width of the hover window. Nil means no max. + max_width = nil, - -- Maximal height of the hover window. Nil means no max. - max_height = nil, + -- Maximal height of the hover window. Nil means no max. + max_height = nil, - -- whether the hover action window gets automatically focused - -- default: false - auto_focus = false, - }, + -- whether the hover action window gets automatically focused + -- default: false + auto_focus = false, + }, - -- settings for showing the crate graph based on graphviz and the dot - -- command - crate_graph = { - -- Backend used for displaying the graph - -- see: https://graphviz.org/docs/outputs/ - -- default: x11 - backend = "x11", - -- where to store the output, nil for no output stored (relative - -- path from pwd) - -- default: nil - output = nil, - -- true for all crates.io and external crates, false only the local - -- crates - -- default: true - full = true, + -- settings for showing the crate graph based on graphviz and the dot + -- command + crate_graph = { + -- Backend used for displaying the graph + -- see: https://graphviz.org/docs/outputs/ + -- default: x11 + backend = "x11", + -- where to store the output, nil for no output stored (relative + -- path from pwd) + -- default: nil + output = nil, + -- true for all crates.io and external crates, false only the local + -- crates + -- default: true + full = true, - -- List of backends found on: https://graphviz.org/docs/outputs/ - -- Is used for input validation and autocompletion - -- Last updated: 2021-08-26 - enabled_graphviz_backends = { - "bmp", - "cgimage", - "canon", - "dot", - "gv", - "xdot", - "xdot1.2", - "xdot1.4", - "eps", - "exr", - "fig", - "gd", - "gd2", - "gif", - "gtk", - "ico", - "cmap", - "ismap", - "imap", - "cmapx", - "imap_np", - "cmapx_np", - "jpg", - "jpeg", - "jpe", - "jp2", - "json", - "json0", - "dot_json", - "xdot_json", - "pdf", - "pic", - "pct", - "pict", - "plain", - "plain-ext", - "png", - "pov", - "ps", - "ps2", - "psd", - "sgi", - "svg", - "svgz", - "tga", - "tiff", - "tif", - "tk", - "vml", - "vmlz", - "wbmp", - "webp", - "xlib", - "x11", - }, - }, - }, + -- List of backends found on: https://graphviz.org/docs/outputs/ + -- Is used for input validation and autocompletion + -- Last updated: 2021-08-26 + enabled_graphviz_backends = { + "bmp", + "cgimage", + "canon", + "dot", + "gv", + "xdot", + "xdot1.2", + "xdot1.4", + "eps", + "exr", + "fig", + "gd", + "gd2", + "gif", + "gtk", + "ico", + "cmap", + "ismap", + "imap", + "cmapx", + "imap_np", + "cmapx_np", + "jpg", + "jpeg", + "jpe", + "jp2", + "json", + "json0", + "dot_json", + "xdot_json", + "pdf", + "pic", + "pct", + "pict", + "plain", + "plain-ext", + "png", + "pov", + "ps", + "ps2", + "psd", + "sgi", + "svg", + "svgz", + "tga", + "tiff", + "tif", + "tk", + "vml", + "vmlz", + "wbmp", + "webp", + "xlib", + "x11", + }, + }, + }, - -- all the opts to send to nvim-lspconfig - -- these override the defaults set by rust-tools.nvim - -- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer - server = { - -- standalone file support - -- setting it to false may improve startup time - standalone = true, - }, -- rust-analyzer options + -- all the opts to send to nvim-lspconfig + -- these override the defaults set by rust-tools.nvim + -- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer + server = { + -- standalone file support + -- setting it to false may improve startup time + standalone = true, + }, -- rust-analyzer options - -- debugging stuff - dap = { - adapter = { - type = "executable", - command = "lldb-vscode", - name = "rt_lldb", - }, - }, - }) - end, - }, + -- debugging stuff + dap = { + adapter = { + type = "executable", + command = "lldb-vscode", + name = "rt_lldb", + }, + }, + } + end, + }, } diff --git a/lua/plugins/autocmp/config.lua b/lua/plugins/autocmp/config.lua index de9ec3d..18932d0 100644 --- a/lua/plugins/autocmp/config.lua +++ b/lua/plugins/autocmp/config.lua @@ -1,78 +1,78 @@ return function() - local cmp = require("cmp") + local cmp = require "cmp" - cmp.setup({ - snippet = { - -- Select the luasnip engine here. You can switch to another engine. - expand = function(args) - -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- require('snippy').expand_snippet(args.body) -- For `snippy` users. - -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. - end, - }, - window = { - completion = cmp.config.window.bordered({ - border = "rounded", - winhighlight = "", - minwidth = 60, - }), - documentation = cmp.config.window.bordered({ - border = "rounded", - winhighlight = "", - }), - }, - formatting = { - format = require("lspkind").cmp_format({ - mode = "symbol_text", - }), - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - }, { - { name = "buffer" }, - { name = "path" }, - }), - }) + cmp.setup { + snippet = { + -- Select the luasnip engine here. You can switch to another engine. + expand = function(args) + -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + -- require('snippy').expand_snippet(args.body) -- For `snippy` users. + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + end, + }, + window = { + completion = cmp.config.window.bordered { + border = "rounded", + winhighlight = "", + minwidth = 60, + }, + documentation = cmp.config.window.bordered { + border = "rounded", + winhighlight = "", + }, + }, + formatting = { + format = require("lspkind").cmp_format { + mode = "symbol_text", + }, + }, + mapping = cmp.mapping.preset.insert { + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, + }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + }, { + { name = "buffer" }, + { name = "path" }, + }), + } - -- `/` cmdline setup. - cmp.setup.cmdline("/", { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, - }) + -- `/` cmdline setup. + cmp.setup.cmdline("/", { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) - -- `:` cmdline setup. - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { - name = "cmdline", - option = { - ignore_cmds = { "Man", "!" }, - }, - }, - }), - }) + -- `:` cmdline setup. + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { + name = "cmdline", + option = { + ignore_cmds = { "Man", "!" }, + }, + }, + }), + }) - -- If you want insert `(` after select function or method item - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + -- If you want insert `(` after select function or method item + local cmp_autopairs = require "nvim-autopairs.completion.cmp" + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) end diff --git a/lua/plugins/bufferline/config.lua b/lua/plugins/bufferline/config.lua index e1b6ce9..c385aa0 100644 --- a/lua/plugins/bufferline/config.lua +++ b/lua/plugins/bufferline/config.lua @@ -1,34 +1,34 @@ return function() - local bufferline = require("bufferline") - bufferline.setup({ - options = { - mode = "buffers", -- set to "tabs" to only show tabpages instead - style_preset = bufferline.style_preset.default, -- or bufferline.style_preset.minimal, - themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default - --numbers = function(opts) - -- return string.format("%s·%s", opts.raise(opts.id), opts.lower(opts.ordinal)) - --end, - indicator = { - icon = "▎", -- this should be omitted if indicator style is not 'icon' - style = "icon", - }, - diagnostics = "nvim_lsp", - diagnostics_update_in_insert = false, - offsets = { - { - filetype = "neo-tree", - text = require("custom_opts").file_explorer_title, - text_align = "left", - separator = true, - }, - }, - color_icons = true, -- whether or not to add the filetype icon highlights - separator_style = require("custom_opts").tab_style, - hover = { - enabled = true, - delay = 200, - reveal = { "close" }, - }, - }, - }) + local bufferline = require "bufferline" + bufferline.setup { + options = { + mode = "buffers", -- set to "tabs" to only show tabpages instead + style_preset = bufferline.style_preset.default, -- or bufferline.style_preset.minimal, + themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default + --numbers = function(opts) + -- return string.format("%s·%s", opts.raise(opts.id), opts.lower(opts.ordinal)) + --end, + indicator = { + icon = "▎", -- this should be omitted if indicator style is not 'icon' + style = "icon", + }, + diagnostics = "nvim_lsp", + diagnostics_update_in_insert = false, + offsets = { + { + filetype = "neo-tree", + text = require("custom_opts").file_explorer_title, + text_align = "left", + separator = true, + }, + }, + color_icons = true, -- whether or not to add the filetype icon highlights + separator_style = require("custom_opts").tab_style, + hover = { + enabled = true, + delay = 200, + reveal = { "close" }, + }, + }, + } end diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua index bd767f5..3420768 100644 --- a/lua/plugins/coding.lua +++ b/lua/plugins/coding.lua @@ -1,85 +1,85 @@ return { - -- auto-tag - { - "windwp/nvim-ts-autotag", - config = function() - require("nvim-ts-autotag").setup() - end, - }, + -- auto-tag + { + "windwp/nvim-ts-autotag", + config = function() + require("nvim-ts-autotag").setup() + end, + }, - -- auto-pairs - { - "windwp/nvim-autopairs", - config = function() - require("nvim-autopairs").setup({ - enable_check_bracket_line = false, - ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol - }) - end, - }, + -- auto-pairs + { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup { + enable_check_bracket_line = false, + ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol + } + end, + }, - -- auto completion - { - "hrsh7th/nvim-cmp", - config = function() - require("plugins/autocmp/config")() - end, - }, - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/cmp-path" }, - { "hrsh7th/cmp-cmdline" }, + -- auto completion + { + "hrsh7th/nvim-cmp", + config = function() + require "plugins/autocmp/config"() + end, + }, + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/cmp-buffer" }, + { "hrsh7th/cmp-path" }, + { "hrsh7th/cmp-cmdline" }, - { "L3MON4D3/LuaSnip" }, -- install the LuaSnip engine + { "L3MON4D3/LuaSnip" }, -- install the LuaSnip engine - { "onsails/lspkind.nvim" }, -- icons in autocomplete source + { "onsails/lspkind.nvim" }, -- icons in autocomplete source - -- todo comments - -- Preview - -- TODO: todo - -- FIX: fix - -- WARNING: warning - -- HACK: hack - -- NOTE: note - -- PERF: perf - -- TEST: test - -- - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - require("todo-comments").setup({ - keywords = { - FIX = { - icon = " ", -- icon used for the sign, and in search results - color = "error", -- can be a hex color, or a named color (see below) - alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords - -- signs = false, -- configure signs for some keywords individually - }, - TODO = { icon = " ", color = "todo" }, - HACK = { icon = " ", color = "warning" }, - WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, - PERF = { icon = "󱢍", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, - NOTE = { icon = " ", color = "info", alt = { "INFO" } }, - TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, - }, - colors = { - error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, - warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, - todo = { "DiagnosticOk", "#2563EB" }, - info = { "DiagnosticInfo", "#10B981" }, - default = { "Identifier", "#7C3AED" }, - test = { "Identifier", "#FF00FF" }, - }, - }) - end, - }, + -- todo comments + -- Preview + -- TODO: todo + -- FIX: fix + -- WARNING: warning + -- HACK: hack + -- NOTE: note + -- PERF: perf + -- TEST: test + -- + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("todo-comments").setup { + keywords = { + FIX = { + icon = " ", -- icon used for the sign, and in search results + color = "error", -- can be a hex color, or a named color (see below) + alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = " ", color = "todo" }, + HACK = { icon = " ", color = "warning" }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = "󱢍", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = " ", color = "info", alt = { "INFO" } }, + TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, + colors = { + error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, + warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, + todo = { "DiagnosticOk", "#2563EB" }, + info = { "DiagnosticInfo", "#10B981" }, + default = { "Identifier", "#7C3AED" }, + test = { "Identifier", "#FF00FF" }, + }, + } + end, + }, - -- guess indent - { - "nmac427/guess-indent.nvim", - config = function() - require("guess-indent").setup({}) - end, - }, + -- guess indent + { + "nmac427/guess-indent.nvim", + config = function() + require("guess-indent").setup {} + end, + }, } diff --git a/lua/plugins/colorschemes.lua b/lua/plugins/colorschemes.lua index b368492..f029393 100644 --- a/lua/plugins/colorschemes.lua +++ b/lua/plugins/colorschemes.lua @@ -1,29 +1,29 @@ return { - { - "hardhackerlabs/theme-vim", - name = "hardhacker", - lazy = false, - priority = 1000, - config = function() - vim.g.hardhacker_darker = 0 - vim.g.hardhacker_hide_tilde = 1 - vim.g.hardhacker_keyword_italic = 1 - -- vim.cmd("colorscheme hardhacker") - end, - }, - { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, - config = function() - -- vim.cmd("colorscheme tokyonight-storm") - end, - }, - { - "rose-pine/neovim", - name = "rose-pine", - config = function() - vim.cmd("colorscheme rose-pine-main") - end, - }, + { + "hardhackerlabs/theme-vim", + name = "hardhacker", + lazy = false, + priority = 1000, + config = function() + vim.g.hardhacker_darker = 0 + vim.g.hardhacker_hide_tilde = 1 + vim.g.hardhacker_keyword_italic = 1 + -- vim.cmd("colorscheme hardhacker") + end, + }, + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + config = function() + -- vim.cmd("colorscheme tokyonight-storm") + end, + }, + { + "rose-pine/neovim", + name = "rose-pine", + config = function() + vim.cmd "colorscheme rose-pine-main" + end, + }, } diff --git a/lua/plugins/find.lua b/lua/plugins/find.lua index 3918403..e17e61f 100644 --- a/lua/plugins/find.lua +++ b/lua/plugins/find.lua @@ -1,18 +1,18 @@ return { - { - 'nvim-telescope/telescope.nvim', - dependencies = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}, - config = function() - require'telescope'.setup{} + { + "nvim-telescope/telescope.nvim", + dependencies = { { "nvim-lua/popup.nvim" }, { "nvim-lua/plenary.nvim" } }, + config = function() + require("telescope").setup {} - local option = {noremap = true, silent = true } + local option = { noremap = true, silent = true } - local keys = require("custom_keys") - local builtin = require('telescope.builtin') - vim.keymap.set('n', keys.find_files, builtin.find_files, option) - vim.keymap.set('n', keys.live_grep, builtin.live_grep, option) - vim.keymap.set('n', keys.search_cursor, builtin.grep_string, option) - vim.keymap.set('n', keys.find_buffer, builtin.buffers, option) - end, - }, + local keys = require "custom_keys" + local builtin = require "telescope.builtin" + vim.keymap.set("n", keys.find_files, builtin.find_files, option) + vim.keymap.set("n", keys.live_grep, builtin.live_grep, option) + vim.keymap.set("n", keys.search_cursor, builtin.grep_string, option) + vim.keymap.set("n", keys.find_buffer, builtin.buffers, option) + end, + }, } diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 834da77..e33c556 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -1,16 +1,16 @@ return { - { - "lewis6991/gitsigns.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - require("gitsigns").setup({ - current_line_blame = true, - preview_config = { - border = "rounded", - }, - }) - end, - }, + { + "lewis6991/gitsigns.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("gitsigns").setup { + current_line_blame = true, + preview_config = { + border = "rounded", + }, + } + end, + }, - { "sindrets/diffview.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, + { "sindrets/diffview.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, } diff --git a/lua/plugins/highlight.lua b/lua/plugins/highlight.lua index c335bd7..a4f4ca3 100644 --- a/lua/plugins/highlight.lua +++ b/lua/plugins/highlight.lua @@ -1,46 +1,46 @@ return { - -- Syntax highlighting - { - "nvim-treesitter/nvim-treesitter", - config = function() - require("nvim-treesitter.configs").setup({ - indent = { - enable = true, - disable = {}, - }, - ensure_installed = { "markdown", "markdown_inline", "regex" }, - sync_install = false, - auto_install = true, - ignore_install = {}, + -- Syntax highlighting + { + "nvim-treesitter/nvim-treesitter", + config = function() + require("nvim-treesitter.configs").setup { + indent = { + enable = true, + disable = {}, + }, + ensure_installed = { "markdown", "markdown_inline", "regex" }, + sync_install = false, + auto_install = true, + ignore_install = {}, - highlight = { - enable = true, - disable = {}, - disable = function(lang, buf) - local max_filesize = 100 * 1024 -- 100 KB - local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) - if ok and stats and stats.size > max_filesize then - return true - end - end, - additional_vim_regex_highlighting = false, - }, - }) + highlight = { + enable = true, + disable = {}, + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + additional_vim_regex_highlighting = false, + }, + } - -- let it to use 'markdown' parser for mdx filetype. - vim.treesitter.language.register('markdown', 'mdx') - end, - }, + -- let it to use 'markdown' parser for mdx filetype. + vim.treesitter.language.register("markdown", "mdx") + end, + }, - -- Colors highlighting - { - "NvChad/nvim-colorizer.lua", - config = function(plun) - require("colorizer").setup({ - user_default_options = { - names = false, - }, - }) - end, - }, + -- Colors highlighting + { + "NvChad/nvim-colorizer.lua", + config = function(plun) + require("colorizer").setup { + user_default_options = { + names = false, + }, + } + end, + }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 82aa93c..cc922f1 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,103 +1,103 @@ return { - { - "williamboman/mason.nvim", - config = function() - require("mason").setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗", - }, - border = "rounded", - }, - }) - end, - }, + { + "williamboman/mason.nvim", + config = function() + require("mason").setup { + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + border = "rounded", + }, + } + end, + }, - { - "williamboman/mason-lspconfig.nvim", - config = function() - require("mason-lspconfig").setup() - require("mason-lspconfig").setup_handlers({ - -- The first entry (without a key) will be the default handler - -- and will be called for each installed server that doesn't have - -- a dedicated handler. - function(server_name) -- default handler (optional) - require("lspconfig")[server_name].setup({}) - end, - - -- Next, you can provide a dedicated handler for specific servers. - -- For example, a handler override for the `rust_analyzer`: - -- ["rust_analyzer"] = function () - -- require("rust-tools").setup {} - -- end - }) - end, - }, + { + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup() + require("mason-lspconfig").setup_handlers { + -- The first entry (without a key) will be the default handler + -- and will be called for each installed server that doesn't have + -- a dedicated handler. + function(server_name) -- default handler (optional) + require("lspconfig")[server_name].setup {} + end, - { - "neovim/nvim-lspconfig", - config = function() - require("plugins/lspconfig/config")() - end, - }, + -- Next, you can provide a dedicated handler for specific servers. + -- For example, a handler override for the `rust_analyzer`: + -- ["rust_analyzer"] = function () + -- require("rust-tools").setup {} + -- end + } + end, + }, - { - "jose-elias-alvarez/null-ls.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - local null_ls = require("null-ls") - local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + { + "neovim/nvim-lspconfig", + config = function() + require "plugins/lspconfig/config"() + end, + }, - null_ls.setup({ - border = "rounded", - cmd = { "nvim" }, - debounce = 250, - debug = false, - default_timeout = 5000, - diagnostic_config = {}, - diagnostics_format = "#{m}", - fallback_severity = vim.diagnostic.severity.ERROR, - log_level = "warn", - notify_format = "[null-ls] %s", - on_init = nil, - on_exit = nil, - root_dir = require("null-ls.utils").root_pattern(".null-ls-root", "Makefile", ".git"), - should_attach = nil, - sources = nil, - temp_dir = nil, - update_in_insert = false, - -- formatting on save - --on_attach = function(client, bufnr) - -- if client.supports_method("textDocument/formatting") then - -- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - -- vim.api.nvim_create_autocmd("BufWritePre", { - -- group = augroup, - -- buffer = bufnr, - -- callback = function() - -- vim.lsp.buf.format({ bufnr = bufnr }) - -- end, - -- }) - -- end - --end, - }) -- end of setup - end, - }, + { + "jose-elias-alvarez/null-ls.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local null_ls = require "null-ls" + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - { - "jay-babu/mason-null-ls.nvim", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "williamboman/mason.nvim", - "jose-elias-alvarez/null-ls.nvim", - }, - config = function() - require("mason-null-ls").setup({ - automatic_setup = true, - ensure_installed = { "shfmt", "prettier", "stylua" }, - handlers = {}, - }) - end, - }, + null_ls.setup { + border = "rounded", + cmd = { "nvim" }, + debounce = 250, + debug = false, + default_timeout = 5000, + diagnostic_config = {}, + diagnostics_format = "#{m}", + fallback_severity = vim.diagnostic.severity.ERROR, + log_level = "warn", + notify_format = "[null-ls] %s", + on_init = nil, + on_exit = nil, + root_dir = require("null-ls.utils").root_pattern(".null-ls-root", "Makefile", ".git"), + should_attach = nil, + sources = nil, + temp_dir = nil, + update_in_insert = false, + -- formatting on save + --on_attach = function(client, bufnr) + -- if client.supports_method("textDocument/formatting") then + -- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + -- vim.api.nvim_create_autocmd("BufWritePre", { + -- group = augroup, + -- buffer = bufnr, + -- callback = function() + -- vim.lsp.buf.format({ bufnr = bufnr }) + -- end, + -- }) + -- end + --end, + } -- end of setup + end, + }, + + { + "jay-babu/mason-null-ls.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "jose-elias-alvarez/null-ls.nvim", + }, + config = function() + require("mason-null-ls").setup { + automatic_setup = true, + ensure_installed = { "shfmt", "prettier", "stylua" }, + handlers = {}, + } + end, + }, } diff --git a/lua/plugins/lspconfig/config.lua b/lua/plugins/lspconfig/config.lua index 20bb5f6..c1fa61f 100644 --- a/lua/plugins/lspconfig/config.lua +++ b/lua/plugins/lspconfig/config.lua @@ -1,42 +1,42 @@ return function() - require("lspconfig.ui.windows").default_options.border = "rounded" + require("lspconfig.ui.windows").default_options.border = "rounded" - -- Global mappings. - -- See `:help vim.diagnostic.*` for documentation on any of the below functions - vim.keymap.set("n", "e", vim.diagnostic.open_float) - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next) - vim.keymap.set("n", "q", vim.diagnostic.setloclist) + -- Global mappings. + -- See `:help vim.diagnostic.*` for documentation on any of the below functions + vim.keymap.set("n", "e", vim.diagnostic.open_float) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next) + vim.keymap.set("n", "q", vim.diagnostic.setloclist) - -- Use LspAttach autocommand to only map the following keys - -- after the language server attaches to the current buffer - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), - callback = function(ev) - -- Enable completion triggered by - vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" + -- Use LspAttach autocommand to only map the following keys + -- after the language server attaches to the current buffer + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" - -- Buffer local mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - local opts = { buffer = ev.buf } - vim.keymap.set("n", require("custom_keys").goto_declaration, vim.lsp.buf.declaration, opts) - vim.keymap.set("n", require("custom_keys").goto_definition, vim.lsp.buf.definition, opts) - vim.keymap.set("n", require("custom_keys").goto_references, vim.lsp.buf.references, opts) - vim.keymap.set("n", require("custom_keys").goto_impl, vim.lsp.buf.implementation, opts) - vim.keymap.set("n", require("custom_keys").lsp_rename, vim.lsp.buf.rename, opts) - vim.keymap.set("n", require("custom_keys").format, function() - vim.lsp.buf.format({ async = true }) - end, opts) + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set("n", require("custom_keys").goto_declaration, vim.lsp.buf.declaration, opts) + vim.keymap.set("n", require("custom_keys").goto_definition, vim.lsp.buf.definition, opts) + vim.keymap.set("n", require("custom_keys").goto_references, vim.lsp.buf.references, opts) + vim.keymap.set("n", require("custom_keys").goto_impl, vim.lsp.buf.implementation, opts) + vim.keymap.set("n", require("custom_keys").lsp_rename, vim.lsp.buf.rename, opts) + vim.keymap.set("n", require("custom_keys").format, function() + vim.lsp.buf.format { async = true } + end, opts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) - vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) - vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) - vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) - vim.keymap.set("n", "wl", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, opts) - vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) - vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) - end, - }) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + end, + }) end diff --git a/lua/plugins/lualine/config.lua b/lua/plugins/lualine/config.lua index 48ab3a4..0847ecb 100644 --- a/lua/plugins/lualine/config.lua +++ b/lua/plugins/lualine/config.lua @@ -1,135 +1,135 @@ return function() - --local colors = { - -- red = "#e965a5", - -- green = "#b1f2a7", - -- yellow = "#ebde76", - -- blue = "#b1baf4", - -- purple = "#e192ef", - -- cyan = "#b3f4f3", - -- white = "#eee9fc", - -- black = "#282433", - -- selection = "#282433", - -- comment = "#938aad", - --} + --local colors = { + -- red = "#e965a5", + -- green = "#b1f2a7", + -- yellow = "#ebde76", + -- blue = "#b1baf4", + -- purple = "#e192ef", + -- cyan = "#b3f4f3", + -- white = "#eee9fc", + -- black = "#282433", + -- selection = "#282433", + -- comment = "#938aad", + --} - --local hardhacker_theme = { - -- normal = { - -- a = { fg = colors.black, bg = colors.purple }, - -- b = { fg = colors.red, bg = colors.selection }, - -- c = { fg = colors.comment, bg = colors.selection }, - -- }, + --local hardhacker_theme = { + -- normal = { + -- a = { fg = colors.black, bg = colors.purple }, + -- b = { fg = colors.red, bg = colors.selection }, + -- c = { fg = colors.comment, bg = colors.selection }, + -- }, - -- insert = { a = { fg = colors.black, bg = colors.green } }, - -- visual = { a = { fg = colors.black, bg = colors.yellow } }, - -- replace = { a = { fg = colors.black, bg = colors.red } }, + -- insert = { a = { fg = colors.black, bg = colors.green } }, + -- visual = { a = { fg = colors.black, bg = colors.yellow } }, + -- replace = { a = { fg = colors.black, bg = colors.red } }, - -- inactive = { - -- a = { fg = colors.white, bg = colors.selection }, - -- b = { fg = colors.white, bg = colors.selection }, - -- c = { fg = colors.white, bg = colors.selection }, - -- }, - --} + -- inactive = { + -- a = { fg = colors.white, bg = colors.selection }, + -- b = { fg = colors.white, bg = colors.selection }, + -- c = { fg = colors.white, bg = colors.selection }, + -- }, + --} - require("lualine").setup({ - options = { - icons_enabled = true, - theme = vim.g.hardhacker_lualine_theme, - component_separators = "", - section_separators = { left = "", right = "" }, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = true, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - }, - }, - sections = { - lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } }, - lualine_b = { - { "branch" }, - { "diff" }, - }, - lualine_c = { - { - "filename", - file_status = true, -- Displays file status (readonly status, modified status) - newfile_status = false, -- Display new file status (new file means no write after created) - path = 3, -- 0: Just the filename - -- 1: Relative path - -- 2: Absolute path - -- 3: Absolute path, with tilde as the home directory - -- 4: Filename and parent dir, with tilde as the home directory + require("lualine").setup { + options = { + icons_enabled = true, + theme = vim.g.hardhacker_lualine_theme, + component_separators = "", + section_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = true, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } }, + lualine_b = { + { "branch" }, + { "diff" }, + }, + lualine_c = { + { + "filename", + file_status = true, -- Displays file status (readonly status, modified status) + newfile_status = false, -- Display new file status (new file means no write after created) + path = 3, -- 0: Just the filename + -- 1: Relative path + -- 2: Absolute path + -- 3: Absolute path, with tilde as the home directory + -- 4: Filename and parent dir, with tilde as the home directory - shorting_target = 40, -- Shortens path to leave 40 spaces in the window - -- for other components. (terrible name, any suggestions?) - symbols = { - modified = "[+]", -- Text to show when the file is modified. - readonly = "[-]", -- Text to show when the file is non-modifiable or readonly. - unnamed = "[No Name]", -- Text to show for unnamed buffers. - newfile = "[New]", -- Text to show for newly created file before first write - }, - }, - }, - lualine_x = { - { - require("noice").api.status.command.get, - cond = require("noice").api.status.command.has, - }, - { - require("noice").api.status.search.get, - cond = require("noice").api.status.search.has, - }, - "encoding", - "fileformat", - "filetype", - }, - lualine_y = { - "filesize", - "progress", - -- { - -- "diagnostics", + shorting_target = 40, -- Shortens path to leave 40 spaces in the window + -- for other components. (terrible name, any suggestions?) + symbols = { + modified = "[+]", -- Text to show when the file is modified. + readonly = "[-]", -- Text to show when the file is non-modifiable or readonly. + unnamed = "[No Name]", -- Text to show for unnamed buffers. + newfile = "[New]", -- Text to show for newly created file before first write + }, + }, + }, + lualine_x = { + { + require("noice").api.status.command.get, + cond = require("noice").api.status.command.has, + }, + { + require("noice").api.status.search.get, + cond = require("noice").api.status.search.has, + }, + "encoding", + "fileformat", + "filetype", + }, + lualine_y = { + "filesize", + "progress", + -- { + -- "diagnostics", - -- -- Table of diagnostic sources, available sources are: - -- -- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'. - -- -- or a function that returns a table as such: - -- -- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt } - -- sources = { "nvim_lsp", "nvim_diagnostic" }, + -- -- Table of diagnostic sources, available sources are: + -- -- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'. + -- -- or a function that returns a table as such: + -- -- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt } + -- sources = { "nvim_lsp", "nvim_diagnostic" }, - -- -- Displays diagnostics for the defined severity types - -- sections = { "error", "warn", "info", "hint" }, + -- -- Displays diagnostics for the defined severity types + -- sections = { "error", "warn", "info", "hint" }, - -- diagnostics_color = { - -- -- Same values as the general color option can be used here. - -- error = "DiagnosticError", -- Changes diagnostics' error color. - -- warn = "DiagnosticWarn", -- Changes diagnostics' warn color. - -- info = "DiagnosticInfo", -- Changes diagnostics' info color. - -- hint = "DiagnosticHint", -- Changes diagnostics' hint color. - -- }, - -- symbols = { error = " ", warn = " ", info = " ", hint = " " }, - -- colored = true, -- Displays diagnostics status in color if set to true. - -- update_in_insert = false, -- Update diagnostics in insert mode. - -- always_visible = false, -- Show diagnostics even if there are none. - -- }, - }, - lualine_z = { { "location", separator = { right = "" }, left_padding = 2 } }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { "filename" }, - lualine_x = { "location" }, - lualine_y = {}, - lualine_z = {}, - }, - tabline = {}, - winbar = {}, - inactive_winbar = {}, - extensions = {}, - }) + -- diagnostics_color = { + -- -- Same values as the general color option can be used here. + -- error = "DiagnosticError", -- Changes diagnostics' error color. + -- warn = "DiagnosticWarn", -- Changes diagnostics' warn color. + -- info = "DiagnosticInfo", -- Changes diagnostics' info color. + -- hint = "DiagnosticHint", -- Changes diagnostics' hint color. + -- }, + -- symbols = { error = " ", warn = " ", info = " ", hint = " " }, + -- colored = true, -- Displays diagnostics status in color if set to true. + -- update_in_insert = false, -- Update diagnostics in insert mode. + -- always_visible = false, -- Show diagnostics even if there are none. + -- }, + }, + lualine_z = { { "location", separator = { right = "" }, left_padding = 2 } }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, + } end diff --git a/lua/plugins/neo-tree/config.lua b/lua/plugins/neo-tree/config.lua index a171d31..9ac4327 100644 --- a/lua/plugins/neo-tree/config.lua +++ b/lua/plugins/neo-tree/config.lua @@ -1,208 +1,208 @@ return function() - -- Unless you are still migrating, remove the deprecated commands from v1.x - vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + -- Unless you are still migrating, remove the deprecated commands from v1.x + vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]] - -- 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"}) + -- 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" }) - 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", - 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 - 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 - -- sort_function = function (a,b) - -- if a.type == b.type then - -- return a.path > b.path - -- else - -- return a.type > b.type - -- end - -- end , -- this sorts files and directories descendantly + 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", + 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 + 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 + -- sort_function = function (a,b) + -- if a.type == b.type then + -- return a.path > b.path + -- else + -- return a.type > b.type + -- end + -- end , -- this sorts files and directories descendantly - sources = { - "filesystem", - "buffers", - "git_status", + sources = { + "filesystem", + "buffers", + "git_status", + }, + + source_selector = { + winbar = false, + statusline = false, + }, + + default_component_configs = { + container = { + enable_character_fade = true, + }, + icon = { + folder_closed = "", + folder_open = "", + default = "*", + highlight = "NeoTreeFileIcon", + folder_empty = "󰜌", + folder_empty_open = "󰜌", + }, + modified = { + symbol = "[+]", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + 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 + untracked = "", + ignored = "", + staged = "", + conflict = "", + renamed = "󰁕", + unstaged = "󰄱", }, + }, + }, - source_selector = { - winbar = false, - statusline = false, + window = { + position = "right", + width = 35, + mapping_options = { + noremap = true, + nowait = true, + }, + mappings = { + [""] = { + "toggle_node", + nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use }, - - default_component_configs = { - container = { - enable_character_fade = true - }, - icon = { - folder_closed = "", - folder_open = "", - default = "*", - highlight = "NeoTreeFileIcon", - folder_empty = "󰜌", - folder_empty_open = "󰜌", - }, - modified = { - symbol = "[+]", - highlight = "NeoTreeModified", - }, - name = { - trailing_slash = false, - use_git_status_colors = true, - highlight = "NeoTreeFileName", - }, - git_status = { - symbols = { - 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 - untracked = "", - ignored = "", - staged = "", - conflict = "", - renamed = "󰁕", - unstaged = "󰄱", - } - }, + ["<2-LeftMouse>"] = "open", + [""] = "open", + ["o"] = "open", + [""] = "revert_preview", + ["P"] = { "toggle_preview", config = { use_float = true } }, + ["l"] = "focus_preview", + ["S"] = "open_split", + ["s"] = "open_vsplit", + ["t"] = "open_tabnew", + ["w"] = "open_with_window_picker", + ["C"] = "close_node", + ["z"] = "close_all_nodes", + ["a"] = { + "add", + config = { + 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", + ["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": + ["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", + }, + }, - window = { - position = "right", - width = 35, - mapping_options = { - noremap = true, - nowait = true, - }, - mappings = { - [""] = { - "toggle_node", - nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use - }, - ["<2-LeftMouse>"] = "open", - [""] = "open", - ["o"] = "open", - [""] = "revert_preview", - ["P"] = { "toggle_preview", config = { use_float = true } }, - ["l"] = "focus_preview", - ["S"] = "open_split", - ["s"] = "open_vsplit", - ["t"] = "open_tabnew", - ["w"] = "open_with_window_picker", - ["C"] = "close_node", - ["z"] = "close_all_nodes", - ["a"] = { - "add", - config = { - 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", - ["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": - ["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", - } + filesystem = { + filtered_items = { + visible = false, -- when true, they will just be displayed differently than normal items + hide_dotfiles = false, + hide_gitignored = false, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + --"node_modules" }, - - filesystem = { - filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items - hide_dotfiles = false, - hide_gitignored = false, - hide_hidden = true, -- only works on Windows for hidden files/directories - hide_by_name = { - --"node_modules" - }, - hide_by_pattern = { -- uses glob style patterns - --"*.meta", - --"*/src/*/tsconfig.json", - }, - always_show = { -- remains visible even if other settings would normally hide it - --".gitignored", - }, - never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show - --".DS_Store", - --"thumbs.db" - }, - never_show_by_pattern = { -- uses glob style patterns - --".null-ls_*", - }, - }, - follow_current_file = true, -- This will find and focus the file in the active buffer every - -- time the current file is changed while the tree is open. - 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 - use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events. - window = { - mappings = { - [""] = "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", - [""] = "clear_filter", - ["[g"] = "prev_git_modified", - ["]g"] = "next_git_modified", - }, - fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode - [""] = "move_cursor_down", - [""] = "move_cursor_down", - [""] = "move_cursor_up", - [""] = "move_cursor_up", - }, - }, - - commands = {} -- Add a custom command or override a global one using the same function name + hide_by_pattern = { -- uses glob style patterns + --"*.meta", + --"*/src/*/tsconfig.json", }, - - buffers = { - follow_current_file = true, -- This will find and focus the file in the active buffer every - -- time the current file is changed while the tree is open. - group_empty_dirs = true, -- when true, empty folders will be grouped together - show_unloaded = true, - window = { - mappings = { - ["bd"] = "buffer_delete", - [""] = "navigate_up", - ["."] = "set_root", - } - }, + always_show = { -- remains visible even if other settings would normally hide it + --".gitignored", }, - - git_status = { - window = { - 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", - } - } + never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show + --".DS_Store", + --"thumbs.db" }, - }) + never_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", + }, + }, + follow_current_file = true, -- This will find and focus the file in the active buffer every + -- time the current file is changed while the tree is open. + 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 + use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes + -- instead of relying on nvim autocmd events. + window = { + mappings = { + [""] = "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", + [""] = "clear_filter", + ["[g"] = "prev_git_modified", + ["]g"] = "next_git_modified", + }, + fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode + [""] = "move_cursor_down", + [""] = "move_cursor_down", + [""] = "move_cursor_up", + [""] = "move_cursor_up", + }, + }, + + commands = {}, -- Add a custom command or override a global one using the same function name + }, + + buffers = { + follow_current_file = true, -- This will find and focus the file in the active buffer every + -- time the current file is changed while the tree is open. + group_empty_dirs = true, -- when true, empty folders will be grouped together + show_unloaded = true, + window = { + mappings = { + ["bd"] = "buffer_delete", + [""] = "navigate_up", + ["."] = "set_root", + }, + }, + }, + + git_status = { + window = { + 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", + }, + }, + }, + } end diff --git a/lua/plugins/noice/config.lua b/lua/plugins/noice/config.lua index a4d630a..8db5bcf 100644 --- a/lua/plugins/noice/config.lua +++ b/lua/plugins/noice/config.lua @@ -1,97 +1,97 @@ return function() - local myopts = require("custom_opts") + local myopts = require "custom_opts" - require("noice").setup({ - cmdline = { - enabled = true, -- enables the Noice cmdline UI - view = myopts.cmdline_view, -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom - opts = {}, -- global options for the cmdline. See section on views - ---@type table - format = { - -- conceal: (default=true) This will hide the text in the cmdline that matches the pattern. - -- view: (default is cmdline view) - -- opts: any options passed to the view - -- icon_hl_group: optional hl_group for the icon - -- title: set to anything or empty string to hide - cmdline = { pattern = "^:", icon = "", lang = "vim" }, - search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" }, - search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" }, - filter = { pattern = "^:%s*!", icon = "$", lang = "bash" }, - lua = { - pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, - icon = "", - lang = "lua", - }, - help = { pattern = "^:%s*he?l?p?%s+", icon = "󰞋" }, - input = {}, -- Used by input() - -- lua = false, -- to disable a format, set to `false` - }, - }, - messages = { - -- NOTE: If you enable messages, then the cmdline is enabled automatically. - -- This is a current Neovim limitation. - enabled = not myopts.close_message_notify, -- enables the Noice messages UI - view = "mini", -- default view for messages - view_error = "notify", -- view for errors - view_warn = "notify", -- view for warnings - view_history = "messages", -- view for :messages - view_search = false, -- view for search count messages. Set to `false` to disable - }, - lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, - }, - }, - -- you can enable a preset for easier configuration - presets = { - bottom_search = true, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help - }, - views = { - cmdline_popup = { - position = { - row = "50%", - col = "50%", - }, - size = { - width = 60, - height = "auto", - }, - }, - }, - routes = { - { - filter = { - event = "msg_show", - kind = "", - find = "已写入", - }, - opts = { skip = true }, - }, - { - filter = { - event = "msg_show", - kind = "", - find = "written", - }, - opts = { skip = true }, - }, - }, - notify = { - -- Noice can be used as `vim.notify` so you can route any notification like other messages - -- Notification messages have their level and other properties set. - -- event is always "notify" and kind can be any log level as a string - -- The default routes will forward notifications to nvim-notify - -- Benefit of using Noice for this is the routing and consistent history view - enabled = true, - view = "notify", - replace = true, - }, - }) + require("noice").setup { + cmdline = { + enabled = true, -- enables the Noice cmdline UI + view = myopts.cmdline_view, -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom + opts = {}, -- global options for the cmdline. See section on views + ---@type table + format = { + -- conceal: (default=true) This will hide the text in the cmdline that matches the pattern. + -- view: (default is cmdline view) + -- opts: any options passed to the view + -- icon_hl_group: optional hl_group for the icon + -- title: set to anything or empty string to hide + cmdline = { pattern = "^:", icon = "", lang = "vim" }, + search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" }, + search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" }, + filter = { pattern = "^:%s*!", icon = "$", lang = "bash" }, + lua = { + pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, + icon = "", + lang = "lua", + }, + help = { pattern = "^:%s*he?l?p?%s+", icon = "󰞋" }, + input = {}, -- Used by input() + -- lua = false, -- to disable a format, set to `false` + }, + }, + messages = { + -- NOTE: If you enable messages, then the cmdline is enabled automatically. + -- This is a current Neovim limitation. + enabled = not myopts.close_message_notify, -- enables the Noice messages UI + view = "mini", -- default view for messages + view_error = "notify", -- view for errors + view_warn = "notify", -- view for warnings + view_history = "messages", -- view for :messages + view_search = false, -- view for search count messages. Set to `false` to disable + }, + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + views = { + cmdline_popup = { + position = { + row = "50%", + col = "50%", + }, + size = { + width = 60, + height = "auto", + }, + }, + }, + routes = { + { + filter = { + event = "msg_show", + kind = "", + find = "已写入", + }, + opts = { skip = true }, + }, + { + filter = { + event = "msg_show", + kind = "", + find = "written", + }, + opts = { skip = true }, + }, + }, + notify = { + -- Noice can be used as `vim.notify` so you can route any notification like other messages + -- Notification messages have their level and other properties set. + -- event is always "notify" and kind can be any log level as a string + -- The default routes will forward notifications to nvim-notify + -- Benefit of using Noice for this is the routing and consistent history view + enabled = true, + view = "notify", + replace = true, + }, + } end diff --git a/lua/plugins/nvim-web-devicons/config.lua b/lua/plugins/nvim-web-devicons/config.lua index 709f8f8..4387cb7 100644 --- a/lua/plugins/nvim-web-devicons/config.lua +++ b/lua/plugins/nvim-web-devicons/config.lua @@ -1,44 +1,44 @@ return function() - require('nvim-web-devicons').setup { - -- your personnal icons can go here (to override) - -- you can specify color or cterm_color instead of specifying both of them - -- DevIcon will be appended to `name` - override = { - zsh = { - icon = "", - color = "#428850", - cterm_color = "65", - name = "Zsh" - } - }; - -- globally enable different highlight colors per icon (default to true) - -- if set to false all icons will have the default icon's color - color_icons = true; - -- globally enable default icons (default to false) - -- will get overriden by `get_icons` option - default = true; - -- globally enable "strict" selection of icons - icon will be looked up in - -- different tables, first by filename, and if not found by extension; this - -- prevents cases when file doesn't have any extension but still gets some icon - -- because its name happened to match some extension (default to false) - strict = true; - -- same as `override` but specifically for overrides by filename - -- takes effect when `strict` is true - override_by_filename = { - [".gitignore"] = { - icon = "", - color = "#f1502f", - name = "Gitignore" - } - }; - -- same as `override` but specifically for overrides by extension - -- takes effect when `strict` is true - override_by_extension = { - ["log"] = { - icon = "", - color = "#81e043", - name = "Log" - } - }; - } + require("nvim-web-devicons").setup { + -- your personnal icons can go here (to override) + -- you can specify color or cterm_color instead of specifying both of them + -- DevIcon will be appended to `name` + override = { + zsh = { + icon = "", + color = "#428850", + cterm_color = "65", + name = "Zsh", + }, + }, + -- globally enable different highlight colors per icon (default to true) + -- if set to false all icons will have the default icon's color + color_icons = true, + -- globally enable default icons (default to false) + -- will get overriden by `get_icons` option + default = true, + -- globally enable "strict" selection of icons - icon will be looked up in + -- different tables, first by filename, and if not found by extension; this + -- prevents cases when file doesn't have any extension but still gets some icon + -- because its name happened to match some extension (default to false) + strict = true, + -- same as `override` but specifically for overrides by filename + -- takes effect when `strict` is true + override_by_filename = { + [".gitignore"] = { + icon = "", + color = "#f1502f", + name = "Gitignore", + }, + }, + -- same as `override` but specifically for overrides by extension + -- takes effect when `strict` is true + override_by_extension = { + ["log"] = { + icon = "", + color = "#81e043", + name = "Log", + }, + }, + } end diff --git a/lua/plugins/smart-split/config.lua b/lua/plugins/smart-split/config.lua index cfbe994..41dd643 100644 --- a/lua/plugins/smart-split/config.lua +++ b/lua/plugins/smart-split/config.lua @@ -1,19 +1,19 @@ return function() - require('smart-splits').setup({ - ignored_filetypes = { - 'nofile', - 'quickfix', - 'prompt', - 'neo-tree', - }, - ignored_buftypes = { 'NvimTree', 'neo-tree' }, - }) + require("smart-splits").setup { + ignored_filetypes = { + "nofile", + "quickfix", + "prompt", + "neo-tree", + }, + ignored_buftypes = { "NvimTree", "neo-tree" }, + } - local keys = require("custom_keys") - local opttion = {noremap = true, silent = true } + local keys = require "custom_keys" + local opttion = { noremap = true, silent = true } - vim.keymap.set({'n', 't'}, keys.resize_left, require('smart-splits').resize_left, option) - vim.keymap.set({'n', 't'}, keys.resize_down, require('smart-splits').resize_down, option) - vim.keymap.set({'n', 't'}, keys.resize_up, require('smart-splits').resize_up, option) - vim.keymap.set({'n', 't'}, keys.resize_right, require('smart-splits').resize_right, option) + vim.keymap.set({ "n", "t" }, keys.resize_left, require("smart-splits").resize_left, option) + vim.keymap.set({ "n", "t" }, keys.resize_down, require("smart-splits").resize_down, option) + vim.keymap.set({ "n", "t" }, keys.resize_up, require("smart-splits").resize_up, option) + vim.keymap.set({ "n", "t" }, keys.resize_right, require("smart-splits").resize_right, option) end diff --git a/lua/plugins/start_screen.lua b/lua/plugins/start_screen.lua index 6507ffb..58ef043 100644 --- a/lua/plugins/start_screen.lua +++ b/lua/plugins/start_screen.lua @@ -1,57 +1,57 @@ return { - { - "goolord/alpha-nvim", - requires = { "nvim-tree/nvim-web-devicons" }, - setup = function() - vim.g.alpha_statusline = false - end, - config = function() - local dashboard = require("alpha.themes.dashboard") + { + "goolord/alpha-nvim", + requires = { "nvim-tree/nvim-web-devicons" }, + setup = function() + vim.g.alpha_statusline = false + end, + config = function() + local dashboard = require "alpha.themes.dashboard" - -- header, it's a logo - dashboard.section.header.val = require("custom_opts").home_header - dashboard.section.header.opts.hl = "HardHackerRed" + -- header, it's a logo + dashboard.section.header.val = require("custom_opts").home_header + dashboard.section.header.opts.hl = "HardHackerRed" - -- footer - local handle = io.popen("fortune") - local fortune = handle:read("*a") - handle:close() - dashboard.section.footer.val = fortune + -- footer + local handle = io.popen "fortune" + local fortune = handle:read "*a" + handle:close() + dashboard.section.footer.val = fortune - -- button - local create_button = function(key, desc, action) - local b = dashboard.button(key, desc, action) - b.opts.hl = "HardHackerComment" - b.opts.hl_shortcut = "HardHackerComment" - b.opts.width = 40 - return b - end - dashboard.section.buttons.val = { - create_button("f", " New file", ":ene startinsert "), - create_button("s", " Load last session", ":SessionManager load_last_session"), - -- create_button("e", " Select session", ":SessionManager load_session"), - create_button( - "c", - " Open current directory", - ":Neotree position=left source=filesystem action=focus toggle=true" - ), - create_button("q", "󰗼 Quit", ":qa"), - } + -- button + local create_button = function(key, desc, action) + local b = dashboard.button(key, desc, action) + b.opts.hl = "HardHackerComment" + b.opts.hl_shortcut = "HardHackerComment" + b.opts.width = 40 + return b + end + dashboard.section.buttons.val = { + create_button("f", " New file", ":ene startinsert "), + create_button("s", " Load last session", ":SessionManager load_last_session"), + -- create_button("e", " Select session", ":SessionManager load_session"), + create_button( + "c", + " Open current directory", + ":Neotree position=left source=filesystem action=focus toggle=true" + ), + create_button("q", "󰗼 Quit", ":qa"), + } - -- config - dashboard.config.layout[1].val = vim.fn.max({ 3, vim.fn.floor(vim.fn.winheight(0) * 0.3) }) - dashboard.config.layout[3].val = 5 - dashboard.config.opts.noautocmd = true + -- config + dashboard.config.layout[1].val = vim.fn.max { 3, vim.fn.floor(vim.fn.winheight(0) * 0.3) } + dashboard.config.layout[3].val = 5 + dashboard.config.opts.noautocmd = true - require("alpha").setup(dashboard.config) + require("alpha").setup(dashboard.config) - -- disable the tabline & statusline in alpha dashboard screen - vim.cmd([[ + -- disable the tabline & statusline in alpha dashboard screen + vim.cmd [[ autocmd User AlphaReady set showtabline=0 | autocmd BufUnload set showtabline=2 autocmd User AlphaReady set laststatus=0 | autocmd BufUnload set laststatus=3 autocmd User AlphaReady :NeoTreeClose autocmd User AlphaReady :AerialCloseAll - ]]) - end, - }, + ]] + end, + }, } diff --git a/lua/plugins/terminal.lua b/lua/plugins/terminal.lua index 9aee9d0..1066f5b 100644 --- a/lua/plugins/terminal.lua +++ b/lua/plugins/terminal.lua @@ -1,53 +1,53 @@ return { - { - "akinsho/toggleterm.nvim", - version = "*", - config = function() - local copts = require("custom_opts") + { + "akinsho/toggleterm.nvim", + version = "*", + config = function() + local copts = require "custom_opts" - require("toggleterm").setup({ - size = function(term) - if term.direction == "horizontal" then - return 15 - elseif term.direction == "vertical" then - return vim.o.columns * 0.4 - end - end, - highlights = { - Normal = { - link = "Normal", - }, - NormalFloat = { - link = "Normal", - }, - FloatBorder = { - link = "FloatBorder", - }, - SignColumn = { - link = "EndOfBuffer", - }, - EndOfBuffer = { - link = "EndOfBuffer", - }, - }, - float_opts = { - border = "rounded", - -- winblend = copts.window_transparency, - width = function(term) - local columns = vim.api.nvim_get_option("columns") - local w = math.floor(columns * copts.terminal_size) - return (w < 20) and 20 or w - end, - height = function(term) - local lines = vim.api.nvim_get_option("lines") - local h = math.floor(lines * (copts.terminal_size + 0.1)) - return (h < 35) and 35 or h - end, - }, - persist_size = true, - persist_mode = true, - autochdir = true, - }) - end, - }, + require("toggleterm").setup { + size = function(term) + if term.direction == "horizontal" then + return 15 + elseif term.direction == "vertical" then + return vim.o.columns * 0.4 + end + end, + highlights = { + Normal = { + link = "Normal", + }, + NormalFloat = { + link = "Normal", + }, + FloatBorder = { + link = "FloatBorder", + }, + SignColumn = { + link = "EndOfBuffer", + }, + EndOfBuffer = { + link = "EndOfBuffer", + }, + }, + float_opts = { + border = "rounded", + -- winblend = copts.window_transparency, + width = function(term) + local columns = vim.api.nvim_get_option "columns" + local w = math.floor(columns * copts.terminal_size) + return (w < 20) and 20 or w + end, + height = function(term) + local lines = vim.api.nvim_get_option "lines" + local h = math.floor(lines * (copts.terminal_size + 0.1)) + return (h < 35) and 35 or h + end, + }, + persist_size = true, + persist_mode = true, + autochdir = true, + } + end, + }, } diff --git a/lua/plugins/utils.lua b/lua/plugins/utils.lua index a63a6c3..f68c756 100644 --- a/lua/plugins/utils.lua +++ b/lua/plugins/utils.lua @@ -1,104 +1,104 @@ return { - { "rcarriga/nvim-notify" }, + { "rcarriga/nvim-notify" }, - -- resize the window - { - "mrjones2014/smart-splits.nvim", - version = "v1.2.2", - config = function() - require("plugins/smart-split/config")() - end, - }, + -- resize the window + { + "mrjones2014/smart-splits.nvim", + version = "v1.2.2", + config = function() + require "plugins/smart-split/config"() + end, + }, - -- buffer delete - { "famiu/bufdelete.nvim" }, + -- buffer delete + { "famiu/bufdelete.nvim" }, - -- session - { - "Shatur/neovim-session-manager", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - local Path = require("plenary.path") - local config = require("session_manager.config") - require("session_manager").setup({ - sessions_dir = Path:new(vim.fn.stdpath("data"), "sessions"), -- The directory where the session files will be saved. - session_filename_to_dir = session_filename_to_dir, -- Function that replaces symbols into separators and colons to transform filename into a session directory. - dir_to_session_filename = dir_to_session_filename, -- Function that replaces separators and colons into special symbols to transform session directory into a filename. Should use `vim.loop.cwd()` if the passed `dir` is `nil`. - autoload_mode = config.AutoloadMode.Disabled, -- Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession - autosave_last_session = true, -- Automatically save last session on exit and on session switch. - autosave_ignore_not_normal = true, -- Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed. - autosave_ignore_dirs = { "/", "~", "/tmp/" }, -- A list of directories where the session will not be autosaved. - autosave_ignore_filetypes = { -- All buffers of these file types will be closed before the session is saved. - "gitcommit", - "gitrebase", - }, - autosave_ignore_buftypes = {}, -- All buffers of these bufer types will be closed before the session is saved. - autosave_only_in_session = false, -- Always autosaves session. If true, only autosaves after a session is active. - max_path_length = 80, -- Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all. - }) + -- session + { + "Shatur/neovim-session-manager", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local Path = require "plenary.path" + local config = require "session_manager.config" + require("session_manager").setup { + sessions_dir = Path:new(vim.fn.stdpath "data", "sessions"), -- The directory where the session files will be saved. + session_filename_to_dir = session_filename_to_dir, -- Function that replaces symbols into separators and colons to transform filename into a session directory. + dir_to_session_filename = dir_to_session_filename, -- Function that replaces separators and colons into special symbols to transform session directory into a filename. Should use `vim.loop.cwd()` if the passed `dir` is `nil`. + autoload_mode = config.AutoloadMode.Disabled, -- Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession + autosave_last_session = true, -- Automatically save last session on exit and on session switch. + autosave_ignore_not_normal = true, -- Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed. + autosave_ignore_dirs = { "/", "~", "/tmp/" }, -- A list of directories where the session will not be autosaved. + autosave_ignore_filetypes = { -- All buffers of these file types will be closed before the session is saved. + "gitcommit", + "gitrebase", + }, + autosave_ignore_buftypes = {}, -- All buffers of these bufer types will be closed before the session is saved. + autosave_only_in_session = false, -- Always autosaves session. If true, only autosaves after a session is active. + max_path_length = 80, -- Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all. + } - -- automatic open neotree sidebar when a session opened - local hardhacker_config_group = vim.api.nvim_create_augroup("HardHackerConfigGroup", {}) - vim.api.nvim_create_autocmd({ "User" }, { - pattern = "SessionLoadPost", - group = hardhacker_config_group, - callback = function() - vim.api.nvim_command("Neotree position=left source=filesystem action=show") - end, - }) - end, - }, - -- zen-mode - { - "folke/zen-mode.nvim", - opts = { - window = { - backdrop = 1, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal - -- height and width can be: - -- * an absolute number of cells when > 1 - -- * a percentage of the width / height of the editor when <= 1 - -- * a function that returns the width or the height - width = 120, -- width of the Zen window - height = 0.9, -- height of the Zen window - -- by default, no options are changed for the Zen window - -- uncomment any of the options below, or add other vim.wo options you want to apply - options = { - signcolumn = "no", -- disable signcolumn - number = false, -- disable number column - relativenumber = false, -- disable relative numbers - cursorline = false, -- disable cursorline - cursorcolumn = false, -- disable cursor column - foldcolumn = "0", -- disable fold column - list = false, -- disable whitespace characters - }, - }, - -- callback where you can add custom code when the Zen window opens - on_open = function(win) end, - -- callback where you can add custom code when the Zen window closes - on_close = function() end, - }, - }, - { - "folke/twilight.nvim", - opts = { - dimming = { - alpha = 0.25, -- amount of dimming - -- we try to get the foreground from the highlight groups or fallback color - -- color = { "Normal", "#eee9fc" }, - -- term_bg = "#000000", -- if guibg=NONE, this will be used to calculate text color - inactive = false, -- when true, other windows will be fully dimmed (unless they contain the same buffer) - }, - context = 10, -- amount of lines we will try to show around the current line - treesitter = true, -- use treesitter when available for the filetype - -- treesitter is used to automatically expand the visible text, - -- but you can further control the types of nodes that should always be fully expanded - expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types - "function", - "method", - "table", - "if_statement", - }, - exclude = {}, -- exclude these filetypes - }, - }, + -- automatic open neotree sidebar when a session opened + local hardhacker_config_group = vim.api.nvim_create_augroup("HardHackerConfigGroup", {}) + vim.api.nvim_create_autocmd({ "User" }, { + pattern = "SessionLoadPost", + group = hardhacker_config_group, + callback = function() + vim.api.nvim_command "Neotree position=left source=filesystem action=show" + end, + }) + end, + }, + -- zen-mode + { + "folke/zen-mode.nvim", + opts = { + window = { + backdrop = 1, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal + -- height and width can be: + -- * an absolute number of cells when > 1 + -- * a percentage of the width / height of the editor when <= 1 + -- * a function that returns the width or the height + width = 120, -- width of the Zen window + height = 0.9, -- height of the Zen window + -- by default, no options are changed for the Zen window + -- uncomment any of the options below, or add other vim.wo options you want to apply + options = { + signcolumn = "no", -- disable signcolumn + number = false, -- disable number column + relativenumber = false, -- disable relative numbers + cursorline = false, -- disable cursorline + cursorcolumn = false, -- disable cursor column + foldcolumn = "0", -- disable fold column + list = false, -- disable whitespace characters + }, + }, + -- callback where you can add custom code when the Zen window opens + on_open = function(win) end, + -- callback where you can add custom code when the Zen window closes + on_close = function() end, + }, + }, + { + "folke/twilight.nvim", + opts = { + dimming = { + alpha = 0.25, -- amount of dimming + -- we try to get the foreground from the highlight groups or fallback color + -- color = { "Normal", "#eee9fc" }, + -- term_bg = "#000000", -- if guibg=NONE, this will be used to calculate text color + inactive = false, -- when true, other windows will be fully dimmed (unless they contain the same buffer) + }, + context = 10, -- amount of lines we will try to show around the current line + treesitter = true, -- use treesitter when available for the filetype + -- treesitter is used to automatically expand the visible text, + -- but you can further control the types of nodes that should always be fully expanded + expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types + "function", + "method", + "table", + "if_statement", + }, + exclude = {}, -- exclude these filetypes + }, + }, } diff --git a/lua/plugins/view.lua b/lua/plugins/view.lua index 42b7219..450c236 100644 --- a/lua/plugins/view.lua +++ b/lua/plugins/view.lua @@ -1,101 +1,101 @@ return { - -- winbar - { - "utilyre/barbecue.nvim", - name = "barbecue", - version = "*", - dependencies = { - "SmiteshP/nvim-navic", - "nvim-tree/nvim-web-devicons", -- optional dependency - }, - config = function() - require("barbecue").setup({ - create_autocmd = false, -- prevent barbecue from updating itself automatically - theme = vim.g.hardhacker_barbecue_theme, - }) + -- winbar + { + "utilyre/barbecue.nvim", + name = "barbecue", + version = "*", + dependencies = { + "SmiteshP/nvim-navic", + "nvim-tree/nvim-web-devicons", -- optional dependency + }, + config = function() + require("barbecue").setup { + create_autocmd = false, -- prevent barbecue from updating itself automatically + theme = vim.g.hardhacker_barbecue_theme, + } - vim.api.nvim_create_autocmd({ - "WinScrolled", -- or WinResized on NVIM-v0.9 and higher - "BufWinEnter", - "CursorHold", - "InsertLeave", + vim.api.nvim_create_autocmd({ + "WinScrolled", -- or WinResized on NVIM-v0.9 and higher + "BufWinEnter", + "CursorHold", + "InsertLeave", - -- include this if you have set `show_modified` to `true` - "BufModifiedSet", - }, { - group = vim.api.nvim_create_augroup("barbecue.updater", {}), - callback = function() - require("barbecue.ui").update() - end, - }) - end, - }, + -- include this if you have set `show_modified` to `true` + "BufModifiedSet", + }, { + group = vim.api.nvim_create_augroup("barbecue.updater", {}), + callback = function() + require("barbecue.ui").update() + end, + }) + end, + }, - -- Status line - { - "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons", opt = true }, - config = function() - require("plugins/lualine/config")() - end, - }, + -- Status line + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", opt = true }, + config = function() + require "plugins/lualine/config"() + end, + }, - -- File explorer - { - "nvim-neo-tree/neo-tree.nvim", - branch = "v2.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - }, - config = function() - require("plugins/neo-tree/config")() - end, - }, + -- File explorer + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v2.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function() + require "plugins/neo-tree/config"() + end, + }, - -- Outline - { - "stevearc/aerial.nvim", - opts = {}, - -- Optional dependencies - dependencies = { - "nvim-treesitter/nvim-treesitter", - "nvim-tree/nvim-web-devicons", - }, - config = function() - require("aerial").setup({ - lazy_load = false, - open_automatic = require("custom_opts").auto_open_outline, - }) - end, - }, + -- Outline + { + "stevearc/aerial.nvim", + opts = {}, + -- Optional dependencies + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("aerial").setup { + lazy_load = false, + open_automatic = require("custom_opts").auto_open_outline, + } + end, + }, - -- Tab line - { - "akinsho/bufferline.nvim", - version = "v4.1.0", - dependencies = "nvim-tree/nvim-web-devicons", - config = function() - require("plugins/bufferline/config")() - end, - }, + -- Tab line + { + "akinsho/bufferline.nvim", + version = "v4.1.0", + dependencies = "nvim-tree/nvim-web-devicons", + config = function() + require "plugins/bufferline/config"() + end, + }, - -- cmd line - { - "folke/noice.nvim", - dependencies = { - "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", - }, - config = function() - require("plugins/noice/config")() - end, - }, + -- cmd line + { + "folke/noice.nvim", + dependencies = { + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + }, + config = function() + require "plugins/noice/config"() + end, + }, - -- Improve the ui - { - "stevearc/dressing.nvim", - opts = {}, - }, + -- Improve the ui + { + "stevearc/dressing.nvim", + opts = {}, + }, }