updates
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
export TERM=xterm-256color
|
||||
export PROTON_ENABLE_WAYLAND=1
|
||||
|
||||
grep --color=auto < /dev/null &>/dev/null && alias grep='grep --color=auto'
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
@@ -32,11 +33,6 @@ alias \
|
||||
# startx=starth
|
||||
alias startx="dbus-run-session startx"
|
||||
|
||||
alias \
|
||||
elog="doas tail -f /var/log/emerge-fetch.log"\
|
||||
emerge="doas px emerge"\
|
||||
eu="doas etc-update"
|
||||
|
||||
alias pgrep="pgrep -a"
|
||||
alias qb=qbittorrent-nox
|
||||
alias s=ssh\ laptop
|
||||
@@ -106,38 +102,3 @@ noipv6(){
|
||||
doas sysctl -w net.ipv6.conf.default.disable_ipv6=1
|
||||
doas sysctl -w net.ipv6.conf.lo.disable_ipv6=1
|
||||
}
|
||||
|
||||
#PROXYCHAINS_IGNORE=(
|
||||
# cd exit clear fg bg jobs history
|
||||
# ssh scp sftp
|
||||
# proxychains
|
||||
#)
|
||||
#
|
||||
#autoload -U add-zsh-hook
|
||||
#
|
||||
#_proxychains_auto() {
|
||||
# local cmd="$BUFFER"
|
||||
# [[ -z "$cmd" ]] && return
|
||||
#
|
||||
# # get first word of command
|
||||
# local first=${cmd%% *}
|
||||
#
|
||||
# # ignore listed commands
|
||||
# for ignore in "${PROXYCHAINS_IGNORE[@]}"; do
|
||||
# [[ "$first" == "$ignore" ]] && return
|
||||
# done
|
||||
#
|
||||
# # sudo/doas handling
|
||||
# if [[ "$cmd" == sudo\ * ]]; then
|
||||
# BUFFER="sudo proxychains ${cmd#sudo }"
|
||||
# elif [[ "$cmd" == doas\ * ]]; then
|
||||
# BUFFER="doas proxychains ${cmd#doas }"
|
||||
# else
|
||||
# BUFFER="proxychains $cmd"
|
||||
# fi
|
||||
#}
|
||||
#
|
||||
#add-zsh-hook preexec _proxychains_auto
|
||||
if test -z "$XDG_RUNTIME_DIR"; then
|
||||
export XDG_RUNTIME_DIR=$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX)
|
||||
fi
|
||||
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
require("plugins/lazy")
|
||||
require("plugins/lsp")
|
||||
require("plugins/nvim-tree")
|
||||
require("plugins/telescope")
|
||||
require("plugins/treesitter")
|
||||
require("config")
|
||||
require("plugins/render-markdown")
|
||||
--require("status_line").setup()
|
||||
require("plugins/lualine")
|
||||
require("plugins/catppuccin")
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" },
|
||||
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
|
||||
"comfy-line-numbers.nvim": { "branch": "main", "commit": "9adedbaf1f410cdaacf4fb2ca8eb44f3d5f6d010" },
|
||||
"fterm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
|
||||
"gentoo-syntax": { "branch": "master", "commit": "1b3a81ec62e5c843245dc431be0fe072add7eca8" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "b7ace9ddb1640ce266012a45a672dfdaedfa5ec6" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" },
|
||||
"mason.nvim": { "branch": "main", "commit": "16ba83bfc8a25f52bb545134f5bee082b195c460" },
|
||||
"mini.nvim": { "branch": "main", "commit": "d5e6f5b843f1d813d9c4bfb242b751dc5ab6f8ae" },
|
||||
"moonfly": { "branch": "master", "commit": "261664f92ed51cf0c077555b2d4b2530307eac17" },
|
||||
"none-ls-extras.nvim": { "branch": "main", "commit": "27681d797a26f1b4d6119296df42f5204c88a2dc" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "01f8e62ea11603e59ad9ff7afcfa94fd183f76d6" },
|
||||
"nvim": { "branch": "main", "commit": "0303a7208dba448c459767486a38a6ec05c4216b" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "229b79051b380377664edc4cbd534930154921a1" },
|
||||
"nvim-numbertoggle": { "branch": "main", "commit": "c5c0d305aee8532b5515914a08396b9154394c55" },
|
||||
"nvim-toggler": { "branch": "main", "commit": "467808600882fd6c9e33b9dbc4889b1b80cfd917" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "07f541fcaa4a5ae019598240362449ab7e9812b3" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "5adf0895310c1904e5abfaad40a2baad7fe44a07" },
|
||||
"telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
||||
"twilight.nvim": { "branch": "main", "commit": "664e752f4a219801265cc3fc18782b457b58c1e1" },
|
||||
"typst-preview.nvim": { "branch": "master", "commit": "325036ee145ca51d9efb145c09ac16bce3bc8b7d" },
|
||||
"vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" },
|
||||
"vim-vsnip": { "branch": "master", "commit": "9bcfabea653abdcdac584283b5097c3f8760abaa" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
}
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
local opt = vim.opt
|
||||
local map = vim.keymap.set
|
||||
local g = vim.g
|
||||
|
||||
--filetypes
|
||||
vim.cmd("autocmd BufRead,BufNewFile *.m set filetype=objc")
|
||||
|
||||
g.mapleader = " "
|
||||
|
||||
opt.shiftwidth = 4
|
||||
opt.tabstop = 4
|
||||
opt.softtabstop = 4
|
||||
opt.smarttab = true
|
||||
opt.smartindent = true
|
||||
|
||||
opt.undofile = true
|
||||
opt.undodir = vim.fn.stdpath("config") .. "/undo"
|
||||
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
|
||||
opt.fillchars = "eob: "
|
||||
|
||||
g.loaded_netrw = 1
|
||||
g.loaded_netrwPlugin = 1
|
||||
|
||||
opt.termguicolors = true
|
||||
|
||||
opt.spell = false
|
||||
opt.spelllang = { "en_us" }
|
||||
|
||||
opt.shell = "/usr/bin/zsh"
|
||||
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = function(err, result, ctx, config)
|
||||
config = config or {}
|
||||
config.border = "single"
|
||||
return vim.lsp.handlers.hover(err, result, ctx, config)
|
||||
end
|
||||
vim.diagnostic.config({ float = { border = "single" } })
|
||||
|
||||
map("n", "<leader>u", ":Telescope<cr>")
|
||||
map("n", "<leader>t", ":tabnew<cr>")
|
||||
map("n", "<A-Right>", ":tabn<cr>")
|
||||
map("n", "<A-Left>", ":tabp<cr>")
|
||||
map("n", "<A-q>", ":bw<cr>")
|
||||
|
||||
map("n", "<leader>.", vim.diagnostic.open_float)
|
||||
|
||||
map("n", "<leader>=", "=")
|
||||
|
||||
map("n", "<leader>x", "<cmd>!chmod +x %<CR>")
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
|
||||
local opts = { buffer = ev.buf }
|
||||
map("n", "K", function()
|
||||
vim.lsp.buf.hover({ border = "single" })
|
||||
end, opts)
|
||||
map("n", "gi", vim.lsp.buf.implementation, opts)
|
||||
map("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||
map("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||
map("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||
map("n", "<space>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
map("n", "<space>D", vim.lsp.buf.type_definition, opts)
|
||||
map("n", "<space>rn", vim.lsp.buf.rename, opts)
|
||||
map({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
||||
map("n", "gr", vim.lsp.buf.references, opts)
|
||||
map("n", "<space>f", function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
map("n", "<leader>ff", builtin.find_files, {})
|
||||
map("n", "<leader>fg", builtin.live_grep, {})
|
||||
map("n", "<leader>fb", builtin.buffers, {})
|
||||
map("n", "<leader>fh", builtin.help_tags, {})
|
||||
local treeapi = require("nvim-tree.api")
|
||||
map("n", "<leader>e", treeapi.tree.toggle, {})
|
||||
|
||||
map("n", "<A-i>", '<CMD>lua require("FTerm").toggle()<CR>')
|
||||
map("t", "<A-i>", '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>')
|
||||
Executable
+90
@@ -0,0 +1,90 @@
|
||||
local colors = {
|
||||
black = "#121212",
|
||||
white = "#ffffff",
|
||||
gray = "#7e7e7e",
|
||||
light_gray = "#d0d0d0",
|
||||
dark_gray = "#505050",
|
||||
red = "#ff5c57",
|
||||
green = "#5af78e",
|
||||
yellow = "#f3f99d",
|
||||
blue = "#57c7ff",
|
||||
purple = "#d183e8",
|
||||
cyan = "#9aedfe",
|
||||
}
|
||||
|
||||
local highlights = {
|
||||
Normal = { fg = colors.light_gray, bg = "NONE" },
|
||||
NormalNC = { fg = colors.light_gray, bg = "NONE" },
|
||||
SignColumn = { bg = "NONE" },
|
||||
FoldColumn = { bg = "NONE" },
|
||||
Comment = { fg = colors.gray, italic = true },
|
||||
Constant = { fg = colors.blue },
|
||||
String = { fg = colors.green },
|
||||
Identifier = { fg = colors.blue },
|
||||
Function = { fg = colors.purple },
|
||||
Statement = { fg = colors.yellow },
|
||||
PreProc = { fg = colors.cyan },
|
||||
Type = { fg = colors.blue },
|
||||
Special = { fg = colors.red },
|
||||
Underlined = { fg = colors.white, underline = true },
|
||||
Todo = { fg = colors.black, bg = colors.yellow, bold = true },
|
||||
StatusLine = { fg = colors.white, bg = "NONE" },
|
||||
StatusLineNC = { fg = colors.light_gray, bg = "NONE" },
|
||||
NvimTreeNormal = { fg = colors.light_gray, bg = "NONE" },
|
||||
NvimTreeNormalNC = { fg = colors.light_gray, bg = "NONE" },
|
||||
NvimTreeWinSeparator = { fg = colors.dark_gray, bg = "NONE" },
|
||||
NvimTreeFolderName = { fg = colors.blue, bold = true },
|
||||
NvimTreeOpenedFolderName = { fg = colors.green, bold = true },
|
||||
NvimTreeRootFolder = { fg = colors.yellow, bold = true, underline = true },
|
||||
NvimTreeFileIcon = { fg = colors.light_gray },
|
||||
NvimTreeGitDirty = { fg = colors.red },
|
||||
NvimTreeGitStaged = { fg = colors.green },
|
||||
NvimTreeGitNew = { fg = colors.blue },
|
||||
NvimTreeGitRenamed = { fg = colors.purple },
|
||||
NvimTreeGitDeleted = { fg = colors.red },
|
||||
CursorLine = { bg = colors.dark_gray },
|
||||
}
|
||||
|
||||
for group, opts in pairs(highlights) do
|
||||
vim.api.nvim_set_hl(0, group, opts)
|
||||
end
|
||||
|
||||
local inactive_style = { fg = colors.dark_gray, bg = "NONE" }
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = {
|
||||
normal = {
|
||||
a = { fg = colors.black, bg = colors.white, gui = "bold" },
|
||||
b = { fg = colors.white, bg = colors.dark_gray },
|
||||
c = { fg = colors.white, bg = "NONE" },
|
||||
},
|
||||
inactive = {
|
||||
a = { fg = colors.dark_gray, bg = "NONE", gui = "bold" },
|
||||
b = inactive_style,
|
||||
c = inactive_style,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("nvim-tree").setup({
|
||||
view = {
|
||||
width = 30,
|
||||
side = "left",
|
||||
},
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
root_folder_modifier = ":~",
|
||||
icons = {
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
})
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
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",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local lazy_plugins = require("plugins/lazy/plugins")
|
||||
|
||||
require("lazy").setup(lazy_plugins)
|
||||
require("mason").setup()
|
||||
Executable
+130
@@ -0,0 +1,130 @@
|
||||
return {
|
||||
"andweeb/presence.nvim",
|
||||
"catppuccin/nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"gentoo/gentoo-syntax",
|
||||
"williamboman/mason.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.5",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
},
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
},
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
dependencies = {
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
},
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
},
|
||||
},
|
||||
{
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "VeryLazy",
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
"f3fora/cmp-spell",
|
||||
{
|
||||
"debugloop/telescope-undo.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"chomosuke/typst-preview.nvim",
|
||||
lazy = false,
|
||||
version = "1.*",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-mini/mini.nvim",
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
"sitiom/nvim-numbertoggle",
|
||||
"mluders/comfy-line-numbers.nvim",
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/twilight.nvim",
|
||||
opts = {
|
||||
dimming = {
|
||||
alpha = 0.35,
|
||||
color = { "Normal" },
|
||||
term_bg = "#282828",
|
||||
inactive = false,
|
||||
},
|
||||
context = 15,
|
||||
treesitter = true,
|
||||
expand = {
|
||||
"function",
|
||||
"method",
|
||||
"table",
|
||||
"if_statement",
|
||||
},
|
||||
exclude = {
|
||||
"md",
|
||||
},
|
||||
},
|
||||
},
|
||||
"nguyenvukhang/nvim-toggler",
|
||||
"alvan/vim-closetag",
|
||||
{
|
||||
"numtostr/fterm.nvim",
|
||||
border = "double",
|
||||
dimensions = {
|
||||
height = 0.9,
|
||||
width = 0.9,
|
||||
},
|
||||
},
|
||||
{
|
||||
"bluz71/vim-moonfly-colors",
|
||||
name = "moonfly",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
},
|
||||
}
|
||||
Executable
+305
@@ -0,0 +1,305 @@
|
||||
local lsp = require("lspconfig")
|
||||
local cmp = require("cmp")
|
||||
|
||||
vim.lsp.config('*', {
|
||||
root_markers = { '.git' },
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
source = 'if_many',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = '✘',
|
||||
[vim.diagnostic.severity.WARN] = '▲',
|
||||
[vim.diagnostic.severity.HINT] = '⚑',
|
||||
[vim.diagnostic.severity.INFO] = '»',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local orig = vim.lsp.util.open_floating_preview
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
|
||||
opts = opts or {}
|
||||
opts.border = opts.border or 'rounded'
|
||||
opts.max_width = opts.max_width or 80
|
||||
opts.max_height = opts.max_height or 24
|
||||
opts.wrap = opts.wrap ~= false
|
||||
return orig(contents, syntax, opts, ...)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||
callback = function(args)
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
local buf = args.buf
|
||||
local map = function(mode, lhs, rhs) vim.keymap.set(mode, lhs, rhs, { buffer = buf }) end
|
||||
|
||||
map('n', 'K', vim.lsp.buf.hover)
|
||||
map('n', 'gd', vim.lsp.buf.definition)
|
||||
map('n', 'gD', vim.lsp.buf.declaration)
|
||||
map('n', 'gi', vim.lsp.buf.implementation)
|
||||
map('n', 'go', vim.lsp.buf.type_definition)
|
||||
map('n', 'gr', vim.lsp.buf.references)
|
||||
map('n', 'gs', vim.lsp.buf.signature_help)
|
||||
map('n', 'gl', vim.diagnostic.open_float)
|
||||
map('n', '<F2>', vim.lsp.buf.rename)
|
||||
map({ 'n', 'x' }, '<F3>', function() vim.lsp.buf.format({ async = true }) end)
|
||||
map('n', '<F4>', vim.lsp.buf.code_action)
|
||||
|
||||
if client:supports_method('textDocument/documentHighlight') then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('my.lsp.highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
|
||||
local excluded_filetypes = { php = true, c = true, cpp = true }
|
||||
if not client:supports_method('textDocument/willSaveWaitUntil')
|
||||
and client:supports_method('textDocument/formatting')
|
||||
and not excluded_filetypes[vim.bo[buf].filetype]
|
||||
then
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp.format', { clear = false }),
|
||||
buffer = buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = buf, id = client.id, timeout_ms = 1000 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
require("nvim-autopairs").setup({})
|
||||
require("lsp_signature").setup({ hint_enable = false })
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<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 = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered()
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp", keyword_length = 1 },
|
||||
{ name = "vsnip" },
|
||||
}, {
|
||||
{ name = "buffer", keyword_length = 1 },
|
||||
{ name = "spell" },
|
||||
}),
|
||||
})
|
||||
|
||||
local caps = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
vim.lsp.config['luals'] = {
|
||||
cmd = { 'lua-language-server' },
|
||||
filetypes = { 'lua' },
|
||||
root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = 'LuaJIT' },
|
||||
diagnostics = { globals = { 'vim' } },
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = vim.list_extend(
|
||||
vim.api.nvim_get_runtime_file('', true),
|
||||
{ '/home/tony/repos/oxwm/templates' }
|
||||
),
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['cssls'] = {
|
||||
cmd = { 'vscode-css-language-server', '--stdio' },
|
||||
filetypes = { 'css', 'scss', 'less' },
|
||||
root_markers = { 'package.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
css = { validate = true },
|
||||
scss = { validate = true },
|
||||
less = { validate = true },
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['phpls'] = {
|
||||
cmd = { 'intelephense', '--stdio' },
|
||||
filetypes = { 'php' },
|
||||
root_markers = { 'composer.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
intelephense = {
|
||||
files = { maxSize = 5000000 },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['ts_ls'] = {
|
||||
cmd = { 'typescript-language-server', '--stdio' },
|
||||
filetypes = { 'javascript', 'javascriptreact', 'javascript.jsx', 'typescript', 'typescriptreact', 'typescript.tsx' },
|
||||
root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
completions = { completeFunctionCalls = true },
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['zls'] = {
|
||||
cmd = { 'zls' },
|
||||
filetypes = { 'zig', 'zir' },
|
||||
root_markers = { 'zls.json', 'build.zig', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
zls = {
|
||||
enable_build_on_save = true,
|
||||
build_on_save_step = "install",
|
||||
warn_style = false,
|
||||
enable_snippets = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.lsp.config['nil_ls'] = {
|
||||
cmd = { 'nil' },
|
||||
filetypes = { 'nix' },
|
||||
root_markers = { 'flake.nix', 'default.nix', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
['nil'] = {
|
||||
formatting = {
|
||||
command = { "nixpkgs-fmt" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.lsp.config['rust_analyzer'] = {
|
||||
cmd = { 'rust-analyzer' },
|
||||
filetypes = { 'rust' },
|
||||
root_markers = { 'Cargo.toml', 'rust-project.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
cargo = { allFeatures = true },
|
||||
formatting = { command = { "rustfmt" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['clangd'] = {
|
||||
cmd = { 'clangd', '--background-index', '--clang-tidy' },
|
||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp' },
|
||||
root_markers = { 'compile_commands.json', '.clangd', 'configure.ac', 'Makefile', '.git' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.lsp.config['c3lsp'] = {
|
||||
cmd = { 'c3-lsp' },
|
||||
filetypes = { 'c3' },
|
||||
root_markers = { 'project.json', '.git' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.lsp.config['serve_d'] = {
|
||||
cmd = { 'serve-d' },
|
||||
filetypes = { 'd' },
|
||||
root_markers = { 'dub.sdl', 'dub.json', '.git' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.lsp.config['jsonls'] = {
|
||||
cmd = { 'vscode-json-languageserver', '--stdio' },
|
||||
filetypes = { 'json', 'jsonc' },
|
||||
root_markers = { 'package.json', '.git', 'config.jsonc' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.lsp.config['hls'] = {
|
||||
cmd = { 'haskell-language-server-wrapper', '--lsp' },
|
||||
filetypes = { 'haskell', 'lhaskell' },
|
||||
root_markers = { 'stack.yaml', 'cabal.project', 'package.yaml', '*.cabal', 'hie.yaml', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
haskell = {
|
||||
formattingProvider = 'fourmolu',
|
||||
plugin = { semanticTokens = { globalOn = false } },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['gopls'] = {
|
||||
cmd = { 'gopls' },
|
||||
filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' },
|
||||
root_markers = { 'go.mod', 'go.work', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = { unusedparams = false, ST1003 = false, ST1000 = false },
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['templ'] = {
|
||||
cmd = { 'templ', 'lsp' },
|
||||
filetypes = { 'templ' },
|
||||
root_markers = { 'go.mod', '.git' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
h = 'c',
|
||||
c3 = 'c3',
|
||||
d = 'd',
|
||||
templ = 'templ',
|
||||
},
|
||||
})
|
||||
|
||||
---@diagnostic disable-next-line: invisible
|
||||
for name, _ in pairs(vim.lsp.config._configs) do
|
||||
if name ~= '*' then
|
||||
vim.lsp.enable(name)
|
||||
end
|
||||
end
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
local lualine = require("lualine")
|
||||
|
||||
lualine.setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = { left = "|", right = "|" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = {
|
||||
{ "branch", color = { bg = "NONE" } },
|
||||
{ "diff", color = { bg = "NONE" } },
|
||||
{ "diagnostics", color = { bg = "NONE" } }
|
||||
},
|
||||
lualine_c = { { "filename", color = { bg = "NONE" } } },
|
||||
lualine_x = {
|
||||
{ "encoding", color = { bg = "NONE" } },
|
||||
{ "fileformat", color = { bg = "NONE" } },
|
||||
{ "filetype", color = { bg = "NONE" } }
|
||||
},
|
||||
lualine_y = {},
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { { "filename", color = { bg = "NONE" } } },
|
||||
lualine_x = { { "location", color = { bg = "NONE" } } },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
})
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
local tree = require("nvim-tree")
|
||||
tree.setup()
|
||||
Executable
+139
@@ -0,0 +1,139 @@
|
||||
require("render-markdown").setup({
|
||||
link = {
|
||||
-- Turn on / off inline link icon rendering.
|
||||
enabled = true,
|
||||
-- Additional modes to render links.
|
||||
render_modes = false,
|
||||
-- How to handle footnote links, start with a '^'.
|
||||
footnote = {
|
||||
-- Turn on / off footnote rendering.
|
||||
enabled = true,
|
||||
-- Replace value with superscript equivalent.
|
||||
superscript = true,
|
||||
-- Added before link content.
|
||||
prefix = "",
|
||||
-- Added after link content.
|
||||
suffix = "",
|
||||
},
|
||||
-- Inlined with 'image' elements.
|
||||
image = " ",
|
||||
-- Inlined with 'email_autolink' elements.
|
||||
email = " ",
|
||||
-- Fallback icon for 'inline_link' and 'uri_autolink' elements.
|
||||
hyperlink = " ",
|
||||
-- Applies to the inlined icon as a fallback.
|
||||
highlight = "RenderMarkdownLink",
|
||||
-- Applies to WikiLink elements.
|
||||
wiki = {
|
||||
icon = " ",
|
||||
body = function()
|
||||
return nil
|
||||
end,
|
||||
highlight = "RenderMarkdownWikiLink",
|
||||
},
|
||||
-- Define custom destination patterns so icons can quickly inform you of what a link
|
||||
-- contains. Applies to 'inline_link', 'uri_autolink', and wikilink nodes. When multiple
|
||||
-- patterns match a link the one with the longer pattern is used.
|
||||
-- The key is for healthcheck and to allow users to change its values, value type below.
|
||||
-- | pattern | matched against the destination text |
|
||||
-- | icon | gets inlined before the link text |
|
||||
-- | kind | optional determines how pattern is checked |
|
||||
-- | | pattern | @see :h lua-patterns, is the default if not set |
|
||||
-- | | suffix | @see :h vim.endswith() |
|
||||
-- | priority | optional used when multiple match, uses pattern length if empty |
|
||||
-- | highlight | optional highlight for 'icon', uses fallback highlight if empty |
|
||||
custom = {
|
||||
web = { pattern = "^http", icon = " " },
|
||||
github = { pattern = "github%.com", icon = " " },
|
||||
gitlab = { pattern = "gitlab%.com", icon = " " },
|
||||
stackoverflow = { pattern = "stackoverflow%.com", icon = " " },
|
||||
wikipedia = { pattern = "wikipedia%.org", icon = " " },
|
||||
youtube = { pattern = "youtube%.com", icon = " " },
|
||||
},
|
||||
},
|
||||
callout = {
|
||||
-- Callouts are a special instance of a 'block_quote' that start with a 'shortcut_link'.
|
||||
-- The key is for healthcheck and to allow users to change its values, value type below.
|
||||
-- | raw | matched against the raw text of a 'shortcut_link', case insensitive |
|
||||
-- | rendered | replaces the 'raw' value when rendering |
|
||||
-- | highlight | highlight for the 'rendered' text and quote markers |
|
||||
-- | quote_icon | optional override for quote.icon value for individual callout |
|
||||
-- | category | optional metadata useful for filtering |
|
||||
|
||||
note = { raw = "[!NOTE]", rendered = " Note", highlight = "RenderMarkdownInfo" },
|
||||
tip = { raw = "[!TIP]", rendered = " Tip", highlight = "RenderMarkdownSuccess" },
|
||||
important = { raw = "[!IMPORTANT]", rendered = " Important", highlight = "RenderMarkdownHint" },
|
||||
warning = { raw = "[!WARNING]", rendered = " Warning", highlight = "RenderMarkdownWarn" },
|
||||
caution = { raw = "[!CAUTION]", rendered = " Caution", highlight = "RenderMarkdownError" },
|
||||
abstract = { raw = "[!ABSTRACT]", rendered = " Abstract", highlight = "RenderMarkdownInfo" },
|
||||
summary = { raw = "[!SUMMARY]", rendered = " Summary", highlight = "RenderMarkdownInfo" },
|
||||
tldr = { raw = "[!TLDR]", rendered = " Tldr", highlight = "RenderMarkdownInfo" },
|
||||
info = { raw = "[!INFO]", rendered = " Info", highlight = "RenderMarkdownInfo" },
|
||||
todo = { raw = "[!TODO]", rendered = " Todo", highlight = "RenderMarkdownInfo" },
|
||||
hint = { raw = "[!HINT]", rendered = " Hint", highlight = "RenderMarkdownSuccess" },
|
||||
success = { raw = "[!SUCCESS]", rendered = " Success", highlight = "RenderMarkdownSuccess" },
|
||||
check = { raw = "[!CHECK]", rendered = " Check", highlight = "RenderMarkdownSuccess" },
|
||||
done = { raw = "[!DONE]", rendered = " Done", highlight = "RenderMarkdownSuccess" },
|
||||
question = { raw = "[!QUESTION]", rendered = " Question", highlight = "RenderMarkdownWarn" },
|
||||
help = { raw = "[!HELP]", rendered = " Help", highlight = "RenderMarkdownWarn" },
|
||||
faq = { raw = "[!FAQ]", rendered = " Faq", highlight = "RenderMarkdownWarn" },
|
||||
attention = { raw = "[!ATTENTION]", rendered = " Attention", highlight = "RenderMarkdownWarn" },
|
||||
failure = { raw = "[!FAILURE]", rendered = " Failure", highlight = "RenderMarkdownError" },
|
||||
fail = { raw = "[!FAIL]", rendered = " Fail", highlight = "RenderMarkdownError" },
|
||||
missing = { raw = "[!MISSING]", rendered = " Missing", highlight = "RenderMarkdownError" },
|
||||
danger = { raw = "[!DANGER]", rendered = " Danger", highlight = "RenderMarkdownError" },
|
||||
error = { raw = "[!ERROR]", rendered = " Error", highlight = "RenderMarkdownError" },
|
||||
bug = { raw = "[!BUG]", rendered = " Bug", highlight = "RenderMarkdownError" },
|
||||
example = { raw = "[!EXAMPLE]", rendered = " Example", highlight = "RenderMarkdownHint" },
|
||||
quote = { raw = "[!QUOTE]", rendered = " Quote", highlight = "RenderMarkdownQuote" },
|
||||
cite = { raw = "[!CITE]", rendered = " Cite", highlight = "RenderMarkdownQuote" },
|
||||
},
|
||||
checkbox = {
|
||||
enabled = true,
|
||||
render_modes = false,
|
||||
bullet = false,
|
||||
right_pad = 1,
|
||||
unchecked = {
|
||||
icon = " ",
|
||||
highlight = "RenderMarkdownUnchecked",
|
||||
scope_highlight = nil,
|
||||
},
|
||||
checked = {
|
||||
icon = " ",
|
||||
highlight = "RenderMarkdownChecked",
|
||||
scope_highlight = nil,
|
||||
},
|
||||
custom = {
|
||||
todo = { raw = "[-]", rendered = " ", highlight = "RenderMarkdownTodo", scope_highlight = nil },
|
||||
},
|
||||
},
|
||||
bullet = {
|
||||
enabled = true,
|
||||
render_modes = false,
|
||||
icons = { "●", "○", "◆", "◇" },
|
||||
ordered_icons = function(ctx)
|
||||
local value = vim.trim(ctx.value)
|
||||
local index = tonumber(value:sub(1, #value - 1))
|
||||
return ("%d."):format(index > 1 and index or ctx.index)
|
||||
end,
|
||||
left_pad = 0,
|
||||
right_pad = 0,
|
||||
highlight = "RenderMarkdownBullet",
|
||||
scope_highlight = {},
|
||||
},
|
||||
quote = { icon = "▋" },
|
||||
anti_conceal = {
|
||||
enabled = true,
|
||||
-- Which elements to always show, ignoring anti conceal behavior. Values can either be
|
||||
-- booleans to fix the behavior or string lists representing modes where anti conceal
|
||||
-- behavior will be ignored. Valid values are:
|
||||
-- head_icon, head_background, head_border, code_language, code_background, code_border,
|
||||
-- dash, bullet, check_icon, check_scope, quote, table_border, callout, link, sign
|
||||
ignore = {
|
||||
code_background = true,
|
||||
sign = true,
|
||||
},
|
||||
above = 0,
|
||||
below = 0,
|
||||
},
|
||||
})
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
local tel = require("telescope")
|
||||
tel.setup({})
|
||||
tel.load_extension("undo")
|
||||
Executable
+305
@@ -0,0 +1,305 @@
|
||||
local lsp = require("lspconfig")
|
||||
local cmp = require("cmp")
|
||||
|
||||
vim.lsp.config('*', {
|
||||
root_markers = { '.git' },
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
source = 'if_many',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = '✘',
|
||||
[vim.diagnostic.severity.WARN] = '▲',
|
||||
[vim.diagnostic.severity.HINT] = '⚑',
|
||||
[vim.diagnostic.severity.INFO] = '»',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local orig = vim.lsp.util.open_floating_preview
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
|
||||
opts = opts or {}
|
||||
opts.border = opts.border or 'rounded'
|
||||
opts.max_width = opts.max_width or 80
|
||||
opts.max_height = opts.max_height or 24
|
||||
opts.wrap = opts.wrap ~= false
|
||||
return orig(contents, syntax, opts, ...)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||
callback = function(args)
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
local buf = args.buf
|
||||
local map = function(mode, lhs, rhs) vim.keymap.set(mode, lhs, rhs, { buffer = buf }) end
|
||||
|
||||
map('n', 'K', vim.lsp.buf.hover)
|
||||
map('n', 'gd', vim.lsp.buf.definition)
|
||||
map('n', 'gD', vim.lsp.buf.declaration)
|
||||
map('n', 'gi', vim.lsp.buf.implementation)
|
||||
map('n', 'go', vim.lsp.buf.type_definition)
|
||||
map('n', 'gr', vim.lsp.buf.references)
|
||||
map('n', 'gs', vim.lsp.buf.signature_help)
|
||||
map('n', 'gl', vim.diagnostic.open_float)
|
||||
map('n', '<F2>', vim.lsp.buf.rename)
|
||||
map({ 'n', 'x' }, '<F3>', function() vim.lsp.buf.format({ async = true }) end)
|
||||
map('n', '<F4>', vim.lsp.buf.code_action)
|
||||
|
||||
if client:supports_method('textDocument/documentHighlight') then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('my.lsp.highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
|
||||
local excluded_filetypes = { php = true, c = true, cpp = true }
|
||||
if not client:supports_method('textDocument/willSaveWaitUntil')
|
||||
and client:supports_method('textDocument/formatting')
|
||||
and not excluded_filetypes[vim.bo[buf].filetype]
|
||||
then
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp.format', { clear = false }),
|
||||
buffer = buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = buf, id = client.id, timeout_ms = 1000 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
require("nvim-autopairs").setup({})
|
||||
require("lsp_signature").setup({ hint_enable = false })
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<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 = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered()
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp", keyword_length = 1 },
|
||||
{ name = "vsnip" },
|
||||
}, {
|
||||
{ name = "buffer", keyword_length = 1 },
|
||||
{ name = "spell" },
|
||||
}),
|
||||
})
|
||||
|
||||
local caps = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
vim.lsp.config['luals'] = {
|
||||
cmd = { 'lua-language-server' },
|
||||
filetypes = { 'lua' },
|
||||
root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = 'LuaJIT' },
|
||||
diagnostics = { globals = { 'vim' } },
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = vim.list_extend(
|
||||
vim.api.nvim_get_runtime_file('', true),
|
||||
{ '/home/tony/repos/oxwm/templates' }
|
||||
),
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['cssls'] = {
|
||||
cmd = { 'vscode-css-language-server', '--stdio' },
|
||||
filetypes = { 'css', 'scss', 'less' },
|
||||
root_markers = { 'package.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
css = { validate = true },
|
||||
scss = { validate = true },
|
||||
less = { validate = true },
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['phpls'] = {
|
||||
cmd = { 'intelephense', '--stdio' },
|
||||
filetypes = { 'php' },
|
||||
root_markers = { 'composer.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
intelephense = {
|
||||
files = { maxSize = 5000000 },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['ts_ls'] = {
|
||||
cmd = { 'typescript-language-server', '--stdio' },
|
||||
filetypes = { 'javascript', 'javascriptreact', 'javascript.jsx', 'typescript', 'typescriptreact', 'typescript.tsx' },
|
||||
root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
completions = { completeFunctionCalls = true },
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['zls'] = {
|
||||
cmd = { 'zls' },
|
||||
filetypes = { 'zig', 'zir' },
|
||||
root_markers = { 'zls.json', 'build.zig', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
zls = {
|
||||
enable_build_on_save = true,
|
||||
build_on_save_step = "install",
|
||||
warn_style = false,
|
||||
enable_snippets = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.lsp.config['nil_ls'] = {
|
||||
cmd = { 'nil' },
|
||||
filetypes = { 'nix' },
|
||||
root_markers = { 'flake.nix', 'default.nix', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
['nil'] = {
|
||||
formatting = {
|
||||
command = { "nixpkgs-fmt" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.lsp.config['rust_analyzer'] = {
|
||||
cmd = { 'rust-analyzer' },
|
||||
filetypes = { 'rust' },
|
||||
root_markers = { 'Cargo.toml', 'rust-project.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
cargo = { allFeatures = true },
|
||||
formatting = { command = { "rustfmt" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['clangd'] = {
|
||||
cmd = { 'clangd', '--background-index', '--clang-tidy' },
|
||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp' },
|
||||
root_markers = { 'compile_commands.json', '.clangd', 'configure.ac', 'Makefile', '.git' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.lsp.config['c3lsp'] = {
|
||||
cmd = { 'c3-lsp' },
|
||||
filetypes = { 'c3' },
|
||||
root_markers = { 'project.json', '.git' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.lsp.config['serve_d'] = {
|
||||
cmd = { 'serve-d' },
|
||||
filetypes = { 'd' },
|
||||
root_markers = { 'dub.sdl', 'dub.json', '.git' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.lsp.config['jsonls'] = {
|
||||
cmd = { 'vscode-json-languageserver', '--stdio' },
|
||||
filetypes = { 'json', 'jsonc' },
|
||||
root_markers = { 'package.json', '.git', 'config.jsonc' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.lsp.config['hls'] = {
|
||||
cmd = { 'haskell-language-server-wrapper', '--lsp' },
|
||||
filetypes = { 'haskell', 'lhaskell' },
|
||||
root_markers = { 'stack.yaml', 'cabal.project', 'package.yaml', '*.cabal', 'hie.yaml', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
haskell = {
|
||||
formattingProvider = 'fourmolu',
|
||||
plugin = { semanticTokens = { globalOn = false } },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['gopls'] = {
|
||||
cmd = { 'gopls' },
|
||||
filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' },
|
||||
root_markers = { 'go.mod', 'go.work', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = { unusedparams = false, ST1003 = false, ST1000 = false },
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['templ'] = {
|
||||
cmd = { 'templ', 'lsp' },
|
||||
filetypes = { 'templ' },
|
||||
root_markers = { 'go.mod', '.git' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
h = 'c',
|
||||
c3 = 'c3',
|
||||
d = 'd',
|
||||
templ = 'templ',
|
||||
},
|
||||
})
|
||||
|
||||
---@diagnostic disable-next-line: invisible
|
||||
for name, _ in pairs(vim.lsp.config._configs) do
|
||||
if name ~= '*' then
|
||||
vim.lsp.enable(name)
|
||||
end
|
||||
end
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
local wk = require("which-key")
|
||||
wk.setup({})
|
||||
Executable
+102
@@ -0,0 +1,102 @@
|
||||
local colors = {
|
||||
foreground = "#ebdbb2",
|
||||
pink = "#b16286",
|
||||
red = "#cc241d",
|
||||
green = "#98971a",
|
||||
yellow = "#d79921",
|
||||
orange = "#d65d0e",
|
||||
magenta = "#b16286",
|
||||
cyan = "#458588",
|
||||
bg_darken = "#1d2021",
|
||||
dark_text = "#1d2021",
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
vim.cmd("hi StatusBackground guifg=" .. colors.foreground .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi Moden guifg=" .. colors.dark_text .. " guibg=" .. colors.pink .. " gui=bold")
|
||||
vim.cmd("hi Modei guifg=" .. colors.dark_text .. " guibg=" .. colors.green .. " gui=bold")
|
||||
vim.cmd("hi Modev guifg=" .. colors.dark_text .. " guibg=" .. colors.yellow .. " gui=bold")
|
||||
vim.cmd("hi Modet guifg=" .. colors.dark_text .. " guibg=" .. colors.orange .. " gui=bold")
|
||||
vim.cmd("hi Modec guifg=" .. colors.dark_text .. " guibg=" .. colors.magenta .. " gui=bold")
|
||||
vim.cmd("hi Moder guifg=" .. colors.dark_text .. " guibg=" .. colors.red .. " gui=bold")
|
||||
vim.cmd("hi Filetype guifg=" .. colors.cyan .. " guibg=" .. colors.bg_darken .. " gui=bold")
|
||||
vim.cmd("hi Position guifg=" .. colors.yellow .. " guibg=" .. colors.bg_darken .. " gui=bold")
|
||||
vim.cmd("hi GitBranch guifg=" .. colors.orange .. " guibg=" .. colors.bg_darken .. " gui=bold")
|
||||
vim.cmd("hi GitDiff guifg=" .. colors.green .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi GitDiffDel guifg=" .. colors.red .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi Separator guifg=" .. colors.foreground .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi LSPError guifg=" .. colors.red .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi LSPWarn guifg=" .. colors.yellow .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi LSPInfo guifg=" .. colors.cyan .. " guibg=" .. colors.bg_darken)
|
||||
vim.cmd("hi LSPOk guifg=" .. colors.green .. " guibg=" .. colors.bg_darken)
|
||||
|
||||
vim.o.statusline = table.concat({
|
||||
"%{%v:lua.themeStatuslineMode()%} ",
|
||||
"%f ",
|
||||
"%{%v:lua.themeGitBranch()%} ",
|
||||
"%{%v:lua.themeGitDiff()%} ",
|
||||
"%{%v:lua.themeLSP()%} ",
|
||||
"%=",
|
||||
"%{%v:lua.themeStatuslineFiletype()%} ",
|
||||
"%{%v:lua.themeStatuslinePosition()%}",
|
||||
})
|
||||
end
|
||||
|
||||
function themeStatuslineMode()
|
||||
local mode = vim.fn.mode()
|
||||
local mode_highlight = "Mode" .. mode:sub(1, 1)
|
||||
return string.format("%%#%s# %s %%#StatusBackground#", mode_highlight, mode:upper())
|
||||
end
|
||||
|
||||
function themeStatuslineFiletype()
|
||||
return string.format("%%#Filetype# %s %%#Separator#│%%#StatusBackground#", vim.bo.filetype)
|
||||
end
|
||||
|
||||
function themeStatuslinePosition()
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return string.format("%%#Position# %03d:%02d ", row, col)
|
||||
end
|
||||
|
||||
function themeGitBranch()
|
||||
local branch = vim.fn.systemlist("git rev-parse --abbrev-ref HEAD 2>/dev/null")[1] or ""
|
||||
if branch ~= "" then
|
||||
return string.format("%%#GitBranch# %s %%#Separator#│%%#StatusBackground#", branch)
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function themeGitDiff()
|
||||
local diff = vim.fn.systemlist("git diff --shortstat 2>/dev/null")[1] or ""
|
||||
local added, removed = diff:match("(%d+) insertions?"), diff:match("(%d+) deletions?")
|
||||
added = added or "0"
|
||||
removed = removed or "0"
|
||||
if diff ~= "" then
|
||||
return string.format("%%#GitDiff#+%s %%#GitDiffDel#-%s %%#StatusBackground#", added, removed)
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function themeLSP()
|
||||
local errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
|
||||
local warns = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
|
||||
local info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
|
||||
local hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
|
||||
local str = ""
|
||||
if errors > 0 then
|
||||
str = str .. string.format("%%#LSPError#E:%d ", errors)
|
||||
end
|
||||
if warns > 0 then
|
||||
str = str .. string.format("%%#LSPWarn#W:%d ", warns)
|
||||
end
|
||||
if info > 0 then
|
||||
str = str .. string.format("%%#LSPInfo#I:%d ", info)
|
||||
end
|
||||
if hints > 0 then
|
||||
str = str .. string.format("%%#LSPOk#H:%d ", hints)
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
return M
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user