mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-11 07:02:41 +02:00
feat: neovim
This commit is contained in:
@@ -127,7 +127,4 @@ Other dotfiles && docs that inspired me:
|
|||||||
- [fufexan/dotfiles](https://github.com/fufexan/dotfiles)
|
- [fufexan/dotfiles](https://github.com/fufexan/dotfiles)
|
||||||
- [davidtwco/veritas](https://github.com/davidtwco/veritas)
|
- [davidtwco/veritas](https://github.com/davidtwco/veritas)
|
||||||
- [gvolpe/nix-config](https://github.com/gvolpe/nix-config)
|
- [gvolpe/nix-config](https://github.com/gvolpe/nix-config)
|
||||||
|
- [Ruixi-rebirth/flakes](https://github.com/Ruixi-rebirth/flakes)
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|||||||
Submodule
+1
Submodule flakes added at 1c6bfb0789
@@ -75,20 +75,6 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
# modern vim
|
|
||||||
neovim = {
|
|
||||||
enable = true;
|
|
||||||
defaultEditor = true;
|
|
||||||
viAlias = false;
|
|
||||||
vimAlias = true;
|
|
||||||
|
|
||||||
# enable line number, disable mouse visual mode
|
|
||||||
extraConfig = ''
|
|
||||||
set number relativenumber mouse-=a
|
|
||||||
'';
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
direnv = {
|
direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
nix-direnv.enable = true;
|
nix-direnv.enable = true;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./neovim
|
||||||
./nushell
|
./nushell
|
||||||
./tmux
|
./tmux
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
{ config, lib, inputs, pkgs, ... }:
|
||||||
|
|
||||||
|
# references:
|
||||||
|
# https://github.com/Ruixi-rebirth/flakes/tree/main/modules/editors/nvim
|
||||||
|
# https://github.com/Chever-John/dotfiles/tree/master/nvim
|
||||||
|
{
|
||||||
|
nixpkgs.config = {
|
||||||
|
programs.npm.npmrc = ''
|
||||||
|
prefix = ''${HOME}/.npm-global
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
programs = {
|
||||||
|
neovim = {
|
||||||
|
enable = true;
|
||||||
|
defaultEditor = true;
|
||||||
|
viAlias = false;
|
||||||
|
vimAlias = true;
|
||||||
|
withPython3 = true;
|
||||||
|
withNodeJs = true;
|
||||||
|
extraPackages = [
|
||||||
|
];
|
||||||
|
#-- Plugins --#
|
||||||
|
plugins = with pkgs.vimPlugins;[ ];
|
||||||
|
#-- --#
|
||||||
|
};
|
||||||
|
};
|
||||||
|
home = {
|
||||||
|
packages = with pkgs; [
|
||||||
|
#-- LSP --#
|
||||||
|
nodePackages_latest.typescript
|
||||||
|
nodePackages_latest.typescript-language-server
|
||||||
|
nodePackages_latest.vscode-langservers-extracted
|
||||||
|
nodePackages_latest.bash-language-server
|
||||||
|
nil
|
||||||
|
# rnix-lsp
|
||||||
|
# nixd
|
||||||
|
lua-language-server
|
||||||
|
gopls
|
||||||
|
pyright
|
||||||
|
zk
|
||||||
|
rust-analyzer
|
||||||
|
clang-tools
|
||||||
|
haskell-language-server
|
||||||
|
#-- tree-sitter --#
|
||||||
|
tree-sitter
|
||||||
|
#-- format --#
|
||||||
|
stylua
|
||||||
|
black
|
||||||
|
nixpkgs-fmt
|
||||||
|
rustfmt
|
||||||
|
beautysh
|
||||||
|
nodePackages.prettier
|
||||||
|
stylish-haskell
|
||||||
|
#-- Debug --#
|
||||||
|
lldb
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
home.file.".config/nvim/init.lua".source = ./init.lua;
|
||||||
|
home.file.".config/nvim/lua".source = ./lua;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
require("base")
|
||||||
|
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 lazy_theme
|
||||||
|
if os.getenv("GTK_THEME") == "Nordic" then
|
||||||
|
lazy_theme = "nord"
|
||||||
|
elseif os.getenv("GTK_THEME") == "Catppuccin-Frappe-Pink" then
|
||||||
|
lazy_theme = "catppuccin-frappe"
|
||||||
|
else
|
||||||
|
lazy_theme = "catppuccin-latte"
|
||||||
|
end
|
||||||
|
local opts = {
|
||||||
|
install = {
|
||||||
|
colorscheme = { lazy_theme },
|
||||||
|
},
|
||||||
|
ui = {
|
||||||
|
size = { width = 1.0, height = 1.0 },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
require("lazy").setup("plugins", opts)
|
||||||
Executable
+16
@@ -0,0 +1,16 @@
|
|||||||
|
--Revert to where the cursor was when the file was last closed
|
||||||
|
vim.cmd([[autocmd BufReadPost *
|
||||||
|
\ if line("'\"") > 1 && line("'\"") <= line("$") |
|
||||||
|
\ exe "normal! g`\"" |
|
||||||
|
\ endif]])
|
||||||
|
|
||||||
|
vim.cmd([[set iskeyword+=-]])
|
||||||
|
|
||||||
|
vim.cmd("set whichwrap+=<,>,[,],h,l")
|
||||||
|
-- about fold
|
||||||
|
vim.cmd("set foldmethod=expr")
|
||||||
|
vim.cmd("set foldexpr=nvim_treesitter#foldexpr()")
|
||||||
|
-- vim.cmd([[autocmd BufReadPost,FileReadPost * normal zR]])
|
||||||
|
|
||||||
|
-- set bg transparent
|
||||||
|
--vim.cmd([[autocmd ColorScheme * highlight Normal guibg=NONE ctermbg=NONE]])
|
||||||
Executable
+3
@@ -0,0 +1,3 @@
|
|||||||
|
require("base.autocmd")
|
||||||
|
require("base.mappings")
|
||||||
|
require("base.options")
|
||||||
+86
@@ -0,0 +1,86 @@
|
|||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
local term_opts = { silent = true }
|
||||||
|
local keymap = vim.api.nvim_set_keymap
|
||||||
|
|
||||||
|
-- Remap space as leader key
|
||||||
|
keymap("", "<Space>", "<Nop>", opts)
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
|
-- Modes
|
||||||
|
-- normal_mode = "n",
|
||||||
|
-- insert_mode = "i",
|
||||||
|
-- visual_mode = "v",
|
||||||
|
-- visual_block_mode = "x",
|
||||||
|
-- term_mode = "t",
|
||||||
|
-- command_mode = "c",
|
||||||
|
|
||||||
|
-- Better to save file & exit file --
|
||||||
|
keymap("n", "Q", ":q<CR>", opts)
|
||||||
|
keymap("n", "S", ":w<CR>", opts)
|
||||||
|
|
||||||
|
-- 'jk' key to exit insert mode --
|
||||||
|
keymap("i", "jk", "<Esc>", opts)
|
||||||
|
|
||||||
|
-- Better window navigation --
|
||||||
|
keymap("n", "<C-h>", "<C-w>h", opts)
|
||||||
|
keymap("n", "<C-j>", "<C-w>j", opts)
|
||||||
|
keymap("n", "<C-k>", "<C-w>k", opts)
|
||||||
|
keymap("n", "<C-l>", "<C-w>l", opts)
|
||||||
|
|
||||||
|
-- Naviagate buffers --
|
||||||
|
keymap("n", "<TAB>", ":bnext<CR>", opts)
|
||||||
|
keymap("n", "<S-TAB>", ":bprevious<CR>", opts)
|
||||||
|
|
||||||
|
-- Stay in indent mode --
|
||||||
|
keymap("v", "<", "<gv", opts)
|
||||||
|
keymap("v", ">", ">gv", opts)
|
||||||
|
|
||||||
|
-- Move text up and down --
|
||||||
|
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)
|
||||||
|
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
|
||||||
|
keymap("v", "J", ":move '>+1<CR>gv-gv", opts)
|
||||||
|
keymap("v", "K", ":move '<-2<CR>gv-gv", opts)
|
||||||
|
|
||||||
|
-- Better split screen --
|
||||||
|
keymap("", "s", "<Nop>", opts)
|
||||||
|
keymap("n", "sl", ":set splitright<CR>:vsplit<CR>", opts)
|
||||||
|
keymap("n", "sh", ":set nosplitright<CR>:vsplit<CR>", opts)
|
||||||
|
keymap("n", "sk", ":set nosplitbelow<CR>:split<CR>", opts)
|
||||||
|
keymap("n", "sj", ":set splitbelow<CR>:split<CR>", opts)
|
||||||
|
|
||||||
|
-- Average adjustment window --
|
||||||
|
keymap("n", "<C-=>", "<C-w>=", opts)
|
||||||
|
-- Swap and move windows --
|
||||||
|
keymap("n", "<Space>h", "<C-w>H", opts)
|
||||||
|
keymap("n", "<Space>j", "<C-w>J", opts)
|
||||||
|
keymap("n", "<Space>k", "<C-w>K", opts)
|
||||||
|
keymap("n", "<Space>l", "<C-w>L", opts)
|
||||||
|
|
||||||
|
-- Adjust the direction of the split screen --
|
||||||
|
keymap("n", ",", "<C-w>t<C-w>K", opts)
|
||||||
|
keymap("n", ".", "<C-w>t<C-w>H", opts)
|
||||||
|
|
||||||
|
-- Resize the window --
|
||||||
|
keymap("n", "<C-Down>", ":resize -2<CR>", opts)
|
||||||
|
keymap("n", "<C-Up>", ":resize +2<CR>", opts)
|
||||||
|
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
|
||||||
|
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
|
||||||
|
|
||||||
|
-- Better viewing of search results --
|
||||||
|
keymap("n", "<Space><CR>", ":nohlsearch<CR>", opts)
|
||||||
|
keymap("n", "n", "nzz", opts)
|
||||||
|
keymap("n", "N", "Nzz", opts)
|
||||||
|
|
||||||
|
-- tabnew
|
||||||
|
keymap("n", "<C-n>", ":tabnew<CR>", opts)
|
||||||
|
-- msic --
|
||||||
|
keymap("n", "<C-u>", "5k", opts)
|
||||||
|
keymap("n", "<C-d>", "5j", opts)
|
||||||
|
keymap("n", "<C-.>", "$", opts)
|
||||||
|
keymap("i", "<C-.>", "<ESC>$", opts)
|
||||||
|
keymap("x", "<C-.>", "$", opts)
|
||||||
|
keymap("v", "<C-.>", "$", opts)
|
||||||
|
keymap("n", "<C-,>", "^", opts)
|
||||||
|
keymap("i", "<C-,>", "<ESC>^", opts)
|
||||||
|
keymap("x", "<C-,>", "^", opts)
|
||||||
|
keymap("v", "<C-,>", "^", opts)
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
local options = {
|
||||||
|
clipboard = "unnamedplus",
|
||||||
|
mouse = "a",
|
||||||
|
undofile = true,
|
||||||
|
ignorecase = true,
|
||||||
|
smartcase = true,
|
||||||
|
showmode = false,
|
||||||
|
showtabline = 2,
|
||||||
|
smartindent = true,
|
||||||
|
autoindent = true,
|
||||||
|
swapfile = true,
|
||||||
|
hidden = true, --default on
|
||||||
|
expandtab = false,
|
||||||
|
cmdheight = 1,
|
||||||
|
shiftwidth = 4, --insert 4 spaces for each indentation
|
||||||
|
tabstop = 4, --insert 4 spaces for a tab
|
||||||
|
cursorline = false, --Highlight the line where the cursor is located
|
||||||
|
cursorcolumn = false,
|
||||||
|
number = true,
|
||||||
|
numberwidth = 4,
|
||||||
|
relativenumber = true,
|
||||||
|
--[[ wrap = false, ]]
|
||||||
|
scrolloff = 8,
|
||||||
|
fileencodings = "utf-8,gbk",
|
||||||
|
updatetime = 50, -- faster completion (4000ms default)
|
||||||
|
foldenable = false,
|
||||||
|
foldlevel = 99,
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v in pairs(options) do
|
||||||
|
vim.opt[k] = v
|
||||||
|
end
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
return {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
dependencies = { "hrsh7th/nvim-cmp" },
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = function()
|
||||||
|
local status_ok, npairs = pcall(require, "nvim-autopairs")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
npairs.setup({
|
||||||
|
check_ts = true,
|
||||||
|
ts_config = {
|
||||||
|
lua = { "string", "source" },
|
||||||
|
javascript = { "string", "template_string" },
|
||||||
|
java = false,
|
||||||
|
},
|
||||||
|
disable_filetype = { "TelescopePrompt", "spectre_panel" },
|
||||||
|
fast_wrap = {
|
||||||
|
map = "<M-e>",
|
||||||
|
chars = { "{", "[", "(", '"', "'" },
|
||||||
|
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
|
||||||
|
offset = 0, -- Offset from pattern match
|
||||||
|
end_key = "$",
|
||||||
|
keys = "qwertyuiopzxcvbnmasdfghjkl",
|
||||||
|
check_comma = true,
|
||||||
|
highlight = "PmenuSel",
|
||||||
|
highlight_grey = "LineNr",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||||
|
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||||
|
if not cmp_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
return {
|
||||||
|
"akinsho/bufferline.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons", "glepnir/lspsaga.nvim" },
|
||||||
|
config = function()
|
||||||
|
local highlights
|
||||||
|
if os.getenv("GTK_THEME") == "Nordic" then
|
||||||
|
highlights = require("nord").bufferline.highlights({
|
||||||
|
italic = true,
|
||||||
|
bold = true,
|
||||||
|
})
|
||||||
|
elseif
|
||||||
|
os.getenv("GTK_THEME") == "Catppuccin-Frappe-Pink" or os.getenv("GTK_THEME") == "Catppuccin-Latte-Green"
|
||||||
|
then
|
||||||
|
highlights = require("catppuccin.groups.integrations.bufferline").get()
|
||||||
|
end
|
||||||
|
require("bufferline").setup({
|
||||||
|
highlights = highlights,
|
||||||
|
options = {
|
||||||
|
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
||||||
|
numbers = "buffer_id",
|
||||||
|
--number_style = "superscript" | "subscript" | "" | { "none", "subscript" }, -- buffer_id at index 1, ordinal at index 2
|
||||||
|
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||||
|
indicator_style = "▎",
|
||||||
|
buffer_close_icon = "x",
|
||||||
|
modified_icon = "●",
|
||||||
|
close_icon = "",
|
||||||
|
left_trunc_marker = "",
|
||||||
|
right_trunc_marker = "",
|
||||||
|
max_name_length = 30,
|
||||||
|
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
|
||||||
|
tab_size = 21,
|
||||||
|
diagnostics = false,
|
||||||
|
diagnostics_update_in_insert = false,
|
||||||
|
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||||
|
show_buffer_icons = true, -- disable filetype icons for buffers
|
||||||
|
show_buffer_close_icons = true,
|
||||||
|
show_close_icon = true,
|
||||||
|
show_tab_indicators = true,
|
||||||
|
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||||
|
-- can also be a table containing 2 custom separators
|
||||||
|
-- [focused and unfocused]. eg: { '|', '|' }
|
||||||
|
separator_style = { "", "" }, --"slant" | "thick" | "thin" | { 'any', 'any' },
|
||||||
|
enforce_regular_tabs = true,
|
||||||
|
always_show_bufferline = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
return {
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
event = "InsertEnter",
|
||||||
|
dependencies = {
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"hrsh7th/cmp-nvim-lua",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||||
|
if not cmp_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||||
|
if not snip_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("luasnip/loaders/from_vscode").lazy_load()
|
||||||
|
|
||||||
|
local kind_icons = {
|
||||||
|
Text = "",
|
||||||
|
Method = "",
|
||||||
|
Function = "",
|
||||||
|
Constructor = "",
|
||||||
|
Field = "",
|
||||||
|
Variable = "",
|
||||||
|
Class = "",
|
||||||
|
Interface = "",
|
||||||
|
Module = "",
|
||||||
|
Property = "",
|
||||||
|
Unit = "",
|
||||||
|
Value = "",
|
||||||
|
Enum = "",
|
||||||
|
Keyword = "",
|
||||||
|
Snippet = "",
|
||||||
|
Color = "",
|
||||||
|
File = "",
|
||||||
|
Reference = "",
|
||||||
|
Folder = "",
|
||||||
|
EnumMember = "",
|
||||||
|
Constant = "",
|
||||||
|
Struct = "",
|
||||||
|
Event = "",
|
||||||
|
Operator = "",
|
||||||
|
TypeParameter = "",
|
||||||
|
}
|
||||||
|
-- find more here: https://www.nerdfonts.com/cheat-sheet
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-u>"] = cmp.mapping.scroll_docs(-4), -- Up
|
||||||
|
["<C-d>"] = cmp.mapping.scroll_docs(4), -- Down
|
||||||
|
-- C-b (back) C-f (forward) for snippet placeholder navigation.
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({
|
||||||
|
select = true,
|
||||||
|
}),
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
fields = { "kind", "abbr", "menu" },
|
||||||
|
format = function(entry, vim_item)
|
||||||
|
-- Kind icons
|
||||||
|
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||||
|
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||||
|
vim_item.menu = ({
|
||||||
|
path = "[Path]",
|
||||||
|
nvim_lua = "[NVIM_LUA]",
|
||||||
|
nvim_lsp = "[LSP]",
|
||||||
|
luasnip = "[Snippet]",
|
||||||
|
buffer = "[Buffer]",
|
||||||
|
})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = "path" },
|
||||||
|
{ name = "nvim_lua" },
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
confirm_opts = {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = false,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
experimental = {
|
||||||
|
ghost_text = false,
|
||||||
|
native_menu = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
}, {
|
||||||
|
{ name = "cmdline" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
return {
|
||||||
|
"numToStr/Comment.nvim",
|
||||||
|
dependencies = { "JoosepAlviste/nvim-ts-context-commentstring" },
|
||||||
|
event = "BufReadPost",
|
||||||
|
config = function()
|
||||||
|
require("Comment").setup({
|
||||||
|
pre_hook = function(ctx)
|
||||||
|
local U = require("Comment.utils")
|
||||||
|
|
||||||
|
local location = nil
|
||||||
|
if ctx.ctype == U.ctype.block then
|
||||||
|
location = require("ts_context_commentstring.utils").get_cursor_location()
|
||||||
|
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
||||||
|
location = require("ts_context_commentstring.utils").get_visual_start_location()
|
||||||
|
end
|
||||||
|
|
||||||
|
return require("ts_context_commentstring.internal").calculate_commentstring({
|
||||||
|
key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
|
||||||
|
location = location,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
padding = true,
|
||||||
|
|
||||||
|
---Whether the cursor should stay at its position
|
||||||
|
---NOTE: This only affects NORMAL mode mappings and doesn't work with dot-repeat
|
||||||
|
---@type boolean
|
||||||
|
sticky = true,
|
||||||
|
|
||||||
|
---Lines to be ignored while comment/uncomment.
|
||||||
|
---Could be a regex string or a function that returns a regex string.
|
||||||
|
---Example: Use '^$' to ignore empty lines
|
||||||
|
---@type string|fun():string
|
||||||
|
ignore = nil,
|
||||||
|
|
||||||
|
---LHS of toggle mappings in NORMAL + VISUAL mode
|
||||||
|
---@type table
|
||||||
|
toggler = {
|
||||||
|
---Line-comment toggle keymap
|
||||||
|
line = "gcc",
|
||||||
|
---Block-comment toggle keymap
|
||||||
|
block = "gbc",
|
||||||
|
},
|
||||||
|
|
||||||
|
---LHS of operator-pending mappings in NORMAL + VISUAL mode
|
||||||
|
---@type table
|
||||||
|
opleader = {
|
||||||
|
---Line-comment keymap
|
||||||
|
line = "gc",
|
||||||
|
---Block-comment keymap
|
||||||
|
block = "gb",
|
||||||
|
},
|
||||||
|
|
||||||
|
---LHS of extra mappings
|
||||||
|
---@type table
|
||||||
|
extra = {
|
||||||
|
---Add comment on the line above
|
||||||
|
above = "gcO",
|
||||||
|
---Add comment on the line below
|
||||||
|
below = "gco",
|
||||||
|
---Add comment at the end of line
|
||||||
|
eol = "gcA",
|
||||||
|
},
|
||||||
|
|
||||||
|
---Create basic (operator-pending) and extended mappings for NORMAL + VISUAL mode
|
||||||
|
---@type table
|
||||||
|
mappings = {
|
||||||
|
---Operator-pending mapping
|
||||||
|
---Includes `gcc`, `gbc`, `gc[count]{motion}` and `gb[count]{motion}`
|
||||||
|
---NOTE: These mappings can be changed individually by `opleader` and `toggler` config
|
||||||
|
basic = true,
|
||||||
|
---Extra mapping
|
||||||
|
---Includes `gco`, `gcO`, `gcA`
|
||||||
|
extra = true,
|
||||||
|
---Extended mapping
|
||||||
|
---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}`
|
||||||
|
extended = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
return {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
keys = {
|
||||||
|
{ "<F6>", "<cmd>lua require('dapui').toggle()<CR>", desc = "dapui_toggle" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local dap = require("dap")
|
||||||
|
dap.adapters.lldb = {
|
||||||
|
type = "executable",
|
||||||
|
command = "/etc/profiles/per-user/ruixi/bin/lldb-vscode", -- adjust as needed, must be absolute path
|
||||||
|
name = "lldb",
|
||||||
|
}
|
||||||
|
dap.configurations.cpp = {
|
||||||
|
{
|
||||||
|
name = "Launch",
|
||||||
|
type = "lldb",
|
||||||
|
request = "launch",
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||||
|
end,
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
stopOnEntry = false,
|
||||||
|
args = {},
|
||||||
|
|
||||||
|
-- 💀
|
||||||
|
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
|
||||||
|
--
|
||||||
|
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
|
||||||
|
--
|
||||||
|
-- Otherwise you might get the following error:
|
||||||
|
--
|
||||||
|
-- Error on launch: Failed to attach to the target process
|
||||||
|
--
|
||||||
|
-- But you should be aware of the implications:
|
||||||
|
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
|
||||||
|
-- runInTerminal = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- If you want to use this for Rust and C, add something like this:
|
||||||
|
|
||||||
|
dap.configurations.c = dap.configurations.cpp
|
||||||
|
dap.configurations.rust = dap.configurations.cpp
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
return {
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
dependencies = { "mfussenegger/nvim-dap" },
|
||||||
|
keys = {
|
||||||
|
{ "<C-b>", "<cmd>lua require'dap'.toggle_breakpoint()<CR>", desc = "toggle_breakpoint" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("dapui").setup()
|
||||||
|
local sign = vim.fn.sign_define
|
||||||
|
|
||||||
|
sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = "" })
|
||||||
|
sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = "" })
|
||||||
|
sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = "" })
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,294 @@
|
|||||||
|
return {
|
||||||
|
"folke/flash.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<c-f>",
|
||||||
|
mode = { "n", "x", "o" },
|
||||||
|
function()
|
||||||
|
require("flash").jump()
|
||||||
|
end,
|
||||||
|
desc = "Flash",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>t",
|
||||||
|
mode = { "n", "o", "x" },
|
||||||
|
function()
|
||||||
|
require("flash").treesitter()
|
||||||
|
end,
|
||||||
|
desc = "Flash Treesitter",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>r",
|
||||||
|
mode = "o",
|
||||||
|
function()
|
||||||
|
require("flash").remote()
|
||||||
|
end,
|
||||||
|
desc = "Remote Flash",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>T",
|
||||||
|
mode = { "o", "x" },
|
||||||
|
function()
|
||||||
|
require("flash").treesitter_search()
|
||||||
|
end,
|
||||||
|
desc = "Flash Treesitter Search",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>f",
|
||||||
|
mode = { "c" },
|
||||||
|
function()
|
||||||
|
require("flash").toggle()
|
||||||
|
end,
|
||||||
|
desc = "Toggle Flash Search",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("flash").setup({
|
||||||
|
-- labels = "abcdefghijklmnopqrstuvwxyz",
|
||||||
|
labels = "asdfghjklqwertyuiopzxcvbnm",
|
||||||
|
search = {
|
||||||
|
-- search/jump in all windows
|
||||||
|
multi_window = true,
|
||||||
|
-- search direction
|
||||||
|
forward = true,
|
||||||
|
-- when `false`, find only matches in the given direction
|
||||||
|
wrap = true,
|
||||||
|
---type Flash.Pattern.Mode
|
||||||
|
-- Each mode will take ignorecase and smartcase into account.
|
||||||
|
-- * exact: exact match
|
||||||
|
-- * search: regular search
|
||||||
|
-- * fuzzy: fuzzy search
|
||||||
|
-- * fun(str): custom function that returns a pattern
|
||||||
|
-- For example, to only match at the beginning of a word:
|
||||||
|
-- mode = function(str)
|
||||||
|
-- return "\\<" .. str
|
||||||
|
-- end,
|
||||||
|
mode = "fuzzy",
|
||||||
|
-- behave like `incsearch`
|
||||||
|
incremental = false,
|
||||||
|
-- Excluded filetypes and custom window filters
|
||||||
|
---type (string|fun(win:window))[]
|
||||||
|
exclude = {
|
||||||
|
"notify",
|
||||||
|
"cmp_menu",
|
||||||
|
"noice",
|
||||||
|
"flash_prompt",
|
||||||
|
function(win)
|
||||||
|
-- exclude non-focusable windows
|
||||||
|
return not vim.api.nvim_win_get_config(win).focusable
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- Optional trigger character that needs to be typed before
|
||||||
|
-- a jump label can be used. It's NOT recommended to set this,
|
||||||
|
-- unless you know what you're doing
|
||||||
|
trigger = "",
|
||||||
|
-- max pattern length. If the pattern length is equal to this
|
||||||
|
-- labels will no longer be skipped. When it exceeds this length
|
||||||
|
-- it will either end in a jump or terminate the search
|
||||||
|
max_length = nil, ---type number?
|
||||||
|
},
|
||||||
|
jump = {
|
||||||
|
-- save location in the jumplist
|
||||||
|
jumplist = true,
|
||||||
|
-- jump position
|
||||||
|
pos = "start", ---type "start" | "end" | "range"
|
||||||
|
-- add pattern to search history
|
||||||
|
history = false,
|
||||||
|
-- add pattern to search register
|
||||||
|
register = false,
|
||||||
|
-- clear highlight after jump
|
||||||
|
nohlsearch = false,
|
||||||
|
-- automatically jump when there is only one match
|
||||||
|
autojump = false,
|
||||||
|
-- You can force inclusive/exclusive jumps by setting the
|
||||||
|
-- `inclusive` option. By default it will be automatically
|
||||||
|
-- set based on the mode.
|
||||||
|
inclusive = nil, ---type boolean?
|
||||||
|
-- jump position offset. Not used for range jumps.
|
||||||
|
-- 0: default
|
||||||
|
-- 1: when pos == "end" and pos < current position
|
||||||
|
offset = nil, ---type number
|
||||||
|
},
|
||||||
|
label = {
|
||||||
|
-- allow uppercase labels
|
||||||
|
uppercase = true,
|
||||||
|
-- add any labels with the correct case here, that you want to exclude
|
||||||
|
exclude = "",
|
||||||
|
-- add a label for the first match in the current window.
|
||||||
|
-- you can always jump to the first match with `<CR>`
|
||||||
|
current = true,
|
||||||
|
-- show the label after the match
|
||||||
|
after = true, ---type boolean|number[]
|
||||||
|
-- show the label before the match
|
||||||
|
before = false, ---type boolean|number[]
|
||||||
|
-- position of the label extmark
|
||||||
|
style = "overlay", ---type "eol" | "overlay" | "right_align" | "inline"
|
||||||
|
-- flash tries to re-use labels that were already assigned to a position,
|
||||||
|
-- when typing more characters. By default only lower-case labels are re-used.
|
||||||
|
reuse = "lowercase", ---type "lowercase" | "all"
|
||||||
|
-- for the current window, label targets closer to the cursor first
|
||||||
|
distance = true,
|
||||||
|
-- minimum pattern length to show labels
|
||||||
|
-- Ignored for custom labelers.
|
||||||
|
min_pattern_length = 0,
|
||||||
|
-- Enable this to use rainbow colors to highlight labels
|
||||||
|
-- Can be useful for visualizing Treesitter ranges.
|
||||||
|
rainbow = {
|
||||||
|
enabled = false,
|
||||||
|
-- number between 1 and 9
|
||||||
|
shade = 5,
|
||||||
|
},
|
||||||
|
-- With `format`, you can change how the label is rendered.
|
||||||
|
-- Should return a list of `[text, highlight]` tuples.
|
||||||
|
---class Flash.Format
|
||||||
|
---field state Flash.State
|
||||||
|
---field match Flash.Match
|
||||||
|
---field hl_group string
|
||||||
|
---field after boolean
|
||||||
|
---type fun(opts:Flash.Format): string[][]
|
||||||
|
format = function(opts)
|
||||||
|
return { { opts.match.label, opts.hl_group } }
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
highlight = {
|
||||||
|
-- show a backdrop with hl FlashBackdrop
|
||||||
|
backdrop = true,
|
||||||
|
-- Highlight the search matches
|
||||||
|
matches = true,
|
||||||
|
-- extmark priority
|
||||||
|
priority = 5000,
|
||||||
|
groups = {
|
||||||
|
match = "FlashMatch",
|
||||||
|
current = "FlashCurrent",
|
||||||
|
backdrop = "FlashBackdrop",
|
||||||
|
label = "FlashLabel",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- action to perform when picking a label.
|
||||||
|
-- defaults to the jumping logic depending on the mode.
|
||||||
|
---type fun(match:Flash.Match, state:Flash.State)|nil
|
||||||
|
action = nil,
|
||||||
|
-- initial pattern to use when opening flash
|
||||||
|
pattern = "",
|
||||||
|
-- When `true`, flash will try to continue the last search
|
||||||
|
continue = false,
|
||||||
|
-- Set config to a function to dynamically change the config
|
||||||
|
config = nil, ---type fun(opts:Flash.Config)|nil
|
||||||
|
-- You can override the default options for a specific mode.
|
||||||
|
-- Use it with `require("flash").jump({mode = "forward"})`
|
||||||
|
---type table<string, Flash.Config>
|
||||||
|
modes = {
|
||||||
|
-- options used when flash is activated through
|
||||||
|
-- a regular search with `/` or `?`
|
||||||
|
search = {
|
||||||
|
-- when `true`, flash will be activated during regular search by default.
|
||||||
|
-- You can always toggle when searching with `require("flash").toggle()`
|
||||||
|
enabled = true,
|
||||||
|
highlight = { backdrop = false },
|
||||||
|
jump = { history = true, register = true, nohlsearch = true },
|
||||||
|
search = {
|
||||||
|
-- `forward` will be automatically set to the search direction
|
||||||
|
-- `mode` is always set to `search`
|
||||||
|
-- `incremental` is set to `true` when `incsearch` is enabled
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- options used when flash is activated through
|
||||||
|
-- `f`, `F`, `t`, `T`, `;` and `,` motions
|
||||||
|
char = {
|
||||||
|
enabled = true,
|
||||||
|
-- dynamic configuration for ftFT motions
|
||||||
|
config = function(opts)
|
||||||
|
-- autohide flash when in operator-pending mode
|
||||||
|
opts.autohide = vim.fn.mode(true):find("no") and vim.v.operator == "y"
|
||||||
|
|
||||||
|
-- disable jump labels when enabled and when using a count
|
||||||
|
opts.jump_labels = opts.jump_labels and vim.v.count == 0
|
||||||
|
|
||||||
|
-- Show jump labels only in operator-pending mode
|
||||||
|
-- opts.jump_labels = vim.v.count == 0 and vim.fn.mode(true):find("o")
|
||||||
|
end,
|
||||||
|
-- hide after jump when not using jump labels
|
||||||
|
autohide = false,
|
||||||
|
-- show jump labels
|
||||||
|
jump_labels = false,
|
||||||
|
-- set to `false` to use the current line only
|
||||||
|
multi_line = true,
|
||||||
|
-- When using jump labels, don't use these keys
|
||||||
|
-- This allows using those keys directly after the motion
|
||||||
|
label = { exclude = "hjkliardc" },
|
||||||
|
-- by default all keymaps are enabled, but you can disable some of them,
|
||||||
|
-- by removing them from the list.
|
||||||
|
-- If you rather use another key, you can map them
|
||||||
|
-- to something else, e.g., { [";"] = "L", [","] = H }
|
||||||
|
keys = { "f", "F", "t", "T" },
|
||||||
|
---alias Flash.CharActions table<string, "next" | "prev" | "right" | "left">
|
||||||
|
-- The direction for `prev` and `next` is determined by the motion.
|
||||||
|
-- `left` and `right` are always left and right.
|
||||||
|
char_actions = function(motion)
|
||||||
|
return {
|
||||||
|
[";"] = "next", -- set to `right` to always go right
|
||||||
|
[","] = "prev", -- set to `left` to always go left
|
||||||
|
-- clever-f style
|
||||||
|
[motion:lower()] = "next",
|
||||||
|
[motion:upper()] = "prev",
|
||||||
|
-- jump2d style: same case goes next, opposite case goes prev
|
||||||
|
-- [motion] = "next",
|
||||||
|
-- [motion:match("%l") and motion:upper() or motion:lower()] = "prev",
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
search = { wrap = false },
|
||||||
|
highlight = { backdrop = true },
|
||||||
|
jump = { register = false },
|
||||||
|
},
|
||||||
|
-- options used for treesitter selections
|
||||||
|
-- `require("flash").treesitter()`
|
||||||
|
treesitter = {
|
||||||
|
labels = "abcdefghijklmnopqrstuvwxyz",
|
||||||
|
jump = { pos = "range" },
|
||||||
|
search = { incremental = false },
|
||||||
|
label = { before = true, after = true, style = "inline" },
|
||||||
|
highlight = {
|
||||||
|
backdrop = false,
|
||||||
|
matches = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
treesitter_search = {
|
||||||
|
jump = { pos = "range" },
|
||||||
|
search = { multi_window = true, wrap = true, incremental = false },
|
||||||
|
remote_op = { restore = true },
|
||||||
|
label = { before = true, after = true, style = "inline" },
|
||||||
|
},
|
||||||
|
-- options used for remote flash
|
||||||
|
remote = {
|
||||||
|
remote_op = { restore = true, motion = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- options for the floating window that shows the prompt,
|
||||||
|
-- for regular jumps
|
||||||
|
prompt = {
|
||||||
|
enabled = true,
|
||||||
|
prefix = { { "🔎", "FlashPromptIcon" } },
|
||||||
|
win_config = {
|
||||||
|
relative = "editor",
|
||||||
|
width = 1, -- when <=1 it's a percentage of the editor width
|
||||||
|
height = 1,
|
||||||
|
row = -1, -- when negative it's an offset from the bottom
|
||||||
|
col = 0, -- when negative it's an offset from the right
|
||||||
|
zindex = 1000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- options for remote operator pending mode
|
||||||
|
remote_op = {
|
||||||
|
-- restore window views and cursor position
|
||||||
|
-- after doing a remote operation
|
||||||
|
restore = false,
|
||||||
|
-- For `jump.pos = "range"`, this setting is ignored.
|
||||||
|
-- `true`: always enter a new motion when doing a remote operation
|
||||||
|
-- `false`: use the window's cursor position and jump target
|
||||||
|
-- `nil`: act as `true` for remote windows, `false` for the current window
|
||||||
|
motion = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
return {
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
event = "BufRead",
|
||||||
|
config = function()
|
||||||
|
require("gitsigns").setup({
|
||||||
|
signs = {
|
||||||
|
add = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
|
||||||
|
change = {
|
||||||
|
hl = "GitSignsChange",
|
||||||
|
text = "│",
|
||||||
|
numhl = "GitSignsChangeNr",
|
||||||
|
linehl = "GitSignsChangeLn",
|
||||||
|
},
|
||||||
|
delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||||
|
topdelete = {
|
||||||
|
hl = "GitSignsDelete",
|
||||||
|
text = "‾",
|
||||||
|
numhl = "GitSignsDeleteNr",
|
||||||
|
linehl = "GitSignsDeleteLn",
|
||||||
|
},
|
||||||
|
changedelete = {
|
||||||
|
hl = "GitSignsChange",
|
||||||
|
text = "~",
|
||||||
|
numhl = "GitSignsChangeNr",
|
||||||
|
linehl = "GitSignsChangeLn",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||||
|
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||||
|
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||||
|
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||||
|
watch_gitdir = {
|
||||||
|
interval = 1000,
|
||||||
|
follow_files = true,
|
||||||
|
},
|
||||||
|
attach_to_untracked = true,
|
||||||
|
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||||
|
current_line_blame_opts = {
|
||||||
|
virt_text = true,
|
||||||
|
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
|
||||||
|
delay = 1000,
|
||||||
|
ignore_whitespace = false,
|
||||||
|
},
|
||||||
|
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
|
||||||
|
sign_priority = 6,
|
||||||
|
update_debounce = 100,
|
||||||
|
status_formatter = nil, -- Use default
|
||||||
|
max_file_length = 40000,
|
||||||
|
preview_config = {
|
||||||
|
-- Options passed to nvim_open_win
|
||||||
|
border = "single",
|
||||||
|
style = "minimal",
|
||||||
|
relative = "cursor",
|
||||||
|
row = 0,
|
||||||
|
col = 1,
|
||||||
|
},
|
||||||
|
yadm = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
return {
|
||||||
|
"lukas-reineke/headlines.nvim",
|
||||||
|
ft = { "norg", "markdown", "orgmode" },
|
||||||
|
config = function()
|
||||||
|
require("headlines").setup({
|
||||||
|
markdown = {
|
||||||
|
headline_highlights = {
|
||||||
|
"Headline1",
|
||||||
|
"Headline2",
|
||||||
|
"Headline3",
|
||||||
|
"Headline4",
|
||||||
|
"Headline5",
|
||||||
|
"Headline6",
|
||||||
|
},
|
||||||
|
codeblock_highlight = "CodeBlock",
|
||||||
|
dash_highlight = "Dash",
|
||||||
|
quote_highlight = "Quote",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
return {
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
config = function()
|
||||||
|
vim.opt.list = true
|
||||||
|
vim.opt.listchars:append("space:⋅")
|
||||||
|
vim.opt.listchars:append("eol:↴")
|
||||||
|
|
||||||
|
require("indent_blankline").setup({
|
||||||
|
char = "▏",
|
||||||
|
show_end_of_line = true,
|
||||||
|
space_char_blankline = " ",
|
||||||
|
show_current_context = true,
|
||||||
|
show_current_context_start = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
return {
|
||||||
|
"kdheepak/lazygit.nvim",
|
||||||
|
keys = {
|
||||||
|
{ "<Leader>g", "<cmd>LazyGit<CR>", desc = "lazygit" },
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
return {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
config = function()
|
||||||
|
local nvim_lsp = require("lspconfig")
|
||||||
|
|
||||||
|
-- Add additional capabilities supported by nvim-cmp
|
||||||
|
-- nvim hasn't added foldingRange to default capabilities, users must add it manually
|
||||||
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.foldingRange = {
|
||||||
|
dynamicRegistration = false,
|
||||||
|
lineFoldingOnly = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
--Change diagnostic symbols in the sign column (gutter)
|
||||||
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
|
end
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false,
|
||||||
|
signs = true,
|
||||||
|
underline = true,
|
||||||
|
update_in_insert = true,
|
||||||
|
severity_sort = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
local on_attach = function(bufnr)
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = function()
|
||||||
|
local opts = {
|
||||||
|
focusable = false,
|
||||||
|
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||||
|
border = "rounded",
|
||||||
|
source = "always",
|
||||||
|
prefix = " ",
|
||||||
|
scope = "line",
|
||||||
|
}
|
||||||
|
vim.diagnostic.show()
|
||||||
|
vim.diagnostic.open_float(nil, opts)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
---------------------
|
||||||
|
-- setup languages --
|
||||||
|
---------------------
|
||||||
|
-- nix
|
||||||
|
nvim_lsp.nixd.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
|
-- GoLang
|
||||||
|
nvim_lsp["gopls"].setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
gopls = {
|
||||||
|
experimentalPostfixCompletions = true,
|
||||||
|
analyses = {
|
||||||
|
unusedparams = true,
|
||||||
|
shadow = true,
|
||||||
|
},
|
||||||
|
staticcheck = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
init_options = {
|
||||||
|
usePlaceholders = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
--Rust
|
||||||
|
-- require("rust-tools").setup({
|
||||||
|
-- server = {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
-- on_attach = on_attach(),
|
||||||
|
-- },
|
||||||
|
-- }) -- C
|
||||||
|
nvim_lsp.clangd.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
|
--Python
|
||||||
|
nvim_lsp.pyright.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
autoSearchPaths = true,
|
||||||
|
diagnosticMode = "workspace",
|
||||||
|
useLibraryCodeForTypes = true,
|
||||||
|
typeCheckingMode = "off",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
--sumneko_lua
|
||||||
|
nvim_lsp.lua_ls.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = "LuaJIT",
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
checkThirdParty = false,
|
||||||
|
},
|
||||||
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
nvim_lsp.rust_analyzer.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
|
nvim_lsp.html.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
cmd = { "vscode-html-language-server", "--stdio" },
|
||||||
|
})
|
||||||
|
|
||||||
|
nvim_lsp.cssls.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
cmd = { "vscode-css-language-server", "--stdio" },
|
||||||
|
})
|
||||||
|
|
||||||
|
nvim_lsp.zk.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
cmd = { "zk", "lsp" },
|
||||||
|
})
|
||||||
|
|
||||||
|
nvim_lsp.tsserver.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
cmd = { "typescript-language-server", "--stdio" },
|
||||||
|
})
|
||||||
|
|
||||||
|
nvim_lsp.bashls.setup({
|
||||||
|
on_attach = on_attach(),
|
||||||
|
capabilities = capabilities,
|
||||||
|
cmd = { "bash-language-server", "start" },
|
||||||
|
})
|
||||||
|
|
||||||
|
--nvim_lsp.rnix.setup({
|
||||||
|
-- on_attach = on_attach(),
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
--})
|
||||||
|
--nvim_lsp.nil_ls.setup({
|
||||||
|
-- on_attach = on_attach(),
|
||||||
|
-- settings = {
|
||||||
|
-- ["nil"] = {
|
||||||
|
-- nix = {
|
||||||
|
-- flake = {
|
||||||
|
-- autoArchive = true,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
--})
|
||||||
|
nvim_lsp.hls.setup({})
|
||||||
|
|
||||||
|
-- ebuild Syntastic(install dev-util/pkgcheck)
|
||||||
|
vim.g.syntastic_ebuild_checkers = "pkgcheck"
|
||||||
|
|
||||||
|
--[[ -- Global mappings.
|
||||||
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
|
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float)
|
||||||
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
||||||
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||||
|
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist)
|
||||||
|
|
||||||
|
-- Use LspAttach autocommand to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||||
|
callback = function(ev)
|
||||||
|
-- Manual, triggered completion is provided by Nvim's builtin omnifunc. For autocompletion, a general purpose autocompletion plugin(.i.e nvim-cmp) is required
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||||
|
|
||||||
|
-- Buffer local mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local opts = { buffer = ev.buf }
|
||||||
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||||
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||||
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
|
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||||
|
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||||
|
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||||
|
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
|
vim.keymap.set("n", "<space>wl", function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
|
||||||
|
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
|
||||||
|
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
||||||
|
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||||
|
vim.keymap.set("n", "<space>f", function()
|
||||||
|
vim.lsp.buf.format({ async = true })
|
||||||
|
end, opts)
|
||||||
|
end,
|
||||||
|
}) ]]
|
||||||
|
|
||||||
|
-- show diagnostics when InsertLeave
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "go", "rust", "nix", "c++" },
|
||||||
|
callback = function(args)
|
||||||
|
vim.api.nvim_create_autocmd("DiagnosticChanged", {
|
||||||
|
buffer = args.buf,
|
||||||
|
callback = function()
|
||||||
|
vim.diagnostic.hide()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd({ "InsertLeave", "BufWritePost" }, {
|
||||||
|
buffer = args.buf,
|
||||||
|
callback = function()
|
||||||
|
vim.diagnostic.show()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
-- 为特定语言开启 inlay_hint 功能
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "rust" },
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.inlay_hint(0, true)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
return {
|
||||||
|
"glepnir/lspsaga.nvim",
|
||||||
|
event = "BufRead",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local colors, kind
|
||||||
|
if os.getenv("GTK_THEME") == "Catppuccin-Frappe-Pink" or os.getenv("GTK_THEME") == "Catppuccin-Latte-Green" then
|
||||||
|
colors = require("catppuccin.groups.integrations.lsp_saga").custom_colors()
|
||||||
|
kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind()
|
||||||
|
else
|
||||||
|
colors = { normal_bg = "#3b4252" }
|
||||||
|
end
|
||||||
|
require("lspsaga").setup({
|
||||||
|
ui = {
|
||||||
|
colors = colors,
|
||||||
|
kind = kind,
|
||||||
|
border = "single",
|
||||||
|
},
|
||||||
|
outline = {
|
||||||
|
win_width = 25,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
--Switch theme again after lspsaga loaded from
|
||||||
|
if os.getenv("GTK_THEME") == "Nordic" then
|
||||||
|
vim.cmd([[ colorscheme nord ]])
|
||||||
|
elseif os.getenv("GTK_THEME") == "Catppuccin-Frappe-Pink" then
|
||||||
|
vim.cmd([[colorscheme catppuccin-frappe ]])
|
||||||
|
else
|
||||||
|
vim.cmd([[colorscheme catppuccin-latte ]])
|
||||||
|
end
|
||||||
|
|
||||||
|
local keymap = vim.keymap.set
|
||||||
|
-- Lsp finder find the symbol definition implement reference
|
||||||
|
-- if there is no implement it will hide
|
||||||
|
-- when you use action in finder like open vsplit then you can
|
||||||
|
-- use <C-t> to jump back
|
||||||
|
keymap("n", "gh", "<cmd>Lspsaga lsp_finder<CR>")
|
||||||
|
|
||||||
|
-- Code action
|
||||||
|
keymap({ "n", "v" }, "<leader>ca", "<cmd>Lspsaga code_action<CR>")
|
||||||
|
|
||||||
|
-- Rename
|
||||||
|
keymap("n", "gr", "<cmd>Lspsaga rename<CR>")
|
||||||
|
|
||||||
|
-- Rename word in whole project
|
||||||
|
keymap("n", "gr", "<cmd>Lspsaga rename ++project<CR>")
|
||||||
|
|
||||||
|
-- Peek Definition
|
||||||
|
-- you can edit the definition file in this float window
|
||||||
|
-- also support open/vsplit/etc operation check definition_action_keys
|
||||||
|
-- support tagstack C-t jump back
|
||||||
|
keymap("n", "gD", "<cmd>Lspsaga peek_definition<CR>")
|
||||||
|
|
||||||
|
-- Go to Definition
|
||||||
|
keymap("n", "gd", "<cmd>Lspsaga goto_definition<CR>")
|
||||||
|
|
||||||
|
-- Show line diagnostics you can pass argument ++unfocus to make
|
||||||
|
-- show_line_diagnostics float window unfocus
|
||||||
|
keymap("n", "<leader>sl", "<cmd>Lspsaga show_line_diagnostics<CR>")
|
||||||
|
|
||||||
|
-- Show cursor diagnostic
|
||||||
|
-- also like show_line_diagnostics support pass ++unfocus
|
||||||
|
keymap("n", "<leader>sc", "<cmd>Lspsaga show_cursor_diagnostics<CR>")
|
||||||
|
|
||||||
|
-- Show buffer diagnostic
|
||||||
|
keymap("n", "<leader>sb", "<cmd>Lspsaga show_buf_diagnostics<CR>")
|
||||||
|
|
||||||
|
-- Diagnostic jump can use `<c-o>` to jump back
|
||||||
|
keymap("n", "[e", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
|
||||||
|
keymap("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>")
|
||||||
|
|
||||||
|
-- Diagnostic jump with filter like Only jump to error
|
||||||
|
keymap("n", "[E", function()
|
||||||
|
require("lspsaga.diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR })
|
||||||
|
end)
|
||||||
|
keymap("n", "]E", function()
|
||||||
|
require("lspsaga.diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR })
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Toggle Outline
|
||||||
|
keymap("n", "<leader>o", "<cmd>Lspsaga outline<CR>")
|
||||||
|
|
||||||
|
-- Hover Doc
|
||||||
|
-- if there has no hover will have a notify no information available
|
||||||
|
-- to disable it just Lspsaga hover_doc ++quiet
|
||||||
|
-- press twice it will jump into hover window
|
||||||
|
--[[ keymap("n", "K", "<cmd>Lspsaga hover_doc<CR>") ]]
|
||||||
|
-- if you want keep hover window in right top you can use ++keep arg
|
||||||
|
-- notice if you use hover with ++keep you press this keymap it will
|
||||||
|
-- close the hover window .if you want jump to hover window must use
|
||||||
|
-- wincmd command <C-w>w
|
||||||
|
keymap("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>")
|
||||||
|
|
||||||
|
-- Callhierarchy
|
||||||
|
keymap("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>")
|
||||||
|
keymap("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>")
|
||||||
|
|
||||||
|
-- Float terminal
|
||||||
|
keymap({ "n", "t" }, "<A-d>", "<cmd>Lspsaga term_toggle<CR>")
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,670 @@
|
|||||||
|
return {
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
event = "BufWinEnter",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
config = function()
|
||||||
|
if os.getenv("GTK_THEME") == "Nordic" then
|
||||||
|
local lualine = require("lualine")
|
||||||
|
-- Color table for highlights
|
||||||
|
-- stylua: ignore
|
||||||
|
local colors = {
|
||||||
|
bg = '#3B4252', --nord:#3B4252 catppuccin:#302D41
|
||||||
|
fg = '#D6DCE7',
|
||||||
|
yellow = '#ECBE7B',
|
||||||
|
cyan = '#008080',
|
||||||
|
darkblue = '#081633',
|
||||||
|
green = '#98be65',
|
||||||
|
orange = '#FF8800',
|
||||||
|
violet = '#a9a1e1',
|
||||||
|
magenta = '#c678dd',
|
||||||
|
blue = '#51afef',
|
||||||
|
red = '#ec5f67',
|
||||||
|
custom = '#B38DAC',
|
||||||
|
}
|
||||||
|
|
||||||
|
local conditions = {
|
||||||
|
buffer_not_empty = function()
|
||||||
|
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||||
|
end,
|
||||||
|
hide_in_width = function()
|
||||||
|
return vim.fn.winwidth(0) > 80
|
||||||
|
end,
|
||||||
|
check_git_workspace = function()
|
||||||
|
local filepath = vim.fn.expand("%:p:h")
|
||||||
|
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||||
|
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Config
|
||||||
|
local config = {
|
||||||
|
options = {
|
||||||
|
-- Disable sections and component separators
|
||||||
|
component_separators = "",
|
||||||
|
section_separators = "",
|
||||||
|
globalstatus = true,
|
||||||
|
theme = {
|
||||||
|
-- We are going to use lualine_c an lualine_x as left and
|
||||||
|
-- right section. Both are highlighted by c theme . So we
|
||||||
|
-- are just setting default looks o statusline
|
||||||
|
normal = { c = { fg = colors.fg, bg = colors.bg } },
|
||||||
|
inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
-- these are to remove the defaults
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
-- These will be filled later
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
-- these are to remove the defaults
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Inserts a component in lualine_c at left section
|
||||||
|
local function ins_left(component)
|
||||||
|
table.insert(config.sections.lualine_c, component)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Inserts a component in lualine_x ot right section
|
||||||
|
local function ins_right(component)
|
||||||
|
table.insert(config.sections.lualine_x, component)
|
||||||
|
end
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
function()
|
||||||
|
return "▊"
|
||||||
|
end,
|
||||||
|
color = { fg = colors.blue }, -- Sets highlighting of component
|
||||||
|
padding = { left = 0, right = 1 }, -- We don't need space before this
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
-- mode component
|
||||||
|
function()
|
||||||
|
return ""
|
||||||
|
end,
|
||||||
|
color = function()
|
||||||
|
-- auto change color according to neovims mode
|
||||||
|
local mode_color = {
|
||||||
|
n = colors.red,
|
||||||
|
i = colors.green,
|
||||||
|
v = colors.blue,
|
||||||
|
[""] = colors.blue,
|
||||||
|
V = colors.blue,
|
||||||
|
c = colors.magenta,
|
||||||
|
no = colors.red,
|
||||||
|
s = colors.orange,
|
||||||
|
S = colors.orange,
|
||||||
|
[""] = colors.orange,
|
||||||
|
ic = colors.yellow,
|
||||||
|
R = colors.violet,
|
||||||
|
Rv = colors.violet,
|
||||||
|
cv = colors.red,
|
||||||
|
ce = colors.red,
|
||||||
|
r = colors.cyan,
|
||||||
|
rm = colors.cyan,
|
||||||
|
["r?"] = colors.cyan,
|
||||||
|
["!"] = colors.red,
|
||||||
|
t = colors.red,
|
||||||
|
}
|
||||||
|
return { fg = mode_color[vim.fn.mode()] }
|
||||||
|
end,
|
||||||
|
padding = { right = 1 },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
-- filesize component
|
||||||
|
"filesize",
|
||||||
|
cond = conditions.buffer_not_empty,
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
"filename",
|
||||||
|
cond = conditions.buffer_not_empty,
|
||||||
|
color = { fg = colors.magenta, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({ "location" })
|
||||||
|
|
||||||
|
ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } })
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
"diagnostics",
|
||||||
|
sources = { "nvim_diagnostic" },
|
||||||
|
symbols = { error = " ", warn = " ", info = " " },
|
||||||
|
diagnostics_color = {
|
||||||
|
color_error = { fg = colors.red },
|
||||||
|
color_warn = { fg = colors.yellow },
|
||||||
|
color_info = { fg = colors.cyan },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Insert mid section. You can make any number of sections in neovim :)
|
||||||
|
-- for lualine it's any number greater then 2
|
||||||
|
ins_left({
|
||||||
|
function()
|
||||||
|
return "%="
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
-- 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 = "#D8DEE9", gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Add components to right sections
|
||||||
|
ins_right({
|
||||||
|
"o:encoding", -- option component same as &encoding in viml
|
||||||
|
fmt = string.upper, -- I'm not sure why it's upper case either ;)
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
color = { fg = colors.custom, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
"fileformat",
|
||||||
|
fmt = string.upper,
|
||||||
|
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
||||||
|
color = { fg = colors.custom, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
"branch",
|
||||||
|
icon = "",
|
||||||
|
color = { fg = colors.violet, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
"diff",
|
||||||
|
-- Is it me or the symbol for modified us really weird
|
||||||
|
symbols = { added = " ", modified = " ", removed = " " },
|
||||||
|
diff_color = {
|
||||||
|
added = { fg = colors.green },
|
||||||
|
modified = { fg = colors.orange },
|
||||||
|
removed = { fg = colors.red },
|
||||||
|
},
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
function()
|
||||||
|
return "▊"
|
||||||
|
end,
|
||||||
|
color = { fg = colors.blue },
|
||||||
|
padding = { left = 1 },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Now don't forget to initialize lualine
|
||||||
|
lualine.setup(config)
|
||||||
|
elseif os.getenv("GTK_THEME") == "Catppuccin-Frappe-Pink" then
|
||||||
|
local lualine = require("lualine")
|
||||||
|
|
||||||
|
-- Color table for highlights
|
||||||
|
-- stylua: ignore
|
||||||
|
local colors = {
|
||||||
|
bg = '#302D41', --nord:#3B4252 catppuccin:#302D41
|
||||||
|
fg = '#bbc2cf',
|
||||||
|
yellow = '#ECBE7B',
|
||||||
|
cyan = '#008080',
|
||||||
|
darkblue = '#081633',
|
||||||
|
green = '#98be65',
|
||||||
|
orange = '#FF8800',
|
||||||
|
violet = '#a9a1e1',
|
||||||
|
magenta = '#c678dd',
|
||||||
|
blue = '#51afef',
|
||||||
|
red = '#ec5f67',
|
||||||
|
custom = '#b0c4de',
|
||||||
|
}
|
||||||
|
|
||||||
|
local conditions = {
|
||||||
|
buffer_not_empty = function()
|
||||||
|
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||||
|
end,
|
||||||
|
hide_in_width = function()
|
||||||
|
return vim.fn.winwidth(0) > 80
|
||||||
|
end,
|
||||||
|
check_git_workspace = function()
|
||||||
|
local filepath = vim.fn.expand("%:p:h")
|
||||||
|
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||||
|
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Config
|
||||||
|
local config = {
|
||||||
|
options = {
|
||||||
|
-- Disable sections and component separators
|
||||||
|
component_separators = "",
|
||||||
|
section_separators = "",
|
||||||
|
globalstatus = true,
|
||||||
|
theme = {
|
||||||
|
-- We are going to use lualine_c an lualine_x as left and
|
||||||
|
-- right section. Both are highlighted by c theme . So we
|
||||||
|
-- are just setting default looks o statusline
|
||||||
|
normal = { c = { fg = colors.fg, bg = colors.bg } },
|
||||||
|
inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
-- these are to remove the defaults
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
-- These will be filled later
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
-- these are to remove the defaults
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Inserts a component in lualine_c at left section
|
||||||
|
local function ins_left(component)
|
||||||
|
table.insert(config.sections.lualine_c, component)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Inserts a component in lualine_x ot right section
|
||||||
|
local function ins_right(component)
|
||||||
|
table.insert(config.sections.lualine_x, component)
|
||||||
|
end
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
function()
|
||||||
|
return "▊"
|
||||||
|
end,
|
||||||
|
color = { fg = colors.blue }, -- Sets highlighting of component
|
||||||
|
padding = { left = 0, right = 1 }, -- We don't need space before this
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
-- mode component
|
||||||
|
function()
|
||||||
|
return ""
|
||||||
|
end,
|
||||||
|
color = function()
|
||||||
|
-- auto change color according to neovims mode
|
||||||
|
local mode_color = {
|
||||||
|
n = colors.red,
|
||||||
|
i = colors.green,
|
||||||
|
v = colors.blue,
|
||||||
|
[""] = colors.blue,
|
||||||
|
V = colors.blue,
|
||||||
|
c = colors.magenta,
|
||||||
|
no = colors.red,
|
||||||
|
s = colors.orange,
|
||||||
|
S = colors.orange,
|
||||||
|
[""] = colors.orange,
|
||||||
|
ic = colors.yellow,
|
||||||
|
R = colors.violet,
|
||||||
|
Rv = colors.violet,
|
||||||
|
cv = colors.red,
|
||||||
|
ce = colors.red,
|
||||||
|
r = colors.cyan,
|
||||||
|
rm = colors.cyan,
|
||||||
|
["r?"] = colors.cyan,
|
||||||
|
["!"] = colors.red,
|
||||||
|
t = colors.red,
|
||||||
|
}
|
||||||
|
return { fg = mode_color[vim.fn.mode()] }
|
||||||
|
end,
|
||||||
|
padding = { right = 1 },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
-- filesize component
|
||||||
|
"filesize",
|
||||||
|
cond = conditions.buffer_not_empty,
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
"filename",
|
||||||
|
cond = conditions.buffer_not_empty,
|
||||||
|
color = { fg = colors.magenta, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({ "location" })
|
||||||
|
|
||||||
|
ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } })
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
"diagnostics",
|
||||||
|
sources = { "nvim_diagnostic" },
|
||||||
|
symbols = { error = " ", warn = " ", info = " " },
|
||||||
|
diagnostics_color = {
|
||||||
|
color_error = { fg = colors.red },
|
||||||
|
color_warn = { fg = colors.yellow },
|
||||||
|
color_info = { fg = colors.cyan },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Insert mid section. You can make any number of sections in neovim :)
|
||||||
|
-- for lualine it's any number greater then 2
|
||||||
|
ins_left({
|
||||||
|
function()
|
||||||
|
return "%="
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
-- 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 = "#ffffff", gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Add components to right sections
|
||||||
|
ins_right({
|
||||||
|
"o:encoding", -- option component same as &encoding in viml
|
||||||
|
fmt = string.upper, -- I'm not sure why it's upper case either ;)
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
color = { fg = colors.custom, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
"fileformat",
|
||||||
|
fmt = string.upper,
|
||||||
|
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
||||||
|
color = { fg = colors.custom, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
"branch",
|
||||||
|
icon = "",
|
||||||
|
color = { fg = colors.violet, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
"diff",
|
||||||
|
-- Is it me or the symbol for modified us really weird
|
||||||
|
symbols = { added = " ", modified = " ", removed = " " },
|
||||||
|
diff_color = {
|
||||||
|
added = { fg = colors.green },
|
||||||
|
modified = { fg = colors.orange },
|
||||||
|
removed = { fg = colors.red },
|
||||||
|
},
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
function()
|
||||||
|
return "▊"
|
||||||
|
end,
|
||||||
|
color = { fg = colors.blue },
|
||||||
|
padding = { left = 1 },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Now don't forget to initialize lualine
|
||||||
|
lualine.setup(config)
|
||||||
|
else
|
||||||
|
local lualine = require("lualine")
|
||||||
|
|
||||||
|
-- Color table for highlights
|
||||||
|
-- stylua: ignore
|
||||||
|
local colors = {
|
||||||
|
bg = '#FAF4FC', --nord:#3B4252 catppuccin:#302D41
|
||||||
|
fg = '#1E1E2E',
|
||||||
|
yellow = '#ECBE7B',
|
||||||
|
cyan = '#008080',
|
||||||
|
darkblue = '#081633',
|
||||||
|
green = '#98be65',
|
||||||
|
orange = '#FF8800',
|
||||||
|
violet = '#a9a1e1',
|
||||||
|
magenta = '#c678dd',
|
||||||
|
blue = '#51afef',
|
||||||
|
red = '#ec5f67',
|
||||||
|
custom = '#FF99CC',
|
||||||
|
}
|
||||||
|
|
||||||
|
local conditions = {
|
||||||
|
buffer_not_empty = function()
|
||||||
|
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||||
|
end,
|
||||||
|
hide_in_width = function()
|
||||||
|
return vim.fn.winwidth(0) > 80
|
||||||
|
end,
|
||||||
|
check_git_workspace = function()
|
||||||
|
local filepath = vim.fn.expand("%:p:h")
|
||||||
|
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||||
|
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Config
|
||||||
|
local config = {
|
||||||
|
options = {
|
||||||
|
-- Disable sections and component separators
|
||||||
|
component_separators = "",
|
||||||
|
section_separators = "",
|
||||||
|
globalstatus = true,
|
||||||
|
theme = {
|
||||||
|
-- We are going to use lualine_c an lualine_x as left and
|
||||||
|
-- right section. Both are highlighted by c theme . So we
|
||||||
|
-- are just setting default looks o statusline
|
||||||
|
normal = { c = { fg = colors.fg, bg = colors.bg } },
|
||||||
|
inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
-- these are to remove the defaults
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
-- These will be filled later
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
-- these are to remove the defaults
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Inserts a component in lualine_c at left section
|
||||||
|
local function ins_left(component)
|
||||||
|
table.insert(config.sections.lualine_c, component)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Inserts a component in lualine_x ot right section
|
||||||
|
local function ins_right(component)
|
||||||
|
table.insert(config.sections.lualine_x, component)
|
||||||
|
end
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
function()
|
||||||
|
return "▊"
|
||||||
|
end,
|
||||||
|
color = { fg = colors.blue }, -- Sets highlighting of component
|
||||||
|
padding = { left = 0, right = 1 }, -- We don't need space before this
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
-- mode component
|
||||||
|
function()
|
||||||
|
return ""
|
||||||
|
end,
|
||||||
|
color = function()
|
||||||
|
-- auto change color according to neovims mode
|
||||||
|
local mode_color = {
|
||||||
|
n = colors.red,
|
||||||
|
i = colors.green,
|
||||||
|
v = colors.blue,
|
||||||
|
[""] = colors.blue,
|
||||||
|
V = colors.blue,
|
||||||
|
c = colors.magenta,
|
||||||
|
no = colors.red,
|
||||||
|
s = colors.orange,
|
||||||
|
S = colors.orange,
|
||||||
|
[""] = colors.orange,
|
||||||
|
ic = colors.yellow,
|
||||||
|
R = colors.violet,
|
||||||
|
Rv = colors.violet,
|
||||||
|
cv = colors.red,
|
||||||
|
ce = colors.red,
|
||||||
|
r = colors.cyan,
|
||||||
|
rm = colors.cyan,
|
||||||
|
["r?"] = colors.cyan,
|
||||||
|
["!"] = colors.red,
|
||||||
|
t = colors.red,
|
||||||
|
}
|
||||||
|
return { fg = mode_color[vim.fn.mode()] }
|
||||||
|
end,
|
||||||
|
padding = { right = 1 },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
-- filesize component
|
||||||
|
"filesize",
|
||||||
|
cond = conditions.buffer_not_empty,
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
"filename",
|
||||||
|
cond = conditions.buffer_not_empty,
|
||||||
|
color = { fg = colors.magenta, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({ "location" })
|
||||||
|
|
||||||
|
ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } })
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
"diagnostics",
|
||||||
|
sources = { "nvim_diagnostic" },
|
||||||
|
symbols = { error = " ", warn = " ", info = " " },
|
||||||
|
diagnostics_color = {
|
||||||
|
color_error = { fg = colors.red },
|
||||||
|
color_warn = { fg = colors.yellow },
|
||||||
|
color_info = { fg = colors.cyan },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Insert mid section. You can make any number of sections in neovim :)
|
||||||
|
-- for lualine it's any number greater then 2
|
||||||
|
ins_left({
|
||||||
|
function()
|
||||||
|
return "%="
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_left({
|
||||||
|
-- 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 = "#474E6D", gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Add components to right sections
|
||||||
|
ins_right({
|
||||||
|
"o:encoding", -- option component same as &encoding in viml
|
||||||
|
fmt = string.upper, -- I'm not sure why it's upper case either ;)
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
color = { fg = colors.custom, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
"fileformat",
|
||||||
|
fmt = string.upper,
|
||||||
|
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
||||||
|
color = { fg = colors.custom, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
"branch",
|
||||||
|
icon = "",
|
||||||
|
color = { fg = colors.violet, gui = "bold" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
"diff",
|
||||||
|
-- Is it me or the symbol for modified us really weird
|
||||||
|
symbols = { added = " ", modified = " ", removed = " " },
|
||||||
|
diff_color = {
|
||||||
|
added = { fg = colors.green },
|
||||||
|
modified = { fg = colors.orange },
|
||||||
|
removed = { fg = colors.red },
|
||||||
|
},
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
})
|
||||||
|
|
||||||
|
ins_right({
|
||||||
|
function()
|
||||||
|
return "▊"
|
||||||
|
end,
|
||||||
|
color = { fg = colors.blue },
|
||||||
|
padding = { left = 1 },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Now don't forget to initialize lualine
|
||||||
|
lualine.setup(config)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
return {
|
||||||
|
"iamcco/markdown-preview.nvim",
|
||||||
|
keys = {
|
||||||
|
{ "mp", "<cmd>MarkdownPreview<CR>", desc = "MarkdownPreview" },
|
||||||
|
},
|
||||||
|
build = "cd app && npm install",
|
||||||
|
init = function()
|
||||||
|
vim.g.mkdp_filetypes = { "markdown" }
|
||||||
|
end,
|
||||||
|
ft = { "markdown" },
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
return {
|
||||||
|
"folke/noice.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
dependencies = {
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
"rcarriga/nvim-notify",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("noice").setup({
|
||||||
|
routes = {
|
||||||
|
{
|
||||||
|
view = "notify",
|
||||||
|
filter = { event = "msg_showmode" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
views = {
|
||||||
|
cmdline_popup = {
|
||||||
|
position = {
|
||||||
|
row = 5,
|
||||||
|
col = "50%",
|
||||||
|
},
|
||||||
|
size = {
|
||||||
|
width = 60,
|
||||||
|
height = "auto",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
popupmenu = {
|
||||||
|
relative = "editor",
|
||||||
|
position = {
|
||||||
|
row = 8,
|
||||||
|
col = "50%",
|
||||||
|
},
|
||||||
|
size = {
|
||||||
|
width = 60,
|
||||||
|
height = 10,
|
||||||
|
},
|
||||||
|
border = {
|
||||||
|
style = "rounded",
|
||||||
|
padding = { 0, 1 },
|
||||||
|
},
|
||||||
|
win_options = {
|
||||||
|
winhighlight = { Normal = "Normal", FloatBorder = "DiagnosticInfo" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
return {
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||||
|
require("null-ls").setup({
|
||||||
|
sources = {
|
||||||
|
-- you must download code formatter by yourself!
|
||||||
|
require("null-ls").builtins.formatting.stylua,
|
||||||
|
require("null-ls").builtins.formatting.black,
|
||||||
|
require("null-ls").builtins.formatting.prettier,
|
||||||
|
require("null-ls").builtins.formatting.gofmt,
|
||||||
|
require("null-ls").builtins.formatting.nixpkgs_fmt,
|
||||||
|
require("null-ls").builtins.formatting.beautysh,
|
||||||
|
require("null-ls").builtins.formatting.rustfmt,
|
||||||
|
require("null-ls").builtins.formatting.stylish_haskell,
|
||||||
|
},
|
||||||
|
-- you can reuse a shared lspconfig on_attach callback here
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
if client.supports_method("textDocument/formatting") then
|
||||||
|
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = augroup,
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.buf.format({ async = false })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
"leoluz/nvim-dap-go",
|
||||||
|
ft = { "go" },
|
||||||
|
config = function()
|
||||||
|
require("dap-go").setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
"kylechui/nvim-surround",
|
||||||
|
event = "BufReadPost",
|
||||||
|
config = function()
|
||||||
|
require("nvim-surround").setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
return {
|
||||||
|
"kyazdani42/nvim-tree.lua",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
keys = {
|
||||||
|
{ "tt", "<cmd>NvimTreeToggle<cr>", desc = "NvimTree" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
require("nvim-tree").setup({ -- BEGIN_DEFAULT_OPTS
|
||||||
|
sort_by = "case_sensitive",
|
||||||
|
renderer = {
|
||||||
|
group_empty = true,
|
||||||
|
},
|
||||||
|
filters = {
|
||||||
|
dotfiles = true,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
width = 25,
|
||||||
|
--[[ height = 30, ]]
|
||||||
|
side = "left",
|
||||||
|
--[[ float = {
|
||||||
|
enable = true,
|
||||||
|
open_win_config = {
|
||||||
|
relative = "editor",
|
||||||
|
--border = "rounded",
|
||||||
|
width = 65,
|
||||||
|
height = 25,
|
||||||
|
row = 6,
|
||||||
|
col = 45,
|
||||||
|
},
|
||||||
|
}, ]]
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
return {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
keys = {
|
||||||
|
{ "<Leader>e", "<cmd>Telescope<CR>", desc = "telescope" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local status_ok, telescope = pcall(require, "telescope")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
|
||||||
|
telescope.setup({
|
||||||
|
defaults = {
|
||||||
|
prompt_prefix = " ",
|
||||||
|
selection_caret = " ",
|
||||||
|
path_display = { "smart" },
|
||||||
|
color_devicons = true,
|
||||||
|
sorting_strategy = "ascending",
|
||||||
|
layout_config = {
|
||||||
|
prompt_position = "top",
|
||||||
|
horizontal = {
|
||||||
|
width_padding = 0.04,
|
||||||
|
height_padding = 0.1,
|
||||||
|
preview_width = 0.6,
|
||||||
|
},
|
||||||
|
vertical = {
|
||||||
|
width_padding = 0.05,
|
||||||
|
height_padding = 1,
|
||||||
|
preview_height = 0.5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-n>"] = actions.cycle_history_next,
|
||||||
|
["<C-p>"] = actions.cycle_history_prev,
|
||||||
|
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
|
||||||
|
["<C-c>"] = actions.close,
|
||||||
|
|
||||||
|
["<Down>"] = actions.move_selection_next,
|
||||||
|
["<Up>"] = actions.move_selection_previous,
|
||||||
|
|
||||||
|
["<CR>"] = actions.select_default,
|
||||||
|
["<C-x>"] = actions.select_horizontal,
|
||||||
|
["<C-v>"] = actions.select_vertical,
|
||||||
|
["<C-t>"] = actions.select_tab,
|
||||||
|
|
||||||
|
["<C-u>"] = actions.preview_scrolling_up,
|
||||||
|
["<C-d>"] = actions.preview_scrolling_down,
|
||||||
|
|
||||||
|
["<PageUp>"] = actions.results_scrolling_up,
|
||||||
|
["<PageDown>"] = actions.results_scrolling_down,
|
||||||
|
|
||||||
|
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
||||||
|
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
||||||
|
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||||
|
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||||
|
["<C-l>"] = actions.complete_tag,
|
||||||
|
["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
|
||||||
|
},
|
||||||
|
|
||||||
|
n = {
|
||||||
|
["<esc>"] = actions.close,
|
||||||
|
["<CR>"] = actions.select_default,
|
||||||
|
["<C-x>"] = actions.select_horizontal,
|
||||||
|
["<C-v>"] = actions.select_vertical,
|
||||||
|
["<C-t>"] = actions.select_tab,
|
||||||
|
|
||||||
|
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
||||||
|
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
||||||
|
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||||
|
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||||
|
|
||||||
|
["j"] = actions.move_selection_next,
|
||||||
|
["k"] = actions.move_selection_previous,
|
||||||
|
["H"] = actions.move_to_top,
|
||||||
|
["M"] = actions.move_to_middle,
|
||||||
|
["L"] = actions.move_to_bottom,
|
||||||
|
|
||||||
|
["<Down>"] = actions.move_selection_next,
|
||||||
|
["<Up>"] = actions.move_selection_previous,
|
||||||
|
["gg"] = actions.move_to_top,
|
||||||
|
["G"] = actions.move_to_bottom,
|
||||||
|
|
||||||
|
["<C-u>"] = actions.preview_scrolling_up,
|
||||||
|
["<C-d>"] = actions.preview_scrolling_down,
|
||||||
|
|
||||||
|
["<PageUp>"] = actions.results_scrolling_up,
|
||||||
|
["<PageDown>"] = actions.results_scrolling_down,
|
||||||
|
|
||||||
|
["?"] = actions.which_key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
-- Default configuration for builtin pickers goes here:
|
||||||
|
-- picker_name = {
|
||||||
|
-- picker_config_key = value,
|
||||||
|
-- ...
|
||||||
|
-- }
|
||||||
|
-- Now the picker_config_key will be applied every time you call this
|
||||||
|
-- builtin picker
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
-- Your extension configuration goes here:
|
||||||
|
-- extension_name = {
|
||||||
|
-- extension_config_key = value,
|
||||||
|
-- }
|
||||||
|
-- please take a look at the readme of the extension you want to configure
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"shaunsingh/nord.nvim",
|
||||||
|
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||||
|
cond = function()
|
||||||
|
if os.getenv("GTK_THEME") == "Nordic" then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
priority = 1000, -- make sure to load this before all the other start plugins
|
||||||
|
config = function()
|
||||||
|
vim.g.nord_contrast = false
|
||||||
|
vim.g.nord_borders = true
|
||||||
|
vim.g.nord_disable_background = false
|
||||||
|
vim.g.nord_italic = true
|
||||||
|
vim.g.nord_uniform_diff_background = true
|
||||||
|
vim.g.nord_enable_sidebar_background = true
|
||||||
|
vim.g.nord_bold = true
|
||||||
|
vim.g.nord_cursorline_transparent = false
|
||||||
|
require("nord").set()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"catppuccin/nvim",
|
||||||
|
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||||
|
name = "catppuccin",
|
||||||
|
priority = 1000, -- make sure to load this before all the other start plugins
|
||||||
|
cond = function()
|
||||||
|
if
|
||||||
|
os.getenv("GTK_THEME") == "Catppuccin-Frappe-Pink"
|
||||||
|
or os.getenv("GTK_THEME") == "Catppuccin-Latte-Green"
|
||||||
|
then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
config = function()
|
||||||
|
require("catppuccin").setup({
|
||||||
|
compile_path = vim.fn.stdpath("cache") .. "/catppuccin",
|
||||||
|
transparent_background = true,
|
||||||
|
term_colors = true,
|
||||||
|
dim_inactive = {
|
||||||
|
enabled = false,
|
||||||
|
shade = "dark",
|
||||||
|
percentage = 0.15,
|
||||||
|
},
|
||||||
|
styles = {
|
||||||
|
comments = { "italic" },
|
||||||
|
conditionals = { "italic" },
|
||||||
|
loops = {},
|
||||||
|
functions = {},
|
||||||
|
keywords = {},
|
||||||
|
strings = {},
|
||||||
|
variables = {},
|
||||||
|
numbers = {},
|
||||||
|
booleans = {},
|
||||||
|
properties = {},
|
||||||
|
types = {},
|
||||||
|
operators = {},
|
||||||
|
},
|
||||||
|
integrations = {
|
||||||
|
cmp = true,
|
||||||
|
gitsigns = true,
|
||||||
|
nvimtree = true,
|
||||||
|
telescope = true,
|
||||||
|
treesitter = true,
|
||||||
|
ts_rainbow = true,
|
||||||
|
lsp_saga = true,
|
||||||
|
lsp_trouble = true,
|
||||||
|
dap = {
|
||||||
|
enable = true,
|
||||||
|
enable_ui = true,
|
||||||
|
},
|
||||||
|
native_lsp = {
|
||||||
|
enabled = true,
|
||||||
|
virtual_text = {
|
||||||
|
errors = { "italic" },
|
||||||
|
hints = { "italic" },
|
||||||
|
warnings = { "italic" },
|
||||||
|
information = { "italic" },
|
||||||
|
},
|
||||||
|
underlines = {
|
||||||
|
errors = { "underline" },
|
||||||
|
hints = { "underline" },
|
||||||
|
warnings = { "underline" },
|
||||||
|
information = { "underline" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
indent_blankline = {
|
||||||
|
enabled = true,
|
||||||
|
colored_indent_levels = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
|
||||||
|
},
|
||||||
|
color_overrides = {},
|
||||||
|
custom_highlights = {},
|
||||||
|
})
|
||||||
|
if os.getenv("GTK_THEME") == "Catppuccin-Frappe-Pink" then
|
||||||
|
vim.cmd([[colorscheme catppuccin-frappe ]])
|
||||||
|
else
|
||||||
|
vim.cmd([[colorscheme catppuccin-latte ]])
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
return {
|
||||||
|
"akinsho/toggleterm.nvim",
|
||||||
|
config = function()
|
||||||
|
require("toggleterm").setup({
|
||||||
|
-- size can be a number or function which is passed the current terminal
|
||||||
|
size = function(term)
|
||||||
|
if term.direction == "horizontal" then
|
||||||
|
return 15
|
||||||
|
elseif term.direction == "vertical" then
|
||||||
|
return vim.o.columns * 0.4
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
open_mapping = [[<c-\>]],
|
||||||
|
hide_numbers = true, -- hide the number column in toggleterm buffers
|
||||||
|
shade_filetypes = {},
|
||||||
|
shade_terminals = false,
|
||||||
|
-- shading_factor = "<number>", -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
|
||||||
|
start_in_insert = true,
|
||||||
|
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
||||||
|
terminal_mappings = true, -- whether or not the open mapping applies in the opened terminals
|
||||||
|
persist_size = true,
|
||||||
|
direction = "horizontal", --'vertical' | 'horizontal' | 'window' | 'float',
|
||||||
|
close_on_exit = true, -- close the terminal window when the process exits
|
||||||
|
shell = vim.o.shell, -- change the default shell
|
||||||
|
-- This field is only relevant if direction is set to 'float'
|
||||||
|
float_opts = {
|
||||||
|
-- The border key is *almost* the same as 'nvim_open_win'
|
||||||
|
-- see :h nvim_open_win for details on borders however
|
||||||
|
-- the 'curved' border is a custom border type
|
||||||
|
-- not natively supported but implemented in this plugin.
|
||||||
|
border = "single", --'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
|
||||||
|
width = 80,
|
||||||
|
height = 20,
|
||||||
|
winblend = 0,
|
||||||
|
highlights = {
|
||||||
|
border = "Normal",
|
||||||
|
background = "Normal",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
winbar = {
|
||||||
|
enabled = true,
|
||||||
|
name_formatter = function(term) -- term: Terminal
|
||||||
|
return term.name
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
function runFile()
|
||||||
|
local ft = vim.bo.filetype
|
||||||
|
local run_cmd = { go = "go run", rust = "cargo run" }
|
||||||
|
if run_cmd[ft] then
|
||||||
|
vim.cmd("TermExec cmd=" .. '\'clear;echo "Run current file..."; ' .. run_cmd[ft] .. " %'")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap("n", "<space>r", "<cmd>lua runFile()<CR>", { noremap = true, silent = true })
|
||||||
|
|
||||||
|
function _G.set_terminal_keymaps()
|
||||||
|
local opts = { buffer = 0 }
|
||||||
|
vim.keymap.set("t", "<esc>", [[<C-\><C-n>]], opts)
|
||||||
|
vim.keymap.set("t", "jk", [[<C-\><C-n>]], opts)
|
||||||
|
vim.keymap.set("t", "<C-h>", [[<Cmd>wincmd h<CR>]], opts)
|
||||||
|
vim.keymap.set("t", "<C-j>", [[<Cmd>wincmd j<CR>]], opts)
|
||||||
|
vim.keymap.set("t", "<C-k>", [[<Cmd>wincmd k<CR>]], opts)
|
||||||
|
vim.keymap.set("t", "<C-l>", [[<Cmd>wincmd l<CR>]], opts)
|
||||||
|
vim.keymap.set("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
||||||
|
vim.cmd("autocmd! TermOpen term://*toggleterm#* lua set_terminal_keymaps()")
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
event = "BufRead",
|
||||||
|
config = function()
|
||||||
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
configs.setup({
|
||||||
|
ensure_installed = "all",
|
||||||
|
sync_install = false,
|
||||||
|
auto_install = true,
|
||||||
|
ignore_install = { "" }, -- List of parsers to ignore installing
|
||||||
|
autopairs = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
highlight = {
|
||||||
|
enable = true, -- false will disable the whole extension
|
||||||
|
disable = { "" }, -- list of language that will be disabled
|
||||||
|
additional_vim_regex_highlighting = true,
|
||||||
|
},
|
||||||
|
indent = { enable = true, disable = { "" } },
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
-- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
|
||||||
|
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
||||||
|
max_file_lines = nil, -- Do not enable for files with more than n lines, int
|
||||||
|
-- colors = {}, -- table of hex strings
|
||||||
|
-- termcolors = {} -- table of colour name strings
|
||||||
|
},
|
||||||
|
context_commentstring = {
|
||||||
|
enable = true,
|
||||||
|
enable_autocmd = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
keys = {
|
||||||
|
{ "tr", "<cmd>TroubleToggle<cr>", desc = "trouble" },
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
return {
|
||||||
|
"p00f/nvim-ts-rainbow",
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
return {
|
||||||
|
"mbbill/undotree",
|
||||||
|
event = "InsertEnter",
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user