diff --git a/.stylelua.toml b/.stylelua.toml new file mode 100644 index 0000000..86584ee --- /dev/null +++ b/.stylelua.toml @@ -0,0 +1,4 @@ +indent_type = "Spaces" +indent_width = 2 +[sort_requires] +enabled = true diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index 5950a51..0f57e24 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -2,49 +2,47 @@ vim.opt.number = true 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) require("lazy").setup("plugins") -require("telescope").load_extension "file_browser" +require("telescope").load_extension("file_browser") local wk = require("which-key") wk.register({ - f = { - name = "file", - f = { "Telescope find_files", "Find File" }, - g = { "Telescope live_grep", "Grep Files" }, - r = { "Telescope oldfiles", "Open Recent File" }, - }, - d = { - name = "dir", - f = { "Telescope file_browser", "Find Directory" }, - r = { "NvimTreeFindFile!", "Root Here" }, - t = { "NvimTreeToggle", "Toggle Tree"}, - }, - b = { - name = "browser", - o = { "BrowserPreview", "Open Browser" }, - }, - g = { - name = "git", - g = { "LazyGit", "LazyGit" }, - }, + f = { + name = "file", + f = { "Telescope find_files", "Find File" }, + g = { "Telescope live_grep", "Grep Files" }, + r = { "Telescope oldfiles", "Open Recent File" }, + }, + d = { + name = "dir", + f = { "Telescope file_browser", "Find Directory" }, + r = { "NvimTreeFindFile!", "Root Here" }, + t = { "NvimTreeToggle", "Toggle Tree" }, + }, + b = { + name = "browser", + o = { "BrowserPreview", "Open Browser" }, + }, + g = { + name = "git", + g = { "LazyGit", "LazyGit" }, + }, }, { prefix = "" }) wk.register({ - ["B"] = { name = "+buffer"}, - ["B,"] = { "BufferPrevious", "Previous Tab" }, - ["B."] = { "BufferNext", "Next Tab" }, + ["B"] = { name = "+buffer" }, + ["B,"] = { "BufferPrevious", "Previous Tab" }, + ["B."] = { "BufferNext", "Next Tab" }, }) - - diff --git a/dot_config/nvim/lua/plugins/formatter.lua b/dot_config/nvim/lua/plugins/formatter.lua index a5dece7..49b0324 100644 --- a/dot_config/nvim/lua/plugins/formatter.lua +++ b/dot_config/nvim/lua/plugins/formatter.lua @@ -1,5 +1,23 @@ return { - { 'steevearc/conform.nvim', - opts = {}, - } + "stevearc/conform.nvim", + lazy = true, + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + keys = { + { + -- Customize or remove this keymap to your liking + "c", + function() + require("conform").format({ async = true, lsp_fallback = true }) + end, + mode = "", + desc = "Format buffer", + }, + }, + opts = { + formatters_by_ft = { + lua = { "styleua" }, + }, + format_on_save = { timeout_ms = 500, lsp_fallback = true }, + }, } diff --git a/dot_config/nvim/lua/plugins/keybinds.lua b/dot_config/nvim/lua/plugins/keybinds.lua index 65c0a25..ea6ff85 100644 --- a/dot_config/nvim/lua/plugins/keybinds.lua +++ b/dot_config/nvim/lua/plugins/keybinds.lua @@ -1,9 +1,11 @@ return { - { "folke/which-key.nvim", - event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - end, - opts = {} } -} + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = {}, + }, +} diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua index edcf66e..807e228 100644 --- a/dot_config/nvim/lua/plugins/lsp.lua +++ b/dot_config/nvim/lua/plugins/lsp.lua @@ -1,73 +1,77 @@ return { - { 'neovim/nvim-lspconfig', priority = 1, - config = function() - local lspconfig = require('lspconfig') - lspconfig.tsserver.setup {} - lspconfig.rust_analyzer.setup {} - lspconfig.html.setup {} - end }, - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - { 'williamboman/mason.nvim', priority = 51, opts = {} }, - { 'williamboman/mason-lspconfig.nvim', - opts = { automatic_installation = true } }, - { 'hrsh7th/nvim-cmp', - config = function() - local cmp = require('cmp') - - cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - end, - }, - window = { - -- completion = cmp.config.window.bordered(), - -- documentation = cmp.config.window.bordered(), - }, - 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 = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - { name = 'buffer' }, + { + "neovim/nvim-lspconfig", + priority = 1, + config = function() + local lspconfig = require("lspconfig") + lspconfig.tsserver.setup({}) + lspconfig.rust_analyzer.setup({}) + lspconfig.html.setup({}) + end, + }, + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + { "williamboman/mason.nvim", priority = 51, opts = {} }, + { "williamboman/mason-lspconfig.nvim", opts = { automatic_installation = true } }, + { + "hrsh7th/nvim-cmp", + config = function() + local cmp = require("cmp") + + cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + end, + }, + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + 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 = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "vsnip" }, -- For vsnip users. + { name = "buffer" }, + }), + }) + + -- Set configuration for specific filetype. + cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). + }, { + { name = "buffer" }, + }), }) - }) - -- Set configuration for specific filetype. - cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). - }, { - { name = 'buffer' }, + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, }) - }) - - -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } - }) - - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), }) - }) - end }, + end, + }, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, } diff --git a/dot_config/nvim/lua/plugins/theme.lua b/dot_config/nvim/lua/plugins/theme.lua index c311aeb..97cf2b3 100644 --- a/dot_config/nvim/lua/plugins/theme.lua +++ b/dot_config/nvim/lua/plugins/theme.lua @@ -12,8 +12,14 @@ return { require('vscode').load() end }, - ]]-- - { "EdenEast/nightfox.nvim", init = function() vim.cmd.colorscheme "nordfox" end }, + ]] + -- + { + "EdenEast/nightfox.nvim", + init = function() + vim.cmd.colorscheme("nordfox") + end, + }, --[[ { "catppuccin/nvim", name = "catppuccin", @@ -21,5 +27,6 @@ return { init = function() vim.cmd.colorscheme "catppuccin" end, opts = { flavour = "frappe" } } - ]]-- + ]] + -- } diff --git a/dot_config/nvim/lua/plugins/ui.lua b/dot_config/nvim/lua/plugins/ui.lua index b6f1f55..b998b25 100644 --- a/dot_config/nvim/lua/plugins/ui.lua +++ b/dot_config/nvim/lua/plugins/ui.lua @@ -1,64 +1,93 @@ return { - { 'nvim-telescope/telescope.nvim', tag = '0.1.5', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { - extensions = { - file_browser = { - hijack_netrw = true, - } - } - } }, { - "nvim-telescope/telescope-file-browser.nvim", - dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" } + "nvim-telescope/telescope.nvim", + tag = "0.1.5", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + extensions = { + file_browser = { + hijack_netrw = true, + }, + }, + }, }, - { 'nvim-tree/nvim-tree.lua', dependencies = { 'nvim-tree/nvim-web-devicons' }, config = true }, - { 'lewis6991/gitsigns.nvim', config = true }, - { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = { - exclude = { - filetypes = { "lspinfo", "packer", "checkhealth", "help", "man", "gitcommit", "TelescopePrompt", "TelescopeResults", "dashboard" } - } - } }, - { - 'romgrk/barbar.nvim', - dependencies = { 'lewis6991/gitsigns.nvim', 'nvim-tree/nvim-web-devicons' }, - init = function() vim.g.barbar_auto_setup = false end, - config = true, + { + "nvim-telescope/telescope-file-browser.nvim", + dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }, }, - { - 'nvim-lualine/lualine.nvim', - dependencies = { 'nvim-tree/nvim-web-devicons' }, - opts = { options = { icons_enabled = true, theme = 'auto' } }, + { "nvim-tree/nvim-tree.lua", dependencies = { "nvim-tree/nvim-web-devicons" }, config = true }, + { "lewis6991/gitsigns.nvim", config = true }, + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = { + exclude = { + filetypes = { + "lspinfo", + "packer", + "checkhealth", + "help", + "man", + "gitcommit", + "TelescopePrompt", + "TelescopeResults", + "dashboard", + }, + }, + }, }, - { 'nvimdev/dashboard-nvim', event = 'VimEnter', config = true, requires = { 'nvim-tree/nvim-web-devicons' }, opts = { - excludes = { - filetype = {"lspinfo", "packer", "checkhealth", "help", "", "dashboard"} - } - } }, { - 'kdheepak/lazygit.nvim', - dependencies = { 'nvim-lua/plenary.nvim' } + "romgrk/barbar.nvim", + dependencies = { "lewis6991/gitsigns.nvim", "nvim-tree/nvim-web-devicons" }, + init = function() + vim.g.barbar_auto_setup = false + end, + config = true, }, { - "folke/noice.nvim", - event = "VeryLazy", - opts = { - presets = { - inc_rename = true, - lsp_doc_border = true, - command_palette = true, - } - }, - dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" } + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = { options = { icons_enabled = true, theme = "auto" } }, }, { - "epwalsh/obsidian.nvim", - version = "*", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { - workspaces = { - { name = "mine", path = "~/Library/Mobile Documents/iCloud~md~Obsidian/Documents/harryob" } - }, - ui = { enable = false }, - note_id_func = function(title) return title end - } - } + "nvimdev/dashboard-nvim", + event = "VimEnter", + config = true, + requires = { "nvim-tree/nvim-web-devicons" }, + opts = { + excludes = { + filetype = { "lspinfo", "packer", "checkhealth", "help", "", "dashboard" }, + }, + }, + }, + { + "kdheepak/lazygit.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + presets = { + inc_rename = true, + lsp_doc_border = true, + command_palette = true, + }, + }, + dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" }, + }, + { + "epwalsh/obsidian.nvim", + version = "*", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + workspaces = { + { name = "mine", path = "~/Library/Mobile Documents/iCloud~md~Obsidian/Documents/harryob" }, + }, + ui = { enable = false }, + note_id_func = function(title) + return title + end, + }, + }, } diff --git a/dot_config/nvim/lua/plugins/webdev.lua b/dot_config/nvim/lua/plugins/webdev.lua index 4ac8eb0..4ef80a8 100644 --- a/dot_config/nvim/lua/plugins/webdev.lua +++ b/dot_config/nvim/lua/plugins/webdev.lua @@ -1,18 +1,20 @@ return { - { "ray-x/web-tools.nvim", opts = { - keymaps = { - rename = nil, -- by default use same setup of lspconfig - repeat_rename = '.', -- . to repeat - }, - hurl = { -- hurl default - show_headers = false, -- do not show http headers - floating = false, -- use floating windows (need guihua.lua) - json5 = false, -- use json5 parser require json5 treesitter - formatters = { -- format the result by filetype - json = { 'jq' }, - html = { 'prettier', '--parser', 'html' }, - }, - }, - } - } + { + "ray-x/web-tools.nvim", + opts = { + keymaps = { + rename = nil, -- by default use same setup of lspconfig + repeat_rename = ".", -- . to repeat + }, + hurl = { -- hurl default + show_headers = false, -- do not show http headers + floating = false, -- use floating windows (need guihua.lua) + json5 = false, -- use json5 parser require json5 treesitter + formatters = { -- format the result by filetype + json = { "jq" }, + html = { "prettier", "--parser", "html" }, + }, + }, + }, + }, } diff --git a/dot_config/wezterm/wezterm.lua b/dot_config/wezterm/wezterm.lua index 1b4cbd2..6b47f15 100644 --- a/dot_config/wezterm/wezterm.lua +++ b/dot_config/wezterm/wezterm.lua @@ -1,13 +1,13 @@ -local wezterm = require 'wezterm' +local wezterm = require("wezterm") local colors = wezterm.color.load_scheme(wezterm.home_dir .. "/.theme/nightfox.nvim/extra/nordfox/wezterm.toml") return { - window_decorations = "RESIZE", - font = wezterm.font('JetBrains Mono'), - initial_cols = 100, - initial_rows = 25, - colors = colors, - use_fancy_tab_bar = false, - hide_tab_bar_if_only_one_tab = true, + window_decorations = "RESIZE", + font = wezterm.font("JetBrains Mono"), + initial_cols = 100, + initial_rows = 25, + colors = colors, + use_fancy_tab_bar = false, + hide_tab_bar_if_only_one_tab = true, }