diff --git a/.config/nvim/lua/core/options.lua b/.config/nvim/lua/core/options.lua index deae6b1..83324ca 100644 --- a/.config/nvim/lua/core/options.lua +++ b/.config/nvim/lua/core/options.lua @@ -1,4 +1,4 @@ -vim.cmd("let g:netrw_liststyle = 3") +vim.cmd "let g:netrw_liststyle = 3" local opt = vim.opt @@ -20,7 +20,7 @@ opt.wrap = false -- search opt.ignorecase = true opt.smartcase = true -opt.iskeyword:append("-") -- consider string-string as a whole word +opt.iskeyword:append "-" -- consider string-string as a whole word -- cursor line opt.cursorline = true @@ -35,12 +35,13 @@ opt.colorcolumn = "90" opt.backspace = "indent,eol,start" -- clipboard -opt.clipboard:append("unnamedplus") -- use system clipboard as the default register +opt.clipboard:append "unnamedplus" -- use system clipboard as the default register -- split windows opt.splitright = true opt.splitbelow = true -- save me -opt.undodir = os.getenv("HOME") .. "/.config/nvim/.undo" +opt.undodir = os.getenv "HOME" .. "/.config/nvim/.undo" opt.undofile = true +opt.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" diff --git a/.config/nvim/lua/plugins/alpha.lua b/.config/nvim/lua/plugins/alpha.lua index fc0bde0..f3d4a95 100644 --- a/.config/nvim/lua/plugins/alpha.lua +++ b/.config/nvim/lua/plugins/alpha.lua @@ -26,10 +26,14 @@ return { dashboard.button("SPC ee", " > Toggle file explorer", "NvimTreeToggle"), dashboard.button("SPC ff", "󰱼 > Find File", "Telescope find_files"), dashboard.button("SPC fs", " > Find Word", "Telescope live_grep"), - dashboard.button("SPC wr", "󰁯 > Restore Session For Current Directory", "SessionRestore"), + dashboard.button("SPC wl", "󰁯 > Restore a Previous Session", "SessionSearch"), dashboard.button("q", " > Quit NVIM", "qa"), } + local handle = io.popen "fortune" + local fortune = handle:read "*a" + handle:close() + dashboard.section.footer.val = fortune -- Send config to alpha alpha.setup(dashboard.opts) diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua index 39dba20..c7a060f 100644 --- a/.config/nvim/lua/plugins/nvim-cmp.lua +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -15,13 +15,13 @@ return { }, config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - local lspkind = require("lspkind") + local cmp = require "cmp" + local luasnip = require "luasnip" + local lspkind = require "lspkind" require("luasnip.loaders.from_vscode").lazy_load() - cmp.setup({ + cmp.setup { completion = { completeopt = "menu,menuone,preview,noselect", }, @@ -30,27 +30,30 @@ return { luasnip.lsp_expand(args.body) end, }, - mapping = cmp.mapping.preset.insert({ + mapping = cmp.mapping.preset.insert { [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = false }), - }), - sources = cmp.config.sources({ + [""] = cmp.mapping.confirm { select = false }, + }, + sources = cmp.config.sources { { name = "nvim_lsp" }, { name = "luasnip" }, { name = "buffer" }, { name = "path" }, - }), + }, formatting = { - format = lspkind.cmp_format({ + format = lspkind.cmp_format { + mode = "text", + preset = "codeicons", maxwidth = 50, ellipsis_char = "...", - }), + show_labelDetails = false, + }, }, - }) + } end, } diff --git a/.config/nvim/lua/plugins/prettier.lua b/.config/nvim/lua/plugins/prettier.lua index 85744b0..14e3c6e 100644 --- a/.config/nvim/lua/plugins/prettier.lua +++ b/.config/nvim/lua/plugins/prettier.lua @@ -1,11 +1,10 @@ return { "stevearc/conform.nvim", event = { "BufReadPre", "BufNewFile" }, - config = function() - local conform = require("conform") + local conform = require "conform" - conform.setup({ + conform.setup { formatters_by_ft = { javascript = { "prettier" }, typescript = { "prettier" }, @@ -27,14 +26,14 @@ return { async = false, timeout_ms = 1000, }, - }) + } vim.keymap.set({ "n", "v" }, "mp", function() - conform.format({ + conform.format { lsp_fallback = true, async = false, timeout_ms = 1000, - }) + } end, { desc = "Format file or range (in visual mode)" }) end, } diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index 750062e..a0976e0 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -6,55 +6,56 @@ return { "windwp/nvim-ts-autotag", }, config = function() - local treesitter = require("nvim-treesitter.configs") + local treesitter = require "nvim-treesitter.configs" - treesitter.setup({ - highlight = { - enable = true, - }, - indent = { enable = true }, - autotag = { enable = true }, - ensure_installed = { - "bash", - "cmake", - "cpp", - "css", - "diff", - "dockerfile", - "git_config", - "git_rebase", - "gitcommit", - "gitignore", - "graphql", - "html", - "javascript", - "json", - "lua", - "markdown", - "markdown_inline", - "nginx", - "perl", - "php", - "python", - "regex", - "sql", - "ssh_config", - "todotxt", - "typescript", - "vim", - "xml", - "yaml", - }, - auto_install = true, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - }) - end, + treesitter.setup { + highlight = { + enable = true, + }, + indent = { enable = true }, + autotag = { enable = true }, + ensure_installed = { + "bash", + "cmake", + "cpp", + "css", + "diff", + "dockerfile", + "git_config", + "git_rebase", + "gitcommit", + "gitignore", + "graphql", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "nginx", + "perl", + "php", + "python", + "regex", + "sql", + "ssh_config", + "todotxt", + "typescript", + "vim", + "vimdoc", + "xml", + "yaml", + }, + auto_install = true, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + } + end, }