updated formatting

This commit is contained in:
2024-11-01 14:22:50 -04:00
parent f171a9b77e
commit e1cc00c19a
5 changed files with 81 additions and 73 deletions
+5 -4
View File
@@ -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"
+5 -1
View File
@@ -26,10 +26,14 @@ return {
dashboard.button("SPC ee", " > Toggle file explorer", "<cmd>NvimTreeToggle<CR>"),
dashboard.button("SPC ff", "󰱼 > Find File", "<cmd>Telescope find_files<CR>"),
dashboard.button("SPC fs", " > Find Word", "<cmd>Telescope live_grep<CR>"),
dashboard.button("SPC wr", "󰁯 > Restore Session For Current Directory", "<cmd>SessionRestore<CR>"),
dashboard.button("SPC wl", "󰁯 > Restore a Previous Session", "<cmd>SessionSearch<CR>"),
dashboard.button("q", " > Quit NVIM", "<cmd>qa<CR>"),
}
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)
+15 -12
View File
@@ -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 {
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = false }),
}),
sources = cmp.config.sources({
["<CR>"] = 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,
}
+5 -6
View File
@@ -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" }, "<leader>mp", function()
conform.format({
conform.format {
lsp_fallback = true,
async = false,
timeout_ms = 1000,
})
}
end, { desc = "Format file or range (in visual mode)" })
end,
}
+51 -50
View File
@@ -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 = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
})
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 = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
}
end,
}