nvim : reindent with tab.

This commit is contained in:
Dmitry Voronin 2023-12-05 22:06:39 +03:00
parent a095e63b15
commit 44aa9216c6
10 changed files with 108 additions and 113 deletions

View file

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

View file

@ -1,39 +1,39 @@
local function rekey(t, key, command) local function rekey(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = true }) vim.api.nvim_set_keymap(t, key, command, { noremap = true })
end end
local function remap(t, key, command) local function remap(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = false }) vim.api.nvim_set_keymap(t, key, command, { noremap = false })
end end
function rekey_normal(key, command) function rekey_normal(key, command)
rekey('n', key, command) rekey('n', key, command)
end end
function rekey_input(key, command) function rekey_input(key, command)
rekey('i', key, command) rekey('i', key, command)
end end
function rekey_visual(key, command) function rekey_visual(key, command)
rekey('v', key, command) rekey('v', key, command)
end end
function rekey_terminal(key, command) function rekey_terminal(key, command)
rekey('t', key, command) rekey('t', key, command)
end end
function remap_normal(key, command) function remap_normal(key, command)
remap('n', key, command) remap('n', key, command)
end end
function remap_input(key, command) function remap_input(key, command)
remap('i', key, command) remap('i', key, command)
end end
function remap_visual(key, command) function remap_visual(key, command)
remap('v', key, command) remap('v', key, command)
end end
function remap_terminal(key, command) function remap_terminal(key, command)
remap('t', key, command) remap('t', key, command)
end end

View file

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

View file

@ -1,14 +1,13 @@
require("autoclose").setup({ require("autoclose").setup({
keys = { keys = {
["'"] = { escape = false, close = false, pair = "''", disabled_filetypes = {} }, ["\""] = { escape = true, close = true, pair = "\"\"", disabled_filetypes = {} },
["'"] = { 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 = {} }, ["<"] = { 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 = {
-- options = { -- disabled_filetypes = { "text", "markdown" },
-- disabled_filetypes = { "text", "markdown" }, -- }
-- }
}) })

View file

@ -1,5 +1 @@
require("bufferline").setup { require("bufferline").setup()
-- options = {
-- numbers = 'buffer_id'
-- }
}

View file

@ -1,7 +1,7 @@
require('close_buffers').setup({ require('close_buffers').setup({
filetype_ignore = {}, -- Filetype to ignore when running deletions filetype_ignore = {}, -- Filetype to ignore when running deletions
file_glob_ignore = {}, -- File name glob pattern to ignore when running deletions (e.g. '*.md') file_glob_ignore = {}, -- File name glob pattern to ignore when running deletions (e.g. '*.md')
file_regex_ignore = {}, -- File name regex pattern to ignore when running deletions (e.g. '.*[.]md') file_regex_ignore = {}, -- File name regex pattern to ignore when running deletions (e.g. '.*[.]md')
preserve_window_layout = { 'this', 'nameless' }, -- Types of deletion that should preserve the window layout preserve_window_layout = { 'this', 'nameless' }, -- Types of deletion that should preserve the window layout
next_buffer_cmd = nil, -- Custom function to retrieve the next buffer when preserving window layout next_buffer_cmd = nil, -- Custom function to retrieve the next buffer when preserving window layout
}) })

View file

@ -10,15 +10,15 @@ vim.opt.termguicolors = true
-- OR setup with some options -- OR setup with some options
require("nvim-tree").setup({ require("nvim-tree").setup({
sort_by = "case_sensitive", sort_by = "case_sensitive",
view = { view = {
width = 30, width = 30,
}, },
renderer = { renderer = {
group_empty = true, group_empty = true,
}, },
filters = { filters = {
dotfiles = false, dotfiles = false,
git_ignored = false git_ignored = false
}, },
}) })

View file

@ -1,43 +1,43 @@
require('gitsigns').setup { require('gitsigns').setup {
signs = { signs = {
add = { text = '' }, add = { text = '' },
change = { text = '' }, change = { text = '' },
delete = { text = '_' }, delete = { text = '_' },
topdelete = { text = '' }, topdelete = { text = '' },
changedelete = { text = '~' }, changedelete = { text = '~' },
untracked = { text = '' }, untracked = { text = '' },
}, },
signcolumn = false, -- Toggle with `:Gitsigns toggle_signs` signcolumn = false, -- Toggle with `:Gitsigns toggle_signs`
numhl = true, -- Toggle with `:Gitsigns toggle_numhl` numhl = true, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl` linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = { watch_gitdir = {
follow_files = true follow_files = true
}, },
attach_to_untracked = true, attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = { current_line_blame_opts = {
virt_text = true, virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 1000, delay = 1000,
ignore_whitespace = false, ignore_whitespace = false,
}, },
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>', current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
sign_priority = 6, sign_priority = 6,
update_debounce = 100, update_debounce = 100,
status_formatter = nil, -- Use default status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines) max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = { preview_config = {
-- Options passed to nvim_open_win -- Options passed to nvim_open_win
border = 'single', border = 'single',
style = 'minimal', style = 'minimal',
relative = 'cursor', relative = 'cursor',
row = 0, row = 0,
col = 1 col = 1
}, },
yadm = { yadm = {
enable = false enable = false
}, },
} }
vim.cmd('highlight gitsignscurrentlineblame guibg=#00000000 guifg=#aaaaaa') vim.cmd('highlight gitsignscurrentlineblame guibg=#00000000 guifg=#aaaaaa')

View file

@ -1,13 +1,13 @@
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
lspconfig.rust_analyzer.setup { lspconfig.rust_analyzer.setup {
settings = { settings = {
["rust-analyzer"] = { ["rust-analyzer"] = {
rustfmt = { rustfmt = {
extraArgs = { "--config", "tab_spaces=2", "brace_style=AlwaysNextLine", "control_brace_style=AlwaysNextLine" } extraArgs = { "--config", "tab_spaces=2", "brace_style=AlwaysNextLine", "control_brace_style=AlwaysNextLine" }
} }
}, },
}, },
} }
vim.g.rust_recommended_style = false vim.g.rust_recommended_style = false

View file

@ -1,52 +1,52 @@
local lspconfig = require('lspconfig') local lspconfig = require('lspconfig')
local config = { local config = {
filetypes = { 'text', 'bib', 'gitcommit', 'markdown', 'org', 'plaintex', 'rst', 'rnoweb', 'tex', 'pandoc' }, filetypes = { 'text', 'bib', 'gitcommit', 'markdown', 'org', 'plaintex', 'rst', 'rnoweb', 'tex', 'pandoc' },
settings = { settings = {
['ltex'] = { ['ltex'] = {
language = "auto" language = "auto"
} }
} }
} }
lspconfig.ltex.setup(config) lspconfig.ltex.setup(config)
vim.api.nvim_create_user_command('SCOn', function (args) vim.api.nvim_create_user_command('SCOn', function (args)
lspconfig.ltex.setup(config) lspconfig.ltex.setup(config)
end, { desc = "Enable spellcheck." }) end, { desc = "Enable spellcheck." })
vim.api.nvim_create_user_command('SCOff', function (args) vim.api.nvim_create_user_command('SCOff', function (args)
lspconfig.ltex.setup { filetypes = {} } lspconfig.ltex.setup { filetypes = {} }
end, { desc = "Disable spellcheck." }) end, { desc = "Disable spellcheck." })
vim.api.nvim_create_user_command('SCLangRU', function (args) vim.api.nvim_create_user_command('SCLangRU', function (args)
config.settings['ltex'].language = "ru-RU" config.settings['ltex'].language = "ru-RU"
lspconfig.ltex.setup(config) lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to Russian." }) end, { desc = "Set spellcheck to Russian." })
vim.api.nvim_create_user_command('SCLangEN', function (args) vim.api.nvim_create_user_command('SCLangEN', function (args)
config.settings['ltex'].language = "en-US" config.settings['ltex'].language = "en-US"
lspconfig.ltex.setup(config) lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to English." }) end, { desc = "Set spellcheck to English." })
vim.api.nvim_create_user_command('SCLangAuto', function (args) vim.api.nvim_create_user_command('SCLangAuto', function (args)
config.settings['ltex'].language = "auto" config.settings['ltex'].language = "auto"
lspconfig.ltex.setup(config) lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to Auto." }) end, { desc = "Set spellcheck to Auto." })
vim.api.nvim_create_user_command('SCForce', function (args) vim.api.nvim_create_user_command('SCForce', function (args)
vim.cmd("setfiletype text") vim.cmd("setfiletype text")
vim.cmd("SCOn") vim.cmd("SCOn")
end, { desc = "Set buffer type to text." }) end, { desc = "Set buffer type to text." })
vim.api.nvim_create_user_command('SCReset', function (args) vim.api.nvim_create_user_command('SCReset', function (args)
vim.cmd("filetype detect") vim.cmd("filetype detect")
vim.cmd("SCLangAuto") vim.cmd("SCLangAuto")
end, { desc = "Set buffer type to auto." }) end, { desc = "Set buffer type to auto." })
vim.api.nvim_create_user_command('SCInfo', function (args) vim.api.nvim_create_user_command('SCInfo', function (args)
vim.cmd("LspInfo") vim.cmd("LspInfo")
end, { desc = "Show info about spellcheck." }) end, { desc = "Show info about spellcheck." })
vim.api.nvim_create_user_command('SCInstall', function (args) vim.api.nvim_create_user_command('SCInstall', function (args)
vim.cmd("MasonInstall ltex-ls") vim.cmd("MasonInstall ltex-ls")
end, { desc = "Install spellcheck (requires Mason)." }) end, { desc = "Install spellcheck (requires Mason)." })