Nvim : Move config to nix.
This commit is contained in:
parent
705c3ce800
commit
27ceebaa91
|
@ -28,6 +28,7 @@
|
|||
./module/common/Locale.nix
|
||||
./module/common/Network.nix
|
||||
./module/common/Nix.nix
|
||||
./module/common/Nvim.nix
|
||||
./module/common/Package.nix
|
||||
./module/common/Root.nix
|
||||
./module/common/Sshd.nix
|
||||
|
|
55
.config/linux/system/module/common/Nvim.nix
Normal file
55
.config/linux/system/module/common/Nvim.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{ environment, ... }: let
|
||||
nvimSrc = "/etc/nvim/";
|
||||
in {
|
||||
environment.etc.nvim.source = ./nvim;
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
configure = {
|
||||
customRC = ''
|
||||
lua dofile("${nvimSrc}/plugin/Init.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Filetree.lua")
|
||||
lua dofile("${nvimSrc}/plugin/lsp/Rust.lua")
|
||||
lua dofile("${nvimSrc}/plugin/lsp/Tex.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Bufferline.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Lualine.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Autoclose.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Gitsigns.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Trouble.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Tokyonight.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Gruvbox.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Closebuffers.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Telescope.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Todo.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Indent.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Align.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Treesitter.lua")
|
||||
lua dofile("${nvimSrc}/plugin/Fold.lua")
|
||||
lua dofile("${nvimSrc}/config/Autoread.lua")
|
||||
lua dofile("${nvimSrc}/config/Etc.lua")
|
||||
lua dofile("${nvimSrc}/config/Search.lua")
|
||||
lua dofile("${nvimSrc}/config/Tab.lua")
|
||||
lua dofile("${nvimSrc}/key/Rekey.lua")
|
||||
lua dofile("${nvimSrc}/key/Leader.lua")
|
||||
lua dofile("${nvimSrc}/key/Autocomplete.lua")
|
||||
lua dofile("${nvimSrc}/key/Buffer.lua")
|
||||
lua dofile("${nvimSrc}/key/Comment.lua")
|
||||
lua dofile("${nvimSrc}/key/Common.lua")
|
||||
lua dofile("${nvimSrc}/key/Filetree.lua")
|
||||
lua dofile("${nvimSrc}/key/Fold.lua")
|
||||
lua dofile("${nvimSrc}/key/Gitsigns.lua")
|
||||
lua dofile("${nvimSrc}/key/Lsp.lua")
|
||||
lua dofile("${nvimSrc}/key/Navigation.lua")
|
||||
lua dofile("${nvimSrc}/key/Sort.lua")
|
||||
lua dofile("${nvimSrc}/key/Telescope.lua")
|
||||
lua dofile("${nvimSrc}/key/Terminal.lua")
|
||||
lua dofile("${nvimSrc}/key/Todo.lua")
|
||||
lua dofile("${nvimSrc}/key/Trouble.lua")
|
||||
lua dofile("${nvimSrc}/key/Update.lua")
|
||||
lua dofile("${nvimSrc}/key/Whichkey.lua")
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -40,5 +40,4 @@
|
|||
|
||||
# Special packages.
|
||||
programs.adb.enable = true;
|
||||
programs.neovim.enable = true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
{ environment, ... }: {
|
||||
environment.etc.wallpaper = {
|
||||
source = ../../../wallpaper; # TODO: Use a path relative to repo.
|
||||
};
|
||||
environment.etc.wallpaper.source = ../../../wallpaper; # TODO: Use a path relative to repo.
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
vim.o.autoread = true
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
|
||||
command = "if mode() != 'c' | checktime | endif",
|
||||
pattern = { "*" },
|
||||
})
|
27
.config/linux/system/module/common/nvim/config/Etc.lua
Normal file
27
.config/linux/system/module/common/nvim/config/Etc.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
-- TODO: Add comments and separate files.
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
-- vim.opt.completeopt = "menuone,noselect"
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.fixeol = false
|
||||
vim.opt.number = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.ttyfast = true
|
||||
vim.opt.wildmode = "longest,list"
|
||||
|
||||
-- Disable continuing comments on newline.
|
||||
vim.cmd("autocmd BufEnter * set fo-=c fo-=r fo-=o")
|
||||
|
||||
-- Disable mouse.
|
||||
vim.cmd("set mouse=")
|
||||
|
||||
-- Disable signs for diagnostics.
|
||||
vim.diagnostic.config({ signs = false })
|
||||
|
||||
-- Display invisible characters.
|
||||
-- vim.cmd("set list listchars=tab:>\\ ,trail:-,eol:,lead:.")
|
||||
vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:.")
|
||||
|
||||
-- Relative line numbers.
|
||||
vim.wo.relativenumber = true
|
|
@ -0,0 +1,5 @@
|
|||
vim.opt.hlsearch = true
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.showmatch = true
|
||||
vim.opt.smartcase = true
|
9
.config/linux/system/module/common/nvim/config/Tab.lua
Normal file
9
.config/linux/system/module/common/nvim/config/Tab.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
vim.opt.autoindent = true
|
||||
vim.opt.expandtab = false
|
||||
vim.opt.shiftwidth = 2
|
||||
-- vim.opt.smartindent = true
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.tabstop = 2
|
||||
|
||||
-- Disable Markdown forced formatting.
|
||||
vim.g.markdown_recommended_style = 0
|
|
@ -0,0 +1,5 @@
|
|||
-- Autocomplete.
|
||||
rekey_input("<C-Space>", "<C-n>")
|
||||
|
||||
-- LSP autocomplete.
|
||||
rekey_normal("<C-Space>", "<cmd>lua vim.lsp.buf.code_action()<cr>")
|
12
.config/linux/system/module/common/nvim/key/Buffer.lua
Normal file
12
.config/linux/system/module/common/nvim/key/Buffer.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
-- New empty buffer.
|
||||
remap_normal("<Leader>n", "<cmd>enew<cr>")
|
||||
|
||||
-- Close buffer.
|
||||
function _buf_close()
|
||||
pcall(vim.cmd, "w")
|
||||
vim.cmd[[bp|sp|bn|bd!]]
|
||||
end
|
||||
rekey_normal("<Leader>x", "<cmd>lua _buf_close()<cr>")
|
||||
|
||||
-- Close all hidden buffers.
|
||||
rekey_normal("<Leader>X", "<cmd>BDelete hidden<cr><C-l>")
|
5
.config/linux/system/module/common/nvim/key/Comment.lua
Normal file
5
.config/linux/system/module/common/nvim/key/Comment.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- Toggle comment for the selected line.
|
||||
vim.keymap.set("n", "<Leader>/", require("SingleComment").SingleComment, { expr = true })
|
||||
|
||||
-- Toggle comments for multiple lines.
|
||||
vim.keymap.set("v", "<Leader>/", require("SingleComment").Comment, {})
|
22
.config/linux/system/module/common/nvim/key/Common.lua
Normal file
22
.config/linux/system/module/common/nvim/key/Common.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
-- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim.
|
||||
function bye()
|
||||
pcall(vim.cmd, "wa")
|
||||
vim.cmd[[qa!]]
|
||||
end
|
||||
|
||||
-- Repeat previous command.
|
||||
rekey_normal("<Leader>.", "@:")
|
||||
rekey_visual("<Leader>.", "@:")
|
||||
|
||||
-- Save everything.
|
||||
rekey_normal("zz", "<cmd>wa<cr>")
|
||||
|
||||
-- Save all we can and leave.
|
||||
rekey_normal("<Leader>z", "<cmd>lua bye()<cr>")
|
||||
|
||||
-- Compatibility alias for visual selection.
|
||||
rekey_normal("<Leader>v", "v")
|
||||
|
||||
-- Remap ; to :.
|
||||
rekey_normal(";", ":")
|
||||
rekey_visual(";", ":")
|
2
.config/linux/system/module/common/nvim/key/Filetree.lua
Normal file
2
.config/linux/system/module/common/nvim/key/Filetree.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- Toggle file tree.
|
||||
rekey_normal("<Leader>1", "<cmd>NvimTreeToggle<cr>")
|
5
.config/linux/system/module/common/nvim/key/Fold.lua
Normal file
5
.config/linux/system/module/common/nvim/key/Fold.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- Toggle fold under cursor.
|
||||
remap_normal("<Leader>o", "za")
|
||||
|
||||
-- Fold everything.
|
||||
remap_normal("<Leader>O", "zM")
|
2
.config/linux/system/module/common/nvim/key/Gitsigns.lua
Normal file
2
.config/linux/system/module/common/nvim/key/Gitsigns.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- Toggle Git inspection mode.
|
||||
rekey_normal("<Leader>g", "<cmd>Gitsigns toggle_current_line_blame<cr><cmd>Gitsigns toggle_word_diff<cr><cmd>Gitsigns toggle_linehl<cr>")
|
|
@ -1,5 +1,3 @@
|
|||
require("key/Rekey")
|
||||
|
||||
leader = " "
|
||||
|
||||
vim.g.mapleader = leader
|
0
.config/linux/system/module/common/nvim/key/Lsp.lua
Normal file
0
.config/linux/system/module/common/nvim/key/Lsp.lua
Normal file
23
.config/linux/system/module/common/nvim/key/Navigation.lua
Normal file
23
.config/linux/system/module/common/nvim/key/Navigation.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
-- Switch windows.
|
||||
rekey_normal("<Leader>a", "<C-w>h")
|
||||
rekey_normal("<Leader>d", "<C-w>l")
|
||||
rekey_normal("<Leader>s", "<C-w>j")
|
||||
rekey_normal("<Leader>w", "<C-w>k")
|
||||
|
||||
-- Switch buffers.
|
||||
rekey_normal("<Leader>E", "<cmd>BufferLineMoveNext<cr>")
|
||||
rekey_normal("<Leader>Q", "<cmd>BufferLineMovePrev<cr>")
|
||||
rekey_normal("<Leader>e", "<cmd>BufferLineCycleNext<cr>")
|
||||
rekey_normal("<Leader>q", "<cmd>BufferLineCyclePrev<cr>")
|
||||
|
||||
-- Splits.
|
||||
rekey_normal("<Leader>\\", "<cmd>vsplit<cr>")
|
||||
rekey_normal("<Leader>-", "<cmd>split<cr>")
|
||||
rekey_normal("<Leader>=", "<C-w>=") -- Equalize split sizes.
|
||||
rekey_normal("<Leader>c", "<C-w>q") -- Close split.
|
||||
|
||||
-- Resize splits.
|
||||
rekey_normal("<Leader>A", "4<C-w><")
|
||||
rekey_normal("<Leader>D", "4<C-w>>")
|
||||
rekey_normal("<Leader>S", "2<C-w>+")
|
||||
rekey_normal("<Leader>W", "2<C-w>-")
|
49
.config/linux/system/module/common/nvim/key/Rekey.lua
Normal file
49
.config/linux/system/module/common/nvim/key/Rekey.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
-- Base rekey function.
|
||||
local function rekey(t, key, command)
|
||||
vim.api.nvim_set_keymap(t, key, command, { noremap = true })
|
||||
end
|
||||
|
||||
-- Base remap function.
|
||||
local function remap(t, key, command)
|
||||
vim.api.nvim_set_keymap(t, key, command, { noremap = false })
|
||||
end
|
||||
|
||||
-- Rekey in normal mode.
|
||||
function rekey_normal(key, command)
|
||||
rekey("n", key, command)
|
||||
end
|
||||
|
||||
-- Rekey in input mode.
|
||||
function rekey_input(key, command)
|
||||
rekey("i", key, command)
|
||||
end
|
||||
|
||||
-- Rekey in visual mode.
|
||||
function rekey_visual(key, command)
|
||||
rekey("v", key, command)
|
||||
end
|
||||
|
||||
-- Rekey in terminal mode.
|
||||
function rekey_terminal(key, command)
|
||||
rekey("t", key, command)
|
||||
end
|
||||
|
||||
-- Remap in normal mode.
|
||||
function remap_normal(key, command)
|
||||
remap("n", key, command)
|
||||
end
|
||||
|
||||
-- Remap in input mode.
|
||||
function remap_input(key, command)
|
||||
remap("i", key, command)
|
||||
end
|
||||
|
||||
-- Remap in visual mode.
|
||||
function remap_visual(key, command)
|
||||
remap("v", key, command)
|
||||
end
|
||||
|
||||
-- Remap in terminal mode.
|
||||
function remap_terminal(key, command)
|
||||
remap("t", key, command)
|
||||
end
|
2
.config/linux/system/module/common/nvim/key/Sort.lua
Normal file
2
.config/linux/system/module/common/nvim/key/Sort.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- Sort visual selection alphabetically.
|
||||
rekey_visual("<Leader>A", ":'<,'>sort<cr>")
|
|
@ -0,0 +1,6 @@
|
|||
rekey_normal("<Leader>fa", "<cmd>Telescope<cr>")
|
||||
rekey_normal("<Leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>")
|
||||
rekey_normal("<Leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>")
|
||||
rekey_normal("<Leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>")
|
||||
rekey_normal("<Leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>")
|
||||
rekey_normal("<Leader>ft", "<cmd>Telescope treesitter<cr>")
|
5
.config/linux/system/module/common/nvim/key/Terminal.lua
Normal file
5
.config/linux/system/module/common/nvim/key/Terminal.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- Open terminal window.
|
||||
rekey_normal("<Leader>4", "<cmd>terminal<cr>")
|
||||
|
||||
-- Detach from terminal with Esc key.
|
||||
rekey_terminal("<Esc>", "<C-\\><C-n>")
|
2
.config/linux/system/module/common/nvim/key/Todo.lua
Normal file
2
.config/linux/system/module/common/nvim/key/Todo.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- Toggle To-do window.
|
||||
rekey_normal("<Leader>3", "<cmd>TroubleToggle todo<cr>")
|
2
.config/linux/system/module/common/nvim/key/Trouble.lua
Normal file
2
.config/linux/system/module/common/nvim/key/Trouble.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- Toggle diagnostics window.
|
||||
rekey_normal("<Leader>2", "<cmd>TroubleToggle document_diagnostics<cr>")
|
5
.config/linux/system/module/common/nvim/key/Update.lua
Normal file
5
.config/linux/system/module/common/nvim/key/Update.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- Update all command.
|
||||
vim.api.nvim_create_user_command("Update", function (args)
|
||||
vim.cmd("PackerUpdate")
|
||||
vim.cmd("TSUpdate")
|
||||
end, { desc = "Update everything." })
|
2
.config/linux/system/module/common/nvim/key/Whichkey.lua
Normal file
2
.config/linux/system/module/common/nvim/key/Whichkey.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- Show keymap help.
|
||||
rekey_normal("?", "<cmd>WhichKey<cr>")
|
7
.config/linux/system/module/common/nvim/plugin/Align.lua
Normal file
7
.config/linux/system/module/common/nvim/plugin/Align.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
require("mini.align").setup {
|
||||
mappings = {
|
||||
start = "<Leader>a",
|
||||
-- start_with_preview = '<Leader>A',
|
||||
},
|
||||
}
|
||||
|
13
.config/linux/system/module/common/nvim/plugin/Autoclose.lua
Normal file
13
.config/linux/system/module/common/nvim/plugin/Autoclose.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
require("autoclose").setup({
|
||||
keys = {
|
||||
["'"] = { escape = false, close = false, pair = "''", disabled_filetypes = {} },
|
||||
["("] = { escape = true, close = true, pair = "()", disabled_filetypes = {} },
|
||||
["<"] = { escape = true, close = true, pair = "<>", disabled_filetypes = {} },
|
||||
["\""] = { escape = true, close = true, pair = "\"\"", disabled_filetypes = {} },
|
||||
["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {} },
|
||||
["{"] = { escape = true, close = true, pair = "{}", disabled_filetypes = {} },
|
||||
},
|
||||
-- options = {
|
||||
-- disabled_filetypes = { "text", "markdown" },
|
||||
-- }
|
||||
})
|
|
@ -0,0 +1 @@
|
|||
require("bufferline").setup()
|
|
@ -0,0 +1,7 @@
|
|||
require("close_buffers").setup({
|
||||
file_glob_ignore = {},
|
||||
file_regex_ignore = {},
|
||||
filetype_ignore = {},
|
||||
next_buffer_cmd = nil,
|
||||
preserve_window_layout = { "this", "nameless" },
|
||||
})
|
36
.config/linux/system/module/common/nvim/plugin/Filetree.lua
Normal file
36
.config/linux/system/module/common/nvim/plugin/Filetree.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
-- Disable netrw at the very start of your init.lua.
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
local function my_on_attach(bufnr)
|
||||
local api = require "nvim-tree.api"
|
||||
|
||||
local function opts(desc)
|
||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
|
||||
-- Default mappings.
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
|
||||
-- Custom mappings.
|
||||
vim.keymap.set('n', '<Leader><Tab>', api.tree.change_root_to_node, opts('Cd into'))
|
||||
end
|
||||
|
||||
-- Set termguicolors to enable highlight groups.
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
-- Setup nvim-tree.
|
||||
require("nvim-tree").setup({
|
||||
on_attach = my_on_attach,
|
||||
sort_by = "case_sensitive",
|
||||
view = {
|
||||
width = 30,
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
git_ignored = false
|
||||
},
|
||||
})
|
3
.config/linux/system/module/common/nvim/plugin/Fold.lua
Normal file
3
.config/linux/system/module/common/nvim/plugin/Fold.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.foldmethod = "expr"
|
43
.config/linux/system/module/common/nvim/plugin/Gitsigns.lua
Normal file
43
.config/linux/system/module/common/nvim/plugin/Gitsigns.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
require("gitsigns").setup {
|
||||
signs = {
|
||||
add = { text = "│" },
|
||||
change = { text = "│" },
|
||||
changedelete = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
untracked = { text = "┆" },
|
||||
},
|
||||
linehl = false,
|
||||
numhl = true,
|
||||
signcolumn = false,
|
||||
word_diff = false,
|
||||
watch_gitdir = {
|
||||
follow_files = true,
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false,
|
||||
current_line_blame_opts = {
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
virt_text = true,
|
||||
virt_text_pos = "eol",
|
||||
},
|
||||
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
|
||||
max_file_length = 40000,
|
||||
sign_priority = 6,
|
||||
status_formatter = nil,
|
||||
update_debounce = 100,
|
||||
preview_config = {
|
||||
border = "single",
|
||||
col = 1,
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
style = "minimal",
|
||||
},
|
||||
yadm = {
|
||||
enable = false,
|
||||
},
|
||||
}
|
||||
|
||||
-- Set custom color.
|
||||
vim.cmd("highlight gitsignscurrentlineblame guibg=#00000000 guifg=#aaaaaa")
|
|
@ -0,0 +1 @@
|
|||
vim.cmd("colorscheme gruvbox-material")
|
|
@ -0,0 +1,6 @@
|
|||
-- Auto-detect indentation type.
|
||||
require("indent-o-matic").setup {
|
||||
max_lines = 1024,
|
||||
skip_multiline = true,
|
||||
standard_widths = { 2, 4, 8 },
|
||||
}
|
49
.config/linux/system/module/common/nvim/plugin/Init.lua
Normal file
49
.config/linux/system/module/common/nvim/plugin/Init.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data").."/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({"git", "clone", "--depth", "1", "https://git.voronind.com/mirror/packer.nvim.git", install_path})
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
local available = function(commands)
|
||||
for _, command in ipairs(commands) do
|
||||
if vim.fn.executable(command) ~= 1 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return require("packer").startup(function(use)
|
||||
use "https://git.voronind.com/mirror/SingleComment.nvim.git"
|
||||
use "https://git.voronind.com/mirror/autoclose.nvim.git"
|
||||
use "https://git.voronind.com/mirror/bufferline.nvim.git"
|
||||
use "https://git.voronind.com/mirror/close-buffers.nvim.git"
|
||||
use "https://git.voronind.com/mirror/gitsigns.nvim.git"
|
||||
use "https://git.voronind.com/mirror/gruvbox-material.git"
|
||||
use "https://git.voronind.com/mirror/indent-o-matic.git"
|
||||
use "https://git.voronind.com/mirror/lualine.nvim.git"
|
||||
use "https://git.voronind.com/mirror/mini.align.git"
|
||||
use "https://git.voronind.com/mirror/nvim-lspconfig.git"
|
||||
use "https://git.voronind.com/mirror/nvim-tree.lua.git"
|
||||
use "https://git.voronind.com/mirror/nvim-treesitter.git"
|
||||
use "https://git.voronind.com/mirror/nvim-web-devicons.git"
|
||||
use "https://git.voronind.com/mirror/packer.nvim.git"
|
||||
use "https://git.voronind.com/mirror/plenary.nvim.git"
|
||||
use "https://git.voronind.com/mirror/telescope.nvim.git"
|
||||
use "https://git.voronind.com/mirror/todo-comments.nvim.git"
|
||||
use "https://git.voronind.com/mirror/tokyonight.nvim.git"
|
||||
use "https://git.voronind.com/mirror/trouble.nvim.git"
|
||||
use "https://git.voronind.com/mirror/which-key.nvim.git"
|
||||
|
||||
-- Auto-install.
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
40
.config/linux/system/module/common/nvim/plugin/Lualine.lua
Normal file
40
.config/linux/system/module/common/nvim/plugin/Lualine.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
require("lualine").setup {
|
||||
options = {
|
||||
-- theme = "ayu_mirage",
|
||||
icons_enabled = true,
|
||||
component_separators = { left = "", right = ""},
|
||||
section_separators = { left = "", right = ""},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
ignore_focus = {},
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {"mode"},
|
||||
lualine_b = {"branch", "diff", "diagnostics"},
|
||||
lualine_c = {"filename"},
|
||||
lualine_x = {"encoding", "fileformat", "filetype"},
|
||||
lualine_y = {"progress"},
|
||||
lualine_z = {"location"},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {"filename"},
|
||||
lualine_x = {"location"},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
extensions = {},
|
||||
inactive_winbar = {},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
}
|
11
.config/linux/system/module/common/nvim/plugin/Telescope.lua
Normal file
11
.config/linux/system/module/common/nvim/plugin/Telescope.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
require("telescope").setup{
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-?>"] = "which_key",
|
||||
}
|
||||
}
|
||||
},
|
||||
extensions = { },
|
||||
pickers = { },
|
||||
}
|
53
.config/linux/system/module/common/nvim/plugin/Todo.lua
Normal file
53
.config/linux/system/module/common/nvim/plugin/Todo.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
require("todo-comments").setup {
|
||||
sign_priority = 8,
|
||||
signs = false,
|
||||
keywords = {
|
||||
FIX = {
|
||||
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" },
|
||||
color = "error",
|
||||
icon = " ",
|
||||
},
|
||||
HACK = { icon = " ", color = "warning" },
|
||||
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||
TODO = { icon = " ", color = "info" },
|
||||
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||
},
|
||||
gui_style = {
|
||||
bg = "BOLD",
|
||||
fg = "NONE",
|
||||
},
|
||||
merge_keywords = true,
|
||||
highlight = {
|
||||
after = "fg",
|
||||
before = "",
|
||||
comments_only = true,
|
||||
exclude = {},
|
||||
keyword = "wide",
|
||||
max_line_len = 400,
|
||||
multiline = true,
|
||||
multiline_context = 10,
|
||||
multiline_pattern = "^.",
|
||||
pattern = [[.*<(KEYWORDS)\s*:]],
|
||||
},
|
||||
colors = {
|
||||
default = { "Identifier", "#7C3AED" },
|
||||
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||
hint = { "DiagnosticHint", "#10B981" },
|
||||
info = { "DiagnosticInfo", "#2563EB" },
|
||||
test = { "Identifier", "#FF00FF" },
|
||||
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||
},
|
||||
search = {
|
||||
command = "rg",
|
||||
args = {
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
},
|
||||
pattern = [[\b(KEYWORDS):]],
|
||||
},
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
require("tokyonight").setup({
|
||||
light_style = "night",
|
||||
style = "night",
|
||||
terminal_colors = true,
|
||||
transparent = false,
|
||||
styles = {
|
||||
comments = { italic = true },
|
||||
floats = "dark",
|
||||
functions = {},
|
||||
keywords = { italic = true },
|
||||
sidebars = "dark",
|
||||
variables = {},
|
||||
},
|
||||
day_brightness = 0.3,
|
||||
dim_inactive = false,
|
||||
hide_inactive_statusline = false,
|
||||
lualine_bold = false,
|
||||
on_colors = function(colors) end,
|
||||
on_highlights = function(highlights, colors) end,
|
||||
sidebars = { "qf", "help" },
|
||||
})
|
||||
|
||||
-- vim.cmd[[colorscheme tokyonight]]
|
|
@ -0,0 +1,19 @@
|
|||
require("nvim-treesitter.configs").setup {
|
||||
auto_install = true,
|
||||
-- ensure_installed = "all",
|
||||
sync_install = false,
|
||||
highlight = {
|
||||
additional_vim_regex_highlighting = false,
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
autotag = {
|
||||
enable = true
|
||||
},
|
||||
rainbow = {
|
||||
enable = true
|
||||
},
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
require("trouble").setup()
|
|
@ -0,0 +1,3 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.kotlin_language_server.setup {}
|
|
@ -0,0 +1,3 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.pyright.setup {}
|
16
.config/linux/system/module/common/nvim/plugin/lsp/Rust.lua
Normal file
16
.config/linux/system/module/common/nvim/plugin/lsp/Rust.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.rust_analyzer.setup {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
rustfmt = {
|
||||
extraArgs = {
|
||||
"--config",
|
||||
"hard_tabs=true",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.g.rust_recommended_style = false
|
60
.config/linux/system/module/common/nvim/plugin/lsp/Tex.lua
Normal file
60
.config/linux/system/module/common/nvim/plugin/lsp/Tex.lua
Normal file
|
@ -0,0 +1,60 @@
|
|||
local lspconfig = require('lspconfig')
|
||||
local config = {
|
||||
filetypes = {
|
||||
"bib",
|
||||
"gitcommit",
|
||||
"markdown",
|
||||
"org",
|
||||
"pandoc",
|
||||
"plaintex",
|
||||
"rnoweb",
|
||||
"rst",
|
||||
"tex",
|
||||
"text",
|
||||
},
|
||||
settings = {
|
||||
["ltex"] = {
|
||||
language = "auto"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lspconfig.ltex.setup(config)
|
||||
|
||||
-- Use TeX LSP for spellcheck.
|
||||
vim.api.nvim_create_user_command("SCOn", function (args)
|
||||
lspconfig.ltex.setup(config)
|
||||
end, { desc = "Enable spellcheck." })
|
||||
|
||||
vim.api.nvim_create_user_command("SCOff", function (args)
|
||||
lspconfig.ltex.setup { filetypes = {} }
|
||||
end, { desc = "Disable spellcheck." })
|
||||
|
||||
vim.api.nvim_create_user_command("SCLangRU", function (args)
|
||||
config.settings['ltex'].language = "ru-RU"
|
||||
lspconfig.ltex.setup(config)
|
||||
end, { desc = "Set spellcheck to Russian." })
|
||||
|
||||
vim.api.nvim_create_user_command("SCLangEN", function (args)
|
||||
config.settings['ltex'].language = "en-US"
|
||||
lspconfig.ltex.setup(config)
|
||||
end, { desc = "Set spellcheck to English." })
|
||||
|
||||
vim.api.nvim_create_user_command("SCLangAuto", function (args)
|
||||
config.settings['ltex'].language = "auto"
|
||||
lspconfig.ltex.setup(config)
|
||||
end, { desc = "Set spellcheck to Auto." })
|
||||
|
||||
vim.api.nvim_create_user_command("SCForce", function (args)
|
||||
vim.cmd("setfiletype text")
|
||||
vim.cmd("SCOn")
|
||||
end, { desc = "Set buffer type to text." })
|
||||
|
||||
vim.api.nvim_create_user_command("SCReset", function (args)
|
||||
vim.cmd("filetype detect")
|
||||
vim.cmd("SCLangAuto")
|
||||
end, { desc = "Set buffer type to auto." })
|
||||
|
||||
vim.api.nvim_create_user_command("SCInfo", function (args)
|
||||
vim.cmd("LspInfo")
|
||||
end, { desc = "Show info about spellcheck." })
|
Reference in a new issue