This commit is contained in:
foozzi 2023-12-28 22:52:58 -05:00
parent 41adb9e23d
commit 7ace81f4f0
27 changed files with 784 additions and 1 deletions

View file

@ -0,0 +1,7 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
require 'core.lazy'
require 'core.options'
require 'core.keymaps'
require 'core.autocmds'

View file

@ -0,0 +1,32 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" },
"barbar.nvim": { "branch": "master", "commit": "dd852401ee902745b67fc09a83d113b3fe82a96f" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
"gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" },
"indent-blankline.nvim": { "branch": "master", "commit": "5da5546947f3125dfd6aa85ab21074dc83f776d5" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "1104a01a1126cddd77f957a9bd32730694c604c4" },
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" },
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
"neodev.nvim": { "branch": "main", "commit": "029899ea32d3dc8ed8c910ceca2ee5d16e566c11" },
"nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" },
"nvim-tree.lua": { "branch": "master", "commit": "50f30bcd8c62ac4a83d133d738f268279f2c2ce2" },
"nvim-treesitter": { "branch": "master", "commit": "7d0b4756aba3b220d38ec0443c6cc10944060dd7" },
"nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" },
"nvim-web-devicons": { "branch": "master", "commit": "43aa2ddf476012a2155f5f969ee55ab17174da7a" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"telescope.nvim": { "branch": "master", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" },
"tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" },
"vim-tmux-navigator": { "branch": "master", "commit": "38b1d0402c4600543281dc85b3f51884205674b6" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
}

View file

@ -0,0 +1,23 @@
-- auto-format on save
local lsp_fmt_group = vim.api.nvim_create_augroup("LspFormattingGroup", {})
vim.api.nvim_create_autocmd("BufWritePre", {
group = lsp_fmt_group,
callback = function()
local efm = vim.lsp.get_active_clients({ name = "efm" })
if vim.tbl_isempty(efm) then
return
end
vim.lsp.buf.format({ name = "efm", async = true })
end,
})
-- highlight on yank
local highlight_yank_group = vim.api.nvim_create_augroup("HighlightYankGroup", {})
vim.api.nvim_create_autocmd("TextYankPost", {
group = highlight_yank_group,
callback = function()
vim.highlight.on_yank()
end,
})

View file

@ -0,0 +1,58 @@
local mapkey = require("utils.keymapper").mapvimkey
-- Buffer Navigation
mapkey("<leader>bn", "bnext", "n") -- Next buffer
mapkey("<leader>bp", "bprevious", "n") -- Prev buffer
mapkey("<leader>bb", "e #", "n") -- Switch to Other Buffer
mapkey("<leader>`", "e #", "n") -- Switch to Other Buffer
-- Directory Navigatio}n
mapkey("<leader>m", "NvimTreeFocus", "n")
mapkey("<leader>e", "NvimTreeToggle", "n")
-- Pane and Window Navigation
mapkey("<C-h>", "<C-w>h", "n") -- Navigate Left
mapkey("<C-j>", "<C-w>j", "n") -- Navigate Down
mapkey("<C-k>", "<C-w>k", "n") -- Navigate Up
mapkey("<C-l>", "<C-w>l", "n") -- Navigate Right
mapkey("<C-h>", "wincmd h", "t") -- Navigate Left
mapkey("<C-j>", "wincmd j", "t") -- Navigate Down
mapkey("<C-k>", "wincmd k", "t") -- Navigate Up
mapkey("<C-l>", "wincmd l", "t") -- Navigate Right
mapkey("<C-h>", "TmuxNavigateLeft", "n") -- Navigate Left
mapkey("<C-j>", "TmuxNavigateDown", "n") -- Navigate Down
mapkey("<C-k>", "TmuxNavigateUp", "n") -- Navigate Up
mapkey("<C-l>", "TmuxNavigateRight", "n") -- Navigate Right
-- Window Management
mapkey("<leader>sv", "vsplit", "n") -- Split Vertically
mapkey("<leader>sh", "split", "n") -- Split Horizontally
mapkey("<C-Up>", "resize +2", "n")
mapkey("<C-Down>", "resize -2", "n")
mapkey("<C-Left>", "vertical resize +2", "n")
mapkey("<C-Right>", "vertical resize -2", "n")
-- Show Full File-Path
mapkey("<leader>pa", "echo expand('%:p')", "n") -- Show Full File Path
-- Notes
mapkey("<leader>ng", "Neorg workspace general", "n")
mapkey("<leader>nw", "Neorg workspace work", "n")
mapkey("<leader>ny", "Neorg workspace youtube", "n")
-- Indenting
vim.keymap.set("v", "<", "<gv", { silent = true, noremap = true })
vim.keymap.set("v", ">", ">gv", { silent = true, noremap = true })
local api = vim.api
-- Zen Mode
api.nvim_set_keymap("n", "<leader>zn", ":TZNarrow<CR>", {})
api.nvim_set_keymap("v", "<leader>zn", ":'<,'>TZNarrow<CR>", {})
api.nvim_set_keymap("n", "<leader>sm", ":TZFocus<CR>", {})
api.nvim_set_keymap("n", "<leader>zm", ":TZMinimalist<CR>", {})
api.nvim_set_keymap("n", "<leader>za", ":TZAtaraxis<CR>", {})
-- Comments
api.nvim_set_keymap("n", "<C-_>", "gtc", { noremap = false })
api.nvim_set_keymap("v", "<C-_>", "goc", { noremap = false })

View file

@ -0,0 +1,41 @@
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,
})
end
vim.opt.rtp:prepend(lazypath)
local plugins = "plugins"
local opts = {
defaults = {
lazy = true,
},
install = {
colorscheme = { "nightfox" },
},
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrw",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
change_detection = {
notify = false,
},
}
require("lazy").setup(plugins, opts)

View file

@ -0,0 +1,50 @@
local opt = vim.opt
-- Tab / Indentation
opt.tabstop = 2
opt.shiftwidth = 2
opt.softtabstop = 2
opt.expandtab = true
opt.smartindent = true
opt.wrap = false
-- Search
opt.incsearch = true
opt.ignorecase = true
opt.smartcase = true
opt.hlsearch = false
-- Appearance
opt.number = true
opt.relativenumber = false
opt.termguicolors = true
opt.colorcolumn = "100"
opt.signcolumn = "yes"
-- opt.signcolumn = "number"
opt.cmdheight = 1
opt.scrolloff = 10
opt.completeopt = "menuone,noinsert,noselect"
-- opt.guicursor = ""
opt.tabline = '%!v:lua.require("utils").tabline()'
-- Behaviour
opt.hidden = true
opt.errorbells = false
opt.swapfile = false
opt.backup = false
opt.undodir = vim.fn.expand("~/.vim/undodir")
opt.undofile = true
opt.backspace = "indent,eol,start"
opt.splitright = true
opt.splitbelow = true
opt.autochdir = false
opt.iskeyword:append("-")
opt.mouse:append("a")
opt.clipboard:append("unnamedplus")
opt.modifiable = true
-- opt.guicursor =
-- "n-v-c:block,i-ci-ve:block,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175"
opt.encoding = "UTF-8"
opt.cursorline = true

View file

@ -0,0 +1,6 @@
return {
"numToStr/Comment.nvim",
opts = {
},
lazy = false,
}

View file

@ -0,0 +1,6 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
opts = {},
lazy = false,
}

View file

@ -0,0 +1,16 @@
return {
{
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 900
end,
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
},
{ "folke/neodev.nvim" },
}

View file

@ -0,0 +1,124 @@
local config = function()
local lsp_zero = require 'lsp-zero'
local luasnip = require 'luasnip'
local diagnostic_signs = require("utils.icons").diagnostic_signs
lsp_zero.on_attach(function(client, bufnr)
vim.diagnostic.config({
virtual_text = false, -- disable virtual text
update_in_insert = true,
underline = true,
severity_sort = true,
float = {
focusable = true,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
})
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
})
local opts = {buffer = bufnr, remap = false}
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
end)
lsp_zero.set_sign_icons({
error = diagnostic_signs.Error,
warn = diagnostic_signs.Warn,
hint = diagnostic_signs.Hint,
info = diagnostic_signs.Info
})
require('mason').setup({})
require('mason-lspconfig').setup({
ensure_installed = {
"bashls",
"tsserver",
"pyright",
"lua_ls",
"jsonls",
"clangd",
},
automatic_installation = true,
handlers = {
lsp_zero.default_setup,
lua_ls = function()
local lua_opts = lsp_zero.nvim_lua_ls()
require('lspconfig').lua_ls.setup(lua_opts)
end,
pyright = function()
require('lspconfig').pyright.setup({})
end,
}
})
local cmp = require('cmp')
local cmp_select = {behavior = cmp.SelectBehavior.Select}
require("luasnip/loaders/from_vscode").lazy_load()
-- require("luasnip/loaders/from_vscode").load()
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
preselect = 'item',
completion = {
completeopt = 'menu,menuone,noinsert'
},
sources = {
{name = 'luasnip'},
{name = 'path'},
{name = 'nvim_lsp'},
{name = 'nvim_lua'},
{name = 'buffer'},
},
formatting = lsp_zero.cmp_format(),
mapping = cmp.mapping.preset.insert({
-- ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<Tab>'] = cmp.mapping.select_next_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
}),
})
end
return {
"VonHeikemen/lsp-zero.nvim",
branch = 'v3.x',
config = config,
lazy = false,
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
{"L3MON4D3/LuaSnip", version = "v2.*", build = "make install_jsregexp", dependencies={"rafamadriz/friendly-snippets"}},
}
}

View file

@ -0,0 +1,69 @@
local config = {
options = {
icons_enabled = true,
theme = "auto",
globalstatus = true,
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
component_separators = { left = "|", right = "|" },
section_separators = { left = "", right = "" },
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = { "mode" },
lualine_b = { "buffers" },
lualine_x = { "diagnostics", "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
lualine_c = {},
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
local function ins_right(component)
table.insert(config.sections.lualine_x, 1, component)
end
ins_right {
-- Lsp server name .
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
return msg
end,
icon = ' LSP:',
color = { fg = '#ff6b6b' },
}
return {
"nvim-lualine/lualine.nvim",
lazy = false,
opts = config,
dependencies = {
"nvim-tree/nvim-web-devicons"
}
}

View file

@ -0,0 +1,14 @@
return {
"williamboman/mason.nvim",
cmd = "Mason",
event = "BufReadPre",
opts = {
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
},
}

View file

@ -0,0 +1,5 @@
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {}, -- this is equalent to setup({}) function
}

View file

@ -0,0 +1,9 @@
return {
"nvim-tree/nvim-tree.lua",
lazy = false,
opts = {
filters = {
dotfiles = false,
}
}
}

View file

@ -0,0 +1,52 @@
local config = function()
require("nvim-treesitter.configs").setup({
build = ":TSUpdate",
indent = {
enable = true,
},
autotag = {
enable = true,
},
event = {
"BufReadPre",
"BufNewFile",
},
ensure_installed = {
"markdown",
"json",
"javascript",
"typescript",
"yaml",
"html",
"css",
"markdown",
"bash",
"lua",
"dockerfile",
"solidity",
"gitignore",
"python",
"vue",
},
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-s>",
node_incremental = "<C-s>",
scope_incremental = false,
node_decremental = "<BS>",
},
},
})
end
return {
"nvim-treesitter/nvim-treesitter",
lazy = false,
opts = config,
}

View file

@ -0,0 +1,4 @@
return {
"windwp/nvim-ts-autotag",
lazy = false,
}

View file

@ -0,0 +1,3 @@
return {
'nvim-tree/nvim-web-devicons'
}

View file

@ -0,0 +1,45 @@
local mapvimkey = require("utils.keymapper").mapvimkey
local config = function()
local telescope = require("telescope")
telescope.setup({
defaults = {
mappings = {
i = {
["<C-j>"] = "move_selection_next",
["<C-k>"] = "move_selection_previous",
},
},
},
pickers = {
find_files = {
theme = "dropdown",
previewer = true,
hidden = true,
},
live_grep = {
theme = "dropdown",
previewer = true,
},
buffers = {
theme = "dropdown",
previewer = true,
},
},
})
end
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.3",
lazy = false,
dependencies = { "nvim-lua/plenary.nvim" },
config = config,
keys = {
mapvimkey("<leader>fk", "Telescope keymaps", "Show Keymaps"),
mapvimkey("<leader>fh", "Telescope help_tags", "Show Help Tags"),
mapvimkey("<leader>ff", "Telescope find_files", "Find Files"),
mapvimkey("<leader>fg", "Telescope live_grep", "Live Grep"),
mapvimkey("<leader>fb", "Telescope buffers", "Find Buffers"),
},
}

View file

@ -0,0 +1,4 @@
return {
"christoomey/vim-tmux-navigator",
lazy = false,
}

View file

@ -0,0 +1,9 @@
return {
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
opts = {},
config = function()
vim.cmd('colorscheme tokyonight-storm')
end
}

View file

@ -0,0 +1,82 @@
local diagnostic_signs = require("utils.icons").diagnostic_signs
local maplazykey = require("utils.keymapper").maplazykey
return {
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
cycle_results = true, -- cycle item list when reaching beginning or end of list
action_keys = { -- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<cr>", "<tab>", "<2-leftmouse>" }, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
jump_close = {"o"}, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
switch_severity = "s", -- switch "diagnostics" severity filter level to HINT / INFO / WARN / ERROR
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
open_code_href = "c", -- if present, open a URI with more information about the diagnostic error
close_folds = {"zM", "zm"}, -- close all folds
open_folds = {"zR", "zr"}, -- open all folds
toggle_fold = {"zA", "za"}, -- toggle fold of current file
previous = "k", -- previous item
next = "j", -- next item
help = "?" -- help menu
},
multiline = true, -- render multi-line messages
indent_lines = true, -- add an indent guide below the fold icons
win_config = { border = "single" }, -- window configuration for floating windows. See |nvim_open_win()|.
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result
include_declaration = { "lsp_references", "lsp_implementations", "lsp_definitions" }, -- for the given modes, include the declaration of the current symbol in the results
signs = {
-- icons / text used for a diagnostic
error = diagnostic_signs.Error,
warning = diagnostic_signs.Warn,
hint = diagnostic_signs.Hint,
information = diagnostic_signs.Info,
other = diagnostic_signs.Info,
},
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
},
keys = {
maplazykey("<leader>xx", function()
require("trouble").toggle()
end, "Toggle Trouble"),
maplazykey("<leader>xw", function()
require("trouble").toggle("workspace_diagnostics")
end, "Show Workspace Diagnostics"),
maplazykey("<leader>xd", function()
require("trouble").toggle("document_diagnostics")
end, "Show Document Diagnostics"),
maplazykey("<leader>xq", function()
require("trouble").toggle("quickfix")
end, "Toggle Quickfix List"),
maplazykey("<leader>xl", function()
require("trouble").toggle("loclist")
end, "Toggle Location List"),
maplazykey("gR", function()
require("trouble").toggle("lsp_references")
end, "Toggle LSP References"),
},
}

View file

@ -0,0 +1,7 @@
return {
"RRethy/vim-illuminate",
lazy = false,
config = function()
require("illuminate").configure({})
end,
}

View file

@ -0,0 +1,18 @@
local M = {}
M.debugging_signs = {
Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" },
Breakpoint = "",
BreakpointCondition = "",
BreakpointRejected = { "", "DiagnosticError" },
LogPoint = ".>",
}
M.diagnostic_signs = {
Error = "",
Warn = "",
Hint = "",
Info = "",
}
return M

View file

@ -0,0 +1,26 @@
local M = {}
function M.tabline()
local s = ''
for i = 1, vim.fn.tabpagenr('$') do
local winnr = vim.fn.tabpagewinnr(i)
local buflist = vim.fn.tabpagebuflist(i)
local bufnr = buflist[winnr]
local bufname = vim.fn.bufname(bufnr)
local filename = vim.fn.fnamemodify(bufname, ':t')
local icon = require'nvim-web-devicons'.get_icon(filename)
-- Отмечаем активный таб
if i == vim.fn.tabpagenr() then
s = s .. '%#TabLineSel#'
else
s = s .. '%#TabLine#'
end
s = s .. ' ' .. (icon or '') .. ' ' .. filename .. ' '
end
s = s .. '%#TabLineFill#%='
return s
end
return M

View file

@ -0,0 +1,69 @@
local vim_modes = {
n = "n",
i = "i",
v = "v",
}
local default_opts = {
noremap = true,
silent = true,
}
--- @param opts (table|nil)
--- @return table
local get_opts = function(opts)
local all_opts = opts
if all_opts == nil then
all_opts = {}
end
for k, v in pairs(default_opts) do
all_opts[k] = all_opts[k] or v
end
return all_opts
end
--- @param vimmode (string|nil)
--- @return string
local get_mode = function(vimmode)
local modeString = vim_modes[vimmode]
if modeString == nil then
return "n"
else
return modeString
end
end
--- @param command (string)
--- @return string
local get_cmd_string = function(command)
return [[<cmd>]] .. command .. [[<CR>]]
end
--- @param keymaps string
--- @param command string
--- @param vimmode (string|nil)
--- @param options (table|nil)
--- @return nil
local mapvimkey = function(keymaps, command, vimmode, options)
local mode = get_mode(vimmode)
local lhs = keymaps
local rhs = get_cmd_string(command)
local opts = get_opts(options)
vim.keymap.set(mode, lhs, rhs, opts)
end
--- @param keymaps string
--- @param cmd (function|string)
--- @param desc (string|nil)
--- @return table
local maplazykey = function(keymaps, cmd, desc)
if type(cmd) ~= "function" then
cmd = get_cmd_string(cmd)
end
return { keymaps, cmd, desc = desc }
end
return {
mapvimkey = mapvimkey,
maplazykey = maplazykey,
}

View file

@ -9,7 +9,8 @@ set -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe "pbcopy" bind-key -T copy-mode-vi y send-keys -X copy-pipe "pbcopy"
set -g default-terminal "xterm-256color" set -g default-terminal "tmux-256color"
set-option -sa terminal-features ',alacritty:RGB'
# reset gpg-agent password cache after close the pane (vimwiki diary) # reset gpg-agent password cache after close the pane (vimwiki diary)
set-hook -g window-unlinked 'run-shell "gpgconf --reload gpg-agent"' set-hook -g window-unlinked 'run-shell "gpgconf --reload gpg-agent"'

View file

@ -100,6 +100,9 @@ export PATH=$PATH:$HOME/.config/emacs/bin
## golang ## golang
export GOPATH=$HOME/go # don't forget to change your path correctly! export GOPATH=$HOME/go # don't forget to change your path correctly!
export PATH=$PATH:$GOPATH/bin export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:/usr/local/go/bin
## color
export TERM=tmux-256color
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export VOLTA_HOME="$HOME/.volta" export VOLTA_HOME="$HOME/.volta"