Nvim : Remove old config.

This commit is contained in:
Dmitry Voronin 2024-02-24 23:17:48 +03:00
parent 27ceebaa91
commit e078b40ca4
44 changed files with 0 additions and 677 deletions

View file

@ -1,25 +0,0 @@
require("key/Leader")
require("plugin/Init")
require("config/Autoread")
require("config/Etc")
require("config/Search")
require("config/Tab")
require("key/Autocomplete")
require("key/Buffer")
require("key/Comment")
require("key/Common")
require("key/Filetree")
require("key/Fold")
require("key/Gitsigns")
require("key/Lsp")
require("key/Navigation")
require("key/Sort")
require("key/Telescope")
require("key/Terminal")
require("key/Todo")
require("key/Trouble")
require("key/Update")
require("key/Whichkey")

View file

@ -1,5 +0,0 @@
vim.o.autoread = true
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
command = "if mode() != 'c' | checktime | endif",
pattern = { "*" },
})

View file

@ -1,27 +0,0 @@
-- 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

View file

@ -1,5 +0,0 @@
vim.opt.hlsearch = true
vim.opt.ignorecase = true
vim.opt.incsearch = true
vim.opt.showmatch = true
vim.opt.smartcase = true

View file

@ -1,9 +0,0 @@
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

View file

@ -1,7 +0,0 @@
require("key/Rekey")
-- Autocomplete.
rekey_input("<C-Space>", "<C-n>")
-- LSP autocomplete.
rekey_normal("<C-Space>", "<cmd>lua vim.lsp.buf.code_action()<cr>")

View file

@ -1,14 +0,0 @@
require("key/Rekey")
-- 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>")

View file

@ -1,5 +0,0 @@
-- 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, {})

View file

@ -1,24 +0,0 @@
require("key/Rekey")
-- 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(";", ":")

View file

@ -1,4 +0,0 @@
require("key/Rekey")
-- Toggle file tree.
rekey_normal("<Leader>1", "<cmd>NvimTreeToggle<cr>")

View file

@ -1,7 +0,0 @@
require("key/Rekey")
-- Toggle fold under cursor.
remap_normal("<Leader>o", "za")
-- Fold everything.
remap_normal("<Leader>O", "zM")

View file

@ -1,4 +0,0 @@
require("key/Rekey")
-- 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>")

View file

@ -1 +0,0 @@
require("key/Rekey")

View file

@ -1,25 +0,0 @@
require("key/Rekey")
-- 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>-")

View file

@ -1,49 +0,0 @@
-- 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

View file

@ -1,4 +0,0 @@
require("key/Rekey")
-- Sort visual selection alphabetically.
rekey_visual("<Leader>A", ":'<,'>sort<cr>")

View file

@ -1,8 +0,0 @@
require("key/Rekey")
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>")

View file

@ -1,7 +0,0 @@
require("key/Rekey")
-- Open terminal window.
rekey_normal("<Leader>4", "<cmd>terminal<cr>")
-- Detach from terminal with Esc key.
rekey_terminal("<Esc>", "<C-\\><C-n>")

View file

@ -1,4 +0,0 @@
require("key/Rekey")
-- Toggle To-do window.
rekey_normal("<Leader>3", "<cmd>TroubleToggle todo<cr>")

View file

@ -1,4 +0,0 @@
require("key/Rekey")
-- Toggle diagnostics window.
rekey_normal("<Leader>2", "<cmd>TroubleToggle document_diagnostics<cr>")

View file

@ -1,5 +0,0 @@
-- Update all command.
vim.api.nvim_create_user_command("Update", function (args)
vim.cmd("PackerUpdate")
vim.cmd("TSUpdate")
end, { desc = "Update everything." })

View file

@ -1,4 +0,0 @@
require("key/Rekey")
-- Show keymap help.
rekey_normal("?", "<cmd>WhichKey<cr>")

View file

@ -1,7 +0,0 @@
require("mini.align").setup {
mappings = {
start = "<Leader>a",
-- start_with_preview = '<Leader>A',
},
}

View file

@ -1,13 +0,0 @@
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" },
-- }
})

View file

@ -1 +0,0 @@
require("bufferline").setup()

View file

@ -1,7 +0,0 @@
require("close_buffers").setup({
file_glob_ignore = {},
file_regex_ignore = {},
filetype_ignore = {},
next_buffer_cmd = nil,
preserve_window_layout = { "this", "nameless" },
})

View file

@ -1,36 +0,0 @@
-- 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
},
})

View file

@ -1,3 +0,0 @@
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldlevel = 99
vim.opt.foldmethod = "expr"

View file

@ -1,43 +0,0 @@
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")

View file

@ -1 +0,0 @@
vim.cmd("colorscheme gruvbox-material")

View file

@ -1,6 +0,0 @@
-- Auto-detect indentation type.
require("indent-o-matic").setup {
max_lines = 1024,
skip_multiline = true,
standard_widths = { 2, 4, 8 },
}

View file

@ -1,75 +0,0 @@
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"
-- Plugin toggles.
local treesitter = true
-- Plugin setup. Order is important.
require("plugin/Filetree")
require("plugin/lsp/Init")
require("plugin/Bufferline")
require("plugin/Lualine")
require("plugin/Autoclose")
require("plugin/Gitsigns")
require("plugin/Trouble")
require("plugin/Tokyonight")
require("plugin/Gruvbox")
require("plugin/Closebuffers")
require("plugin/Telescope")
require("plugin/Todo")
require("plugin/Indent")
require("plugin/Align")
if available({"g++"}) then
if treesitter then
require("plugin/Treesitter")
require("plugin/Fold")
end
end
-- Auto-install.
if packer_bootstrap then
require("packer").sync()
end
end)

View file

@ -1,40 +0,0 @@
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 = {},
}

View file

@ -1,11 +0,0 @@
require("telescope").setup{
defaults = {
mappings = {
i = {
["<C-?>"] = "which_key",
}
}
},
extensions = { },
pickers = { },
}

View file

@ -1,53 +0,0 @@
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):]],
},
}

View file

@ -1,23 +0,0 @@
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]]

View file

@ -1,19 +0,0 @@
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
},
}

View file

@ -1 +0,0 @@
require("trouble").setup()

View file

@ -1,4 +0,0 @@
-- require("plugin/lsp/Kotlin")
-- require("plugin/lsp/Python")
require("plugin/lsp/Rust")
require("plugin/lsp/Tex")

View file

@ -1,3 +0,0 @@
local lspconfig = require("lspconfig")
lspconfig.kotlin_language_server.setup {}

View file

@ -1,3 +0,0 @@
local lspconfig = require("lspconfig")
lspconfig.pyright.setup {}

View file

@ -1,16 +0,0 @@
local lspconfig = require("lspconfig")
lspconfig.rust_analyzer.setup {
settings = {
["rust-analyzer"] = {
rustfmt = {
extraArgs = {
"--config",
"hard_tabs=true",
}
}
},
},
}
vim.g.rust_recommended_style = false

View file

@ -1,60 +0,0 @@
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." })

5
.gitignore vendored
View file

@ -97,11 +97,6 @@
# User dirs.
!/.config/user-dirs.dirs
# Nvim.
!/.config/nvim/
!/.config/nvim/**
/.config/nvim/plugin/
# Ssh.
!/.ssh/
/.ssh/**