Refactoring

- Added macos
This commit is contained in:
foozzi 2024-01-14 23:29:33 -05:00
parent 03a7616e8c
commit 2c1ccaffd1
47 changed files with 76 additions and 33 deletions

View file

@ -0,0 +1,35 @@
# A gruvbox color scheme for mutt and neomutt
## Description
[Gruvbox](https://github.com/morhetz/gruvbox) is a well designed, popular
colorscheme for vim. This is a port to mutt and neomutt, in which vim can act
as mail composer.
This is a replication of the repository
[here](https://git.sthu.org/?p=mutt-gruvbox.git;a=summary). The
[website](https://www.sthu.org/code/codesnippets/mutt-gruvbox.html) gives
further details and a screenshot, like this:
![screenshot](https://www.sthu.org/code/codesnippets/img/mutt-gruvbox.png)
## Usage
Download the files or clone the repo, e.g.
cd ~/.mutt
git clone https://git.sthu.org/repos/mutt-gruvbox.git gruvbox
Then source them in your `~/.mutt/muttrc`, e.g.
source ~/.mutt/gruvbox/colors-gruvbox-shuber.muttrc
# For neomutt also add this line:
# source ~/.mutt/gruvbox/colors-gruvbox-shuber-extended.muttrc
The colorscheme is split into two files, where the latter also defines colors
for neomutt.
## License
GNU Lesser General Public License v3.

View file

@ -0,0 +1 @@
color sidebar_unread color108 color234

View file

@ -0,0 +1,121 @@
# gruvbox dark (contrast dark):
# bg0 = 234
# bg1 = 237
# bg2 = 239
# bg3 = 241
# bg4 = 243
#
# gray = 245
#
# fg0 = 229
# fg1 = 223
# fg2 = 250
# fg3 = 248
# fg4 = 246
#
# red = 167
# green = 142
# yellow = 214
# blue = 109
# purple = 175
# aqua = 108
# orange = 208
# See http://www.mutt.org/doc/manual/#color
color attachment color109 color234
color bold color229 color234
color error color167 color234
color hdrdefault color246 color234
color indicator color223 color237
color markers color243 color234
color normal color223 color234
color quoted color250 color234
color quoted1 color108 color234
color quoted2 color250 color234
color quoted3 color108 color234
color quoted4 color250 color234
color quoted5 color108 color234
color search color234 color208
color signature color108 color234
color status color234 color250
color tilde color243 color234
color tree color142 color234
color underline color223 color239
color sidebar_divider color250 color234
color sidebar_new color142 color234
color index color142 color234 ~N
color index color108 color234 ~O
color index color109 color234 ~P
color index color214 color234 ~F
color index color175 color234 ~Q
color index color167 color234 ~=
color index color234 color223 ~T
color index color234 color167 ~D
color header color214 color234 "^(To:|From:)"
color header color142 color234 "^Subject:"
color header color108 color234 "^X-Spam-Status:"
color header color108 color234 "^Received:"
# Regex magic for URLs and hostnames
#
# Attention: BSD's regex has RE_DUP_MAX set to 255.
#
# Examples:
# http://some-service.example.com
# example.com
# a.example.com
# some-service.example.com
# example.com/
# example.com/datenschutz
# file:///tmp/foo
#
# Non-examples:
# 1.1.1900
# 14.02.2022/24:00
# 23.59
# w.l.o.g
# team.its
color body color142 color234 "[a-z]{3,255}://[[:graph:]]*"
color body color142 color234 "([-[:alnum:]]+\\.)+([0-9]{1,3}|[-[:alpha:]]+)/[[:graph:]]*"
color body color142 color234 "([-[:alnum:]]+\\.){2,255}[-[:alpha:]]{2,10}"
# IPv4 and IPv6 stolen from https://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
color body color142 color234 "((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
color body color142 color234 "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))"
# Mail addresses and mailto URLs
color body color208 color234 "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"
color body color208 color234 "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
# some simleys and stuff
color body color234 color214 "[;:]-*[)>(<lt;|]"
color body color229 color234 "\\*[- A-Za-z]+\\*"
color body color214 color234 "^-.*PGP.*-*"
color body color142 color234 "^gpg: Good signature from"
color body color167 color234 "^gpg: Can't.*$"
color body color214 color234 "^gpg: WARNING:.*$"
color body color167 color234 "^gpg: BAD signature from"
color body color167 color234 "^gpg: Note: This key has expired!"
color body color214 color234 "^gpg: There is no indication that the signature belongs to the owner."
color body color214 color234 "^gpg: can't handle these multiple signatures"
color body color214 color234 "^gpg: signature verification suppressed"
color body color214 color234 "^gpg: invalid node with packet of type"
color body color142 color234 "^Good signature from:"
color body color167 color234 "^.?BAD.? signature from:"
color body color142 color234 "^Verification successful"
color body color167 color234 "^Verification [^s][^[:space:]]*$"
color compose header color223 color234
color compose security_encrypt color175 color234
color compose security_sign color109 color234
color compose security_both color142 color234
color compose security_none color208 color234

View file

@ -0,0 +1,4 @@
text/html; firefox %s; test=test -n "$display"; needsterminal;
text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput;
text/plain; cat %s; copiousoutput
application/pdf; firefox %s; test=test -n "$display"; needsterminal;

View file

@ -0,0 +1,89 @@
source ./settings
source ./paths
# Ensure TLS is enforced
set ssl_starttls = yes
set ssl_force_tls = yes
unset record
# settings
set pager_index_lines = 10
set pager_context = 3 # show 3 lines of context
set pager_stop # stop at end of message
set menu_scroll # scroll menu
set tilde # use ~ to pad mutt
set move=no # don't move messages when marking as read
set mail_check = 30 # check for new mail every 30 seconds
set imap_keepalive = 900 # 15 minutes
set sleep_time = 0 # don't sleep when idle
set wait_key = no # mutt won't ask "press key to continue"
set envelope_from # which from?
set edit_headers # show headers when composing
set fast_reply # skip to compose when replying
set askcc # ask for CC:
set fcc_attach # save attachments with the body
set forward_format = "Fwd: %s" # format of subject when forwarding
set forward_decode # decode when forwarding
set forward_quote # include message in forwards
set mime_forward # forward attachments as part of body
set attribution = "On %d, %n wrote:" # format of quoting header
set reply_to # reply to Reply to: field
set reverse_name # reply as whomever it was to
set include # include message in replies
set text_flowed=yes # correct indentation for plain text
unset sig_dashes # no dashes before sig
unset markers
# Sort by newest conversation first.
set charset = "utf-8"
set uncollapse_jump
set sort_re
set sort = reverse-threads
set sort_aux = last-date-received
# How we reply and quote emails.
set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
set send_charset = "utf-8:iso-8859-1:us-ascii" # send in utf-8
#sidebar
set sidebar_visible # comment to disable sidebar by default
set sidebar_short_path
set sidebar_folder_indent
set sidebar_format = "%B %* [%?N?%N / ?%S]"
set mail_check_stats
bind index,pager \CP sidebar-prev
bind index,pager \CN sidebar-next
bind index,pager \CE sidebar-open
bind index,pager B sidebar-toggle-visible
set editor = "vim"
# bindings
macro index A \
"<tag-pattern>~N<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" \
"mark all new as read"
bind index j next-entry
bind index k previous-entry
bind pager j next-line
bind pager k previous-line
bind attach,index,pager \CD next-page
bind attach,index,pager \CU previous-page
bind pager g top
bind pager G bottom
bind attach,index g first-entry
bind attach,index G last-entry
# open attachments with mailcap with <return>
bind attach <return> view-mailcap
auto_view text/html # automatically show html (mailcap uses lynx)
#urlscan
macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message"
macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message"
#theme
source ~/.config/mutt/gruvbox/colors-gruvbox-shuber.muttrc
source ~/.config/mutt/gruvbox/colors-gruvbox-shuber-extended.muttrc

Binary file not shown.

View file

@ -0,0 +1,8 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.g.mouse = "a"
require("core.lazy")
require("core.options")
require("core.keymaps")
require("core.autocmds")

View file

@ -0,0 +1,38 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
"bufferline.nvim": { "branch": "main", "commit": "e48ce1805697e4bb97bc171c081e849a65859244" },
"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" },
"conform.nvim": { "branch": "master", "commit": "0e61fc88f725b4411e63b43470a397c6102534c7" },
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
"hardtime.nvim": { "branch": "main", "commit": "4ba3be553fa0b713c7b817f6d201b07d282accf3" },
"indent-blankline.nvim": { "branch": "master", "commit": "3c8a185da4b8ab7aef487219f5e001b11d4b6aaf" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "68e2e00387a2d93fc54dfa646e2847c4fa4773d3" },
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0989bdf4fdf7b5aa4c74131d7ffccc3f399ac788" },
"mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" },
"neodev.nvim": { "branch": "main", "commit": "be8d4d4cab6c13c6a572269c9d6a63774baba9a0" },
"neoscroll.nvim": { "branch": "master", "commit": "be4ebf855a52f71ca4338694a5696675d807eff9" },
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
"nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-lint": { "branch": "master", "commit": "d44185d3e57e00c164485a454174294b36ef7067" },
"nvim-lspconfig": { "branch": "master", "commit": "796394fd19fb878e8dbc4fd1e9c9c186ed07a5f4" },
"nvim-tree.lua": { "branch": "master", "commit": "78a5836092617205a999aefc75be1d842c299cbc" },
"nvim-treesitter": { "branch": "master", "commit": "8cd2b230174efbf7b5d9f49fe2f90bda6b5eb16e" },
"nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" },
"nvim-web-devicons": { "branch": "master", "commit": "db0c864375c198cacc171ff373e76bfce2a85045" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"tagbar": { "branch": "master", "commit": "fcd31ec145bbc628b90371be381717a1498b7c12" },
"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,59 @@
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
mapkey("<leader>bc", "bd", "n") -- Close the 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,49 @@
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.showmode = false
-- 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 = false

View file

@ -0,0 +1,17 @@
local config = function()
require("ts_context_commentstring").setup({
enable_autocmd = false,
})
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
})
end
return {
"numToStr/Comment.nvim",
opts = config,
lazy = false,
dependencies = {
{ "JoosepAlviste/nvim-ts-context-commentstring" },
},
}

View file

@ -0,0 +1,22 @@
return {
"stevearc/conform.nvim",
opts = {
icon = "", --'▎',
formatters_by_ft = {
lua = { "stylua" },
python = { "ruff_format", "ruff_fix", "isort" },
javascript = { "biome" },
typescript = { "biome" },
javascriptreact = { "biome" },
typescriptreact = { "biome" },
json = { "biome" },
sh = { "shfmt" },
["*"] = { "trim_whitespace", "codespell" },
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
},
lazy = false,
}

View file

@ -0,0 +1,8 @@
return {
"m4xshen/hardtime.nvim",
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
opts = {
max_time = 0,
},
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,186 @@
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(_, 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>ca", 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)
vim.keymap.set("n", "<leader>gi", function()
vim.lsp.buf.implementation()
end, opts)
-- nvim-lint
vim.keymap.set("n", "<leader>li", function()
require("lint").try_lint()
end, opts)
-- conform
vim.keymap.set("n", "<leader>fr", function()
require("conform").format({ bufnr = bufnr })
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",
"biome", -- will install for formatting only
},
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({
settings = {
python = {
analysis = {
typeCheckingMode = "off",
},
},
},
})
end,
biome = function() -- use tsserver instead
return {}
end,
},
})
local cmp = require("cmp")
local cmp_select = { behavior = cmp.SelectBehavior.Select }
require("luasnip/loaders/from_vscode").lazy_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(),
["<C-f>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" }),
["<C-b>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
})
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 = { "" },
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,7 @@
return {
"karb94/neoscroll.nvim",
config = function()
require("neoscroll").setup({})
end,
lazy = false,
}

View file

@ -0,0 +1,17 @@
local config = function()
local Rule = require("nvim-autopairs.rule")
local conds = require("nvim-autopairs.conds")
local npairs = require("nvim-autopairs")
require("nvim-autopairs").setup({})
npairs.add_rule(Rule('"""', '"""', "python"):with_pair(function()
return false
end))
end
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = config, -- this is equalent to setup({}) function
}

View file

@ -0,0 +1,16 @@
return {
"akinsho/bufferline.nvim",
opts = {
options = {
-- diagnostics = "nvim_lsp",
always_show_bufferline = false,
offsets = {
{ filetype = "NvimTree", text = "File Explorer", highlight = "Directory", text_align = "left" },
},
},
},
dependencies = {
"nvim-tree/nvim-web-devicons",
},
event = "VeryLazy",
}

View file

@ -0,0 +1,18 @@
local config = function()
require("lint").linters_by_ft = {
python = { "mypy" },
}
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
})
end
return {
"mfussenegger/nvim-lint",
opts = {},
config = config,
lazy = false,
}

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,4 @@
return {
"preservim/tagbar",
lazy = false,
}

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,
}

58
global/.tmux.conf Executable file
View file

@ -0,0 +1,58 @@
# mouse
setw -g mouse on
unbind C-b
set -g prefix C-a
set -g mode-keys vi
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"
set -g default-terminal tmux-256color
set -sa terminal-features ',alacritty:RGB'
set -ga terminal-overrides ",*256col*:Tc"
# reset gpg-agent password cache after close the pane (vimwiki diary)
set-hook -g window-unlinked 'run-shell "gpgconf --reload gpg-agent"'
# pane navigation
# bind -n M-h select-pane -L
# bind -n M-j select-pane -D
# bind -n M-k select-pane -U
# bind -n M-l select-pane -R
# windows
bind -n M-t new-window
bind -n M-X kill-window
bind -n M-n next-window
bind -n M-p last-window
bind -n M-e split-window -v -c '#{pane_current_path}'
bind -n M-d split-window -h -c '#{pane_current_path}'
bind -n M-W kill-pane
# Automatic restore
set -g @continuum-restore 'on'
set -g @resurrect-capture-pane-contents 'on'
#set -g @resurrect-processes ''
set -g @catppuccin_window_status_icon_enable "yes"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_status_left_separator "█"
set -g @catppuccin_status_fill "all"
set -g @catppuccin_status_modules_right "application session battery"
set -g @catppuccin_application_icon ""
# plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'MunifTanjim/tmux-mode-indicator'
set -g @plugin 'christoomey/vim-tmux-navigator'
run '~/.tmux/plugins/tpm/tpm'

109
global/.zshrc Normal file
View file

@ -0,0 +1,109 @@
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git python tmux genpass web-search zsh-syntax-highlighting zsh-autosuggestions)
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
source $ZSH/oh-my-zsh.sh
# functions
### ARCHIVE EXTRACTION
# usage: ex <file>
ex ()
{
if [ -f "$1" ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;;
*.tar.zst) unzstd $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# aliases
## tmux
alias tsc='tmux switch-client -t'
alias tsd='tmux new-session -d -s'
alias txrd='tmux source-file ~/.tmux.conf'
## default command
alias cat='bat --paging=never --theme=Dracula'
alias ls="eza"
alias la="eza -lagh --git --header"
alias lt="eza -T --git-ignore"
#alias nano='micro'
## files/dirs
alias zshe='vim ~/.zshrc'
alias zshs='. ~/.zshrc'
## neomutt
alias nm='neomutt'
## vim
alias diary='vim ~/vimwiki/diary/diary.asc.md'
## wttr.in
alias wr='curl wttr.in'
## python
alias python='python3'
alias py='python'
# Preferred editor for local and remote sessions
export EDITOR='vim'
# bindkeys
## autosuggest
bindkey "^]" autosuggest-accept
# envs
export DISABLE_AUTO_TITLE='true'
## fzf dracula theme
export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
--color=dark
--color=fg:-1,bg:-1,hl:#5fff87,fg+:-1,bg+:-1,hl+:#ffaf5f
--color=info:#af87ff,prompt:#5fff87,pointer:#ff87d7,marker:#ff87d7,spinner:#ff87d7'
# paths
## rust
source $HOME/.cargo/env
## all from local/bin
export PATH=$PATH:$HOME/.local/bin
## pdtm
export PATH=$PATH:$HOME/.pdtm/go/bin
## doom emacs
export PATH=$PATH:$HOME/.config/emacs/bin
## golang
export GOPATH=$HOME/go # don't forget to change your path correctly!
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:/usr/local/go/bin
## color
export TERM=tmux-256color
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
source ./.zshrc-additional