mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
ref(nvim): stylua
This commit is contained in:
parent
f115a84799
commit
531862a6c4
20 changed files with 369 additions and 369 deletions
|
|
@ -2,14 +2,14 @@ local plugins = {
|
|||
----------------------
|
||||
-- Misc / utilities --
|
||||
----------------------
|
||||
"nvim-tree/nvim-web-devicons", -- Icons
|
||||
"tpope/vim-sleuth", -- Tab / Space detection
|
||||
"tpope/vim-surround", -- Surround motions
|
||||
"tpope/vim-fugitive", -- Git util
|
||||
{ "windwp/nvim-autopairs", event = "InsertEnter" }, -- Pair symbols
|
||||
"mbbill/undotree", -- Treeview of history
|
||||
"godlygeek/tabular", -- Vertical alignment
|
||||
{ "stevearc/oil.nvim", dependencies = "nvim-tree/nvim-web-devicons" }, -- File manager
|
||||
"nvim-tree/nvim-web-devicons", -- Icons
|
||||
"tpope/vim-sleuth", -- Tab / Space detection
|
||||
"tpope/vim-surround", -- Surround motions
|
||||
"tpope/vim-fugitive", -- Git util
|
||||
{ "windwp/nvim-autopairs", event = "InsertEnter" }, -- Pair symbols
|
||||
"mbbill/undotree", -- Treeview of history
|
||||
"godlygeek/tabular", -- Vertical alignment
|
||||
{ "stevearc/oil.nvim", dependencies = "nvim-tree/nvim-web-devicons" }, -- File manager
|
||||
-- `gc` to comment
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
|
|
@ -20,7 +20,7 @@ local plugins = {
|
|||
{
|
||||
"ggandor/leap.nvim",
|
||||
dependencies = "tpope/vim-repeat",
|
||||
config = function() require "leap".add_default_mappings() end,
|
||||
config = function() require("leap").add_default_mappings() end,
|
||||
},
|
||||
-- Folding
|
||||
{
|
||||
|
|
@ -37,8 +37,8 @@ local plugins = {
|
|||
-- Style / UI --
|
||||
----------------
|
||||
{ "shortcuts/no-neck-pain.nvim", version = "*" }, -- Align buffer
|
||||
"lewis6991/gitsigns.nvim", -- Gitsigns in gutter
|
||||
"NvChad/nvim-colorizer.lua", -- Show color
|
||||
"lewis6991/gitsigns.nvim", -- Gitsigns in gutter
|
||||
"NvChad/nvim-colorizer.lua", -- Show color
|
||||
-- Jump like a ninja
|
||||
{
|
||||
"ThePrimeagen/harpoon",
|
||||
|
|
@ -46,11 +46,11 @@ local plugins = {
|
|||
branch = "harpoon2",
|
||||
},
|
||||
-- Highlight comments
|
||||
{ "folke/todo-comments.nvim", dependencies = "nvim-lua/plenary.nvim" },
|
||||
{ "folke/todo-comments.nvim", dependencies = "nvim-lua/plenary.nvim" },
|
||||
-- Status line
|
||||
{ "nvim-lualine/lualine.nvim", dependencies = "nvim-tree/nvim-web-devicons" },
|
||||
{ "nvim-lualine/lualine.nvim", dependencies = "nvim-tree/nvim-web-devicons" },
|
||||
-- Breadcrumbs
|
||||
{ "SmiteshP/nvim-navic", dependencies = "neovim/nvim-lspconfig" },
|
||||
{ "SmiteshP/nvim-navic", dependencies = "neovim/nvim-lspconfig" },
|
||||
|
||||
---------------
|
||||
-- LSP / DAP --
|
||||
|
|
@ -92,7 +92,7 @@ local plugins = {
|
|||
{
|
||||
"turbio/bracey.vim",
|
||||
build = "npm install --prefix server",
|
||||
cond = vim.fn.executable "npm" == 1,
|
||||
cond = vim.fn.executable("npm") == 1,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
|
|
@ -102,7 +102,7 @@ local plugins = {
|
|||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
cond = vim.fn.executable "make" == 1,
|
||||
cond = vim.fn.executable("make") == 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -131,14 +131,14 @@ local plugins = {
|
|||
-- Completion --
|
||||
----------------
|
||||
{
|
||||
"hrsh7th/nvim-cmp", -- Autocompletion
|
||||
"hrsh7th/nvim-cmp", -- Autocompletion
|
||||
dependencies = {
|
||||
"L3MON4D3/LuaSnip", -- Snippet Engine
|
||||
"L3MON4D3/LuaSnip", -- Snippet Engine
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lsp", -- LSP completion
|
||||
"hrsh7th/cmp-nvim-lsp", -- LSP completion
|
||||
"rafamadriz/friendly-snippets", -- Adds a number of user-friendly snippets
|
||||
"hrsh7th/cmp-buffer", -- Buffer cmp source
|
||||
"f3fora/cmp-spell", -- Spell cmp source
|
||||
"hrsh7th/cmp-buffer", -- Buffer cmp source
|
||||
"f3fora/cmp-spell", -- Spell cmp source
|
||||
"mrcjkb/haskell-snippets.nvim", -- Haskell snippets
|
||||
},
|
||||
},
|
||||
|
|
@ -146,7 +146,7 @@ local plugins = {
|
|||
|
||||
local opts = {}
|
||||
|
||||
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",
|
||||
|
|
@ -159,4 +159,4 @@ if not vim.loop.fs_stat(lazypath) then
|
|||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require "lazy".setup(plugins, opts)
|
||||
require("lazy").setup(plugins, opts)
|
||||
|
|
|
|||
|
|
@ -9,20 +9,16 @@ autocmd("TextYankPost", { callback = vim.highlight.on_yank })
|
|||
|
||||
autocmd("FileType", {
|
||||
pattern = { "markdown", "tex", "typst" },
|
||||
callback =
|
||||
function()
|
||||
vim.opt_local["shiftwidth"] = 2
|
||||
vim.opt_local["tabstop"] = 2
|
||||
vim.opt_local["textwidth"] = 80
|
||||
end,
|
||||
callback = function()
|
||||
vim.opt_local["shiftwidth"] = 2
|
||||
vim.opt_local["tabstop"] = 2
|
||||
vim.opt_local["textwidth"] = 80
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd("FileType", {
|
||||
pattern = "asm",
|
||||
callback =
|
||||
function()
|
||||
vim.opt_local["commentstring"] = "# %s"
|
||||
end,
|
||||
callback = function() vim.opt_local["commentstring"] = "# %s" end,
|
||||
})
|
||||
|
||||
autocmd("FileType", {
|
||||
|
|
@ -30,9 +26,9 @@ autocmd("FileType", {
|
|||
callback = function()
|
||||
vim.opt_local["commentstring"] = "(* %s *)"
|
||||
vim.keymap.set({ "n" }, "<leader>f", function()
|
||||
vim.cmd "w "
|
||||
vim.cmd "silent exec '!necroprint % -o %'"
|
||||
vim.cmd "e "
|
||||
vim.cmd("w ")
|
||||
vim.cmd("silent exec '!necroprint % -o %'")
|
||||
vim.cmd("e ")
|
||||
end, { buffer = true, silent = true })
|
||||
end,
|
||||
})
|
||||
|
|
@ -42,9 +38,9 @@ autocmd("FileType", {
|
|||
callback = function()
|
||||
vim.opt_local["list"] = false
|
||||
return vim.keymap.set({ "n" }, "<leader>f", function()
|
||||
vim.cmd "w "
|
||||
vim.cmd "silent exec '!fnlfmt --fix %'"
|
||||
vim.cmd "e "
|
||||
vim.cmd("w ")
|
||||
vim.cmd("silent exec '!fnlfmt --fix %'")
|
||||
vim.cmd("e ")
|
||||
end, { buffer = true, silent = true })
|
||||
end,
|
||||
})
|
||||
|
|
@ -83,17 +79,15 @@ autocmd("OptionSet", {
|
|||
})
|
||||
|
||||
usercmd("Retab", function(opts)
|
||||
if (#opts.fargs ~= 2) then
|
||||
return print "should have exactly two argument: [src] and [dst]"
|
||||
end
|
||||
if #opts.fargs ~= 2 then return print("should have exactly two argument: [src] and [dst]") end
|
||||
local src = tonumber(opts.fargs[1])
|
||||
local dst = tonumber(opts.fargs[2])
|
||||
vim.opt["shiftwidth"] = src
|
||||
vim.opt["tabstop"] = src
|
||||
vim.opt["expandtab"] = false
|
||||
vim.cmd "%retab! "
|
||||
vim.cmd("%retab! ")
|
||||
vim.opt["shiftwidth"] = dst
|
||||
vim.opt["tabstop"] = dst
|
||||
vim.opt["expandtab"] = true
|
||||
vim.cmd "%retab! "
|
||||
vim.cmd("%retab! ")
|
||||
end, { nargs = "+" })
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
local map = vim.keymap.set
|
||||
local unmap = vim.keymap.del
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local map = vim.keymap.set
|
||||
local unmap = vim.keymap.del
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- Move
|
||||
map("v", "J", ":m '>+1<CR>gv=gv")
|
||||
|
|
@ -26,20 +26,20 @@ map({ "n", "x", "v" }, "<leader>y", '"+y')
|
|||
-- Only use gj et al. when needed
|
||||
map("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
map("n", "<leader>w", function() vim.cmd "setlocal invwrap" end)
|
||||
map("n", "<leader>w", function() vim.cmd("setlocal invwrap") end)
|
||||
|
||||
-- Replace selected token
|
||||
map("v", "<leader>r", [["ry:%s/\(<C-r>r\)//g<Left><Left>]])
|
||||
|
||||
map("n", "<leader>pv", function() vim.cmd "Oil" end) -- Project View
|
||||
map("n", "<leader>nf", function() vim.cmd "enew" end) -- New File
|
||||
map("n", "<leader>so", function() vim.cmd "so %" end) -- Source buffer
|
||||
map("c", "#capl", [[\(.\{-}\)]]) -- helpers in regex
|
||||
map("n", "<leader>pv", function() vim.cmd("Oil") end) -- Project View
|
||||
map("n", "<leader>nf", function() vim.cmd("enew") end) -- New File
|
||||
map("n", "<leader>so", function() vim.cmd("so %") end) -- Source buffer
|
||||
map("c", "#capl", [[\(.\{-}\)]]) -- helpers in regex
|
||||
map("c", "#capm", [[\(.*\)]])
|
||||
map("n", "<leader>+x", function() vim.cmd "!chmod +x %" end) -- Permission
|
||||
map("n", "<leader>-x", function() vim.cmd "!chmod -x %" end)
|
||||
map("n", "<leader>hg", function() vim.cmd "Inspect" end) -- Highlight Group
|
||||
map("n", "Q", "<nop>") -- *do not* repeat the last recorded register [count] times.
|
||||
map("n", "<leader>+x", function() vim.cmd("!chmod +x %") end) -- Permission
|
||||
map("n", "<leader>-x", function() vim.cmd("!chmod -x %") end)
|
||||
map("n", "<leader>hg", function() vim.cmd("Inspect") end) -- Highlight Group
|
||||
map("n", "Q", "<nop>") -- *do not* repeat the last recorded register [count] times.
|
||||
|
||||
-- Diagnostics
|
||||
map("n", "<leader>e", vim.diagnostic.open_float)
|
||||
|
|
@ -60,21 +60,19 @@ map("n", "<S-Right>", "<cmd>vertical resize +2<cr>")
|
|||
-------------
|
||||
|
||||
-- Tabular
|
||||
map("n", "<leader>ta", function() vim.cmd "Tabularize /=" end)
|
||||
map("n", "<leader>tc", function() vim.cmd "Tabularize /:" end)
|
||||
map("n", "<leader>tC", function() vim.cmd "Tabularize trailing_c_comments" end)
|
||||
map("n", "<leader>ta", function() vim.cmd("Tabularize /=") end)
|
||||
map("n", "<leader>tc", function() vim.cmd("Tabularize /:") end)
|
||||
map("n", "<leader>tC", function() vim.cmd("Tabularize trailing_c_comments") end)
|
||||
|
||||
-- Gitsigns
|
||||
map("n", "<leader>gl",
|
||||
function()
|
||||
vim.cmd "Gitsigns toggle_numhl"
|
||||
vim.cmd "Gitsigns toggle_signs"
|
||||
end
|
||||
)
|
||||
map("n", "<leader>gl", function()
|
||||
vim.cmd("Gitsigns toggle_numhl")
|
||||
vim.cmd("Gitsigns toggle_signs")
|
||||
end)
|
||||
|
||||
-- Fugitive
|
||||
map("n", "<leader>gP", function() vim.cmd "G push" end)
|
||||
map("n", "<leader>gp", function() vim.cmd "G pull" end)
|
||||
map("n", "<leader>gP", function() vim.cmd("G push") end)
|
||||
map("n", "<leader>gp", function() vim.cmd("G pull") end)
|
||||
|
||||
map("n", "<leader><space>", ":Git<CR>5<Down>")
|
||||
map("n", "<leader>gu", ":diffget //2<CR>")
|
||||
|
|
@ -93,12 +91,12 @@ autocmd("FileType", {
|
|||
map("n", "<leader>z", ":NoNeckPain<CR>")
|
||||
|
||||
-- Todo-Comments
|
||||
map("n", "<leader>td", function() vim.cmd "TodoTelescope" end)
|
||||
map("n", "<leader>td", function() vim.cmd("TodoTelescope") end)
|
||||
|
||||
-- Undotree
|
||||
map("n", "<leader>u", function()
|
||||
vim.cmd "UndotreeToggle"
|
||||
vim.cmd "UndotreeFocus"
|
||||
vim.cmd("UndotreeToggle")
|
||||
vim.cmd("UndotreeFocus")
|
||||
end)
|
||||
autocmd("FileType", {
|
||||
pattern = "undotree",
|
||||
|
|
|
|||
|
|
@ -1,47 +1,47 @@
|
|||
local opt = vim.opt
|
||||
local opt = vim.opt
|
||||
|
||||
opt.hlsearch = false
|
||||
opt.incsearch = true
|
||||
opt.hlsearch = false
|
||||
opt.incsearch = true
|
||||
|
||||
opt.number = true
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.cursorline = true
|
||||
opt.signcolumn = "yes"
|
||||
opt.cursorline = true
|
||||
opt.signcolumn = "yes"
|
||||
|
||||
opt.tabstop = 4
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 4
|
||||
opt.tabstop = 4
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 4
|
||||
|
||||
opt.wrap = false -- Slows the editor
|
||||
opt.linebreak = true
|
||||
opt.breakindent = true
|
||||
opt.filetype = "on"
|
||||
opt.wrap = false -- Slows the editor
|
||||
opt.linebreak = true
|
||||
opt.breakindent = true
|
||||
opt.filetype = "on"
|
||||
|
||||
opt.swapfile = false
|
||||
opt.backup = false
|
||||
opt.undofile = true
|
||||
opt.swapfile = false
|
||||
opt.backup = false
|
||||
opt.undofile = true
|
||||
|
||||
opt.termguicolors = true
|
||||
opt.mouse = "a"
|
||||
opt.termguicolors = true
|
||||
opt.mouse = "a"
|
||||
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.autoindent = true
|
||||
opt.smartindent = true
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.autoindent = true
|
||||
opt.smartindent = true
|
||||
|
||||
opt.scrolloff = 3
|
||||
opt.scrolloff = 3
|
||||
|
||||
opt.colorcolumn = "80"
|
||||
opt.colorcolumn = "80"
|
||||
|
||||
opt.foldlevel = 99
|
||||
opt.foldlevel = 99
|
||||
opt.foldlevelstart = 99
|
||||
opt.foldenable = true
|
||||
opt.foldenable = true
|
||||
|
||||
opt.winbar = "%{%v:lua.require'winbar'.eval()%}"
|
||||
opt.winbar = "%{%v:lua.require'winbar'.eval()%}"
|
||||
|
||||
opt.showmode = false
|
||||
opt.showmode = false
|
||||
|
||||
opt.listchars = { tab = "│ ", trail = "␣" }
|
||||
opt.list = true
|
||||
opt.listchars = { tab = "│ ", trail = "␣" }
|
||||
opt.list = true
|
||||
|
||||
vim.g.netrw_banner = 0
|
||||
|
|
|
|||
|
|
@ -13,24 +13,13 @@ function M.eval()
|
|||
local modified = ""
|
||||
local readonly = ""
|
||||
|
||||
if vim.bo[buffer].readonly then
|
||||
readonly = "[RO] "
|
||||
end
|
||||
if vim.bo[buffer].readonly then readonly = "[RO] " end
|
||||
|
||||
if vim.bo[buffer].modified then
|
||||
modified = "[+] "
|
||||
end
|
||||
if vim.bo[buffer].modified then modified = "[+] " end
|
||||
|
||||
bufname = fn.fnamemodify(bufname, ":p:~")
|
||||
|
||||
return "%="
|
||||
.. "%#WinBarModified#"
|
||||
.. readonly
|
||||
.. modified
|
||||
.. "%*"
|
||||
.. "%#WinBarPath#"
|
||||
.. bufname
|
||||
.. "%*"
|
||||
return "%=" .. "%#WinBarModified#" .. readonly .. modified .. "%*" .. "%#WinBarPath#" .. bufname .. "%*"
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue