This commit is contained in:
parent
7e5d880156
commit
d93f63cf82
40 changed files with 448 additions and 649 deletions
36
.config/nvim/lua/config/filetypes.lua
Normal file
36
.config/nvim/lua/config/filetypes.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
local function has_ansible_root(path, recursive)
|
||||
if not recursive then
|
||||
return vim.uv.fs_stat(
|
||||
vim.fs.joinpath(vim.fs.dirname(path), 'ansible.cfg')
|
||||
)
|
||||
end
|
||||
|
||||
return vim.fs.find('ansible.cfg', {
|
||||
path = vim.fs.dirname(path),
|
||||
upward = true,
|
||||
limit = 1
|
||||
})[1]
|
||||
end
|
||||
|
||||
local function yaml_filetype(recursive, p2)
|
||||
return function (path)
|
||||
print(p2)
|
||||
if has_ansible_root(path, recursive) then
|
||||
return "yaml.ansible"
|
||||
else
|
||||
return "yaml"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
['yaml'] = yaml_filetype(false),
|
||||
['yml'] = yaml_filetype(false),
|
||||
},
|
||||
pattern = {
|
||||
[".*/roles/.*/tasks/.*%.ya?ml"] = yaml_filetype(true),
|
||||
[".*/roles/.*/handlers/.*%.ya?ml"] = yaml_filetype(true),
|
||||
[".*/playbooks/.*%.ya?ml"] = yaml_filetype(true),
|
||||
},
|
||||
})
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
require("config.mappings")
|
||||
require("config.options")
|
||||
require("config.mappings")
|
||||
require("config.autocmd")
|
||||
require("config.filetypes")
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ map({ 'n', 'v' }, 'j', 'v:count == 0 ? "gj" : "j"', { expr = true, silent = true
|
|||
|
||||
-- Copy and paste from clipboard
|
||||
map({ 'n', 'v' }, '<leader>y', '"+y')
|
||||
map({ 'n', 'v' }, '<leader>Y', '"+Y')
|
||||
map({ 'n', 'v' }, '<leader>Y', '"+y$')
|
||||
map({ 'n', 'v' }, '<leader>p', '"+p<ESC>')
|
||||
map({ 'n', 'v' }, '<leader>P', '"+P<ESC>')
|
||||
|
||||
|
|
@ -49,3 +49,8 @@ map('i', '<M-BS>', '<C-w>')
|
|||
-- Move lines quickly
|
||||
map('n', '<C-M-k>', ':m-2<CR>', { silent = true })
|
||||
map('n', '<C-M-j>', ':m+1<CR>', { silent = true })
|
||||
|
||||
map('n', '<Leader>dt', ':diffthis<CR>', { silent = true })
|
||||
map('n', '<Leader>do', ':diffoff<CR>', { silent = true })
|
||||
|
||||
map('n', '<Leader>lr', ':LspR<CR>')
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ local servers = {
|
|||
yamlls = require('lsp.yamlls'),
|
||||
}
|
||||
|
||||
vim.lsp.set_log_level('info')
|
||||
-- vim.lsp.set_log_level('info')
|
||||
|
||||
local on_attach = function(_, bufnr)
|
||||
local nmap = function(keys, func)
|
||||
|
|
@ -33,6 +33,10 @@ local on_attach = function(_, bufnr)
|
|||
nmap('gr', require('telescope.builtin').lsp_references)
|
||||
nmap('gt', require('telescope.builtin').lsp_type_definitions)
|
||||
|
||||
-- nmap('gd', vim.lsp.buf.definition)
|
||||
-- nmap('gr', vim.lsp.buf.references)
|
||||
-- nmap('gt', vim.lsp.buf.type_definition)
|
||||
|
||||
nmap('<leader>sd', require('telescope.builtin').diagnostics)
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols)
|
||||
nmap('<leader>as', require('telescope.builtin').lsp_dynamic_workspace_symbols)
|
||||
|
|
@ -42,17 +46,22 @@ local on_attach = function(_, bufnr)
|
|||
nmap('<C-k>', vim.lsp.buf.signature_help)
|
||||
|
||||
nmap('gI', require('telescope.builtin').lsp_implementations)
|
||||
-- nmap('gI', vim.lsp.buf.implementation)
|
||||
nmap('gD', vim.lsp.buf.declaration)
|
||||
|
||||
nmap('<leader>F', vim.lsp.buf.format)
|
||||
end
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lspconfig = require('lspconfig')
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true
|
||||
}
|
||||
|
||||
for server_name, config in pairs(servers) do
|
||||
lspconfig[server_name].setup(vim.tbl_deep_extend('keep', {
|
||||
vim.lsp.config(server_name, vim.tbl_deep_extend('keep', {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
}, config))
|
||||
vim.lsp.enable(server_name)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
return {
|
||||
'Winseven4lyf/vim-bbcode',
|
||||
'isobit/vim-caddyfile',
|
||||
'junegunn/vim-peekaboo',
|
||||
'nfnty/vim-nftables',
|
||||
'rcarriga/nvim-notify',
|
||||
'stefandtw/quickfix-reflector.vim',
|
||||
'nfnty/vim-nftables',
|
||||
'tpope/vim-fugitive',
|
||||
'junegunn/vim-peekaboo',
|
||||
'tpope/vim-sleuth',
|
||||
'vim-scripts/iptables',
|
||||
{ 'akinsho/bufferline.nvim', opts = {}, dependencies = { 'navarasu/onedark.nvim' } },
|
||||
|
|
@ -13,36 +14,7 @@ return {
|
|||
{ 'kylechui/nvim-surround', version = '*', event = 'VeryLazy', opts = {} },
|
||||
{ 'lukas-reineke/indent-blankline.nvim', main = 'ibl', opts = {} },
|
||||
{ 'norcalli/nvim-colorizer.lua', opts={ '*' }, dependencies = { 'navarasu/onedark.nvim' } },
|
||||
-- { 'wakatime/vim-wakatime', event = 'VeryLazy' },
|
||||
{ 'wakatime/vim-wakatime', event = 'VeryLazy' },
|
||||
{ 'williamboman/mason.nvim', opts = {} },
|
||||
'Winseven4lyf/vim-bbcode',
|
||||
|
||||
|
||||
{ 'mrsobakin/multilayout.nvim' , opts = {
|
||||
layouts = {
|
||||
ru = {
|
||||
-- Names of this layout, as `libukb` reports.
|
||||
names = { "Russian" },
|
||||
from = [[ёйцукенгшщзхъфывапролджэячсмитьбю.Ё"№;:?ЙЦУКЕНГШЩЗХЪ/ФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,]],
|
||||
to = [[`qwertyuiop[]asdfghjkl;'zxcvbnm,./~@#$^&QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?]],
|
||||
}
|
||||
},
|
||||
aliases = {
|
||||
-- Maximum length of default commands aliases.
|
||||
-- Increasing this value leads to longer startup times.
|
||||
max_length = 2,
|
||||
-- Extra commands that you want to alias.
|
||||
-- They are aliased regardless of `max_length`.
|
||||
extra = { "sort" },
|
||||
},
|
||||
-- Whether to use `libukb`. If this is set to false, `langmap`
|
||||
-- won't automatically switch when your layout does.
|
||||
use_libukb = true,
|
||||
-- Path to the `libukb.so`. If `nil`, ukb will be automatically
|
||||
-- downloaded, builded and installed in the neovim data directory.
|
||||
libukb_path = nil,
|
||||
-- Function of type `callback(layout: string)`. Called whenever
|
||||
-- current keyboard layout changes.
|
||||
callback = nil,
|
||||
}}
|
||||
{ dir = '~/.local/share/nvim/preseed/' }, -- 'https://git.netizen.se/vim-preseed',
|
||||
}
|
||||
|
|
|
|||
30
.config/nvim/lua/plugins/multilayout.lua
Normal file
30
.config/nvim/lua/plugins/multilayout.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
return {
|
||||
'mrsobakin/multilayout.nvim',
|
||||
opts = {
|
||||
layouts = {
|
||||
ru = {
|
||||
-- Names of this layout, as `libukb` reports.
|
||||
names = { "Russian" },
|
||||
from = [[ёйцукенгшщзхъфывапролджэячсмитьбю.Ё"№;:?ЙЦУКЕНГШЩЗХЪ/ФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,]],
|
||||
to = [[`qwertyuiop[]asdfghjkl;'zxcvbnm,./~@#$^&QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?]],
|
||||
}
|
||||
},
|
||||
aliases = {
|
||||
-- Maximum length of default commands aliases.
|
||||
-- Increasing this value leads to longer startup times.
|
||||
max_length = 2,
|
||||
-- Extra commands that you want to alias.
|
||||
-- They are aliased regardless of `max_length`.
|
||||
extra = { "sort" },
|
||||
},
|
||||
-- Whether to use `libukb`. If this is set to false, `langmap`
|
||||
-- won't automatically switch when your layout does.
|
||||
use_libukb = true,
|
||||
-- Path to the `libukb.so`. If `nil`, ukb will be automatically
|
||||
-- downloaded, builded and installed in the neovim data directory.
|
||||
libukb_path = nil,
|
||||
-- Function of type `callback(layout: string)`. Called whenever
|
||||
-- current keyboard layout changes.
|
||||
callback = nil,
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ return {
|
|||
|
||||
config = function()
|
||||
local actions = require('telescope.actions')
|
||||
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
|
|
@ -18,8 +19,12 @@ return {
|
|||
['<C-d>'] = false,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
-- ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
["<C-b>"] = require("trouble.sources.telescope").open
|
||||
},
|
||||
n = {
|
||||
["<C-q>"] = require("trouble.sources.telescope").open
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -34,11 +39,17 @@ return {
|
|||
})
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').live_grep)
|
||||
vim.keymap.set('n', '<leader>wf', require('telescope.builtin').grep_string)
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').live_grep)
|
||||
vim.keymap.set('n', '<leader>wf', require('telescope.builtin').grep_string)
|
||||
vim.keymap.set('n', '<leader>of', require('telescope.builtin').oldfiles)
|
||||
vim.keymap.set('n', '<leader>af', require('telescope.builtin').git_files)
|
||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files)
|
||||
vim.keymap.set('n', '<leader>.', require('telescope').extensions.emoji.emoji)
|
||||
|
||||
|
||||
-- Use this to add more results without clearing the trouble list
|
||||
-- local add_to_trouble = require("trouble.sources.telescope").add
|
||||
|
||||
local telescope = require("telescope")
|
||||
end
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,6 @@ return {
|
|||
}
|
||||
vim.o.termguicolors = true
|
||||
vim.cmd.colorscheme 'onedark'
|
||||
vim.cmd.hi 'clear @spell'
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,23 @@
|
|||
return {
|
||||
-- 'kevinhwang91/nvim-ufo',
|
||||
-- dependencies = {
|
||||
-- 'kevinhwang91/promise-async'
|
||||
-- },
|
||||
-- config = function()
|
||||
-- vim.defer_fn(function()
|
||||
-- vim.o.foldcolumn = '0'
|
||||
-- vim.o.foldlevel = 99
|
||||
-- vim.o.foldlevelstart = 99
|
||||
-- vim.o.foldenable = true
|
||||
--
|
||||
-- vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
||||
-- vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
|
||||
--
|
||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
-- capabilities.textDocument.foldingRange = {
|
||||
-- dynamicRegistration = false,
|
||||
-- lineFoldingOnly = true
|
||||
-- }
|
||||
-- local language_servers = vim.lsp.get_clients()
|
||||
-- for _, ls in ipairs(language_servers) do
|
||||
-- require('lspconfig')[ls].setup({
|
||||
-- capabilities = capabilities
|
||||
-- })
|
||||
-- end
|
||||
-- require('ufo').setup()
|
||||
-- end, 0)
|
||||
-- end
|
||||
'kevinhwang91/nvim-ufo',
|
||||
dependencies = {
|
||||
'kevinhwang91/promise-async'
|
||||
},
|
||||
config = function()
|
||||
vim.defer_fn(function()
|
||||
vim.o.foldcolumn = '0'
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
|
||||
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
||||
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
|
||||
|
||||
require('ufo').setup({
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return {'treesitter', 'indent'}
|
||||
end
|
||||
})
|
||||
end, 0)
|
||||
end
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue