nvim: bindings and indent!
This commit is contained in:
parent
301dab336e
commit
781a076b6d
5 changed files with 116 additions and 101 deletions
|
@ -12,6 +12,7 @@ augroup recompile_plugins
|
||||||
autocmd BufWritePost plugins.lua call <SID>recompile_plugins()
|
autocmd BufWritePost plugins.lua call <SID>recompile_plugins()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||||
|
|
||||||
"" Temporary hacks
|
"" Temporary hacks
|
||||||
|
|
||||||
|
|
|
@ -95,18 +95,26 @@ lspconfig.sumneko_lua.setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local yaml_is_k8s = function(bufnr)
|
||||||
|
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, 50, false) -- Stop after the first 50 lines
|
||||||
|
for _, l in pairs(lines) do
|
||||||
|
if string.find(l, "apiVersion") ~= nil then return true end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
lspconfig.yamlls.setup {
|
lspconfig.yamlls.setup {
|
||||||
on_attach = on_attach,
|
|
||||||
settings = {
|
settings = {
|
||||||
yaml = {
|
yaml = {
|
||||||
format = {enable = true, singleQuote = true},
|
format = {enable = true, singleQuote = true},
|
||||||
schemaStore = {enable = true},
|
schemaStore = {enable = true},
|
||||||
schemas = {
|
schemas = {
|
||||||
["https://json.schemastore.org/github-workflow"] = "*.github/workflows/*",
|
-- ["https://json.schemastore.org/github-workflow"] = "*.github/workflows/*",
|
||||||
["https://json.schemastore.org/kustomization.json"] = "kustomization.yaml",
|
["https://json.schemastore.org/kustomization.json"] = "kustomization.yaml",
|
||||||
["https://json.schemastore.org/ansible-role-2.9.json"] = "*/tasks/*.y*ml",
|
-- ["https://json.schemastore.org/ansible-role-2.9.json"] = "*/tasks/*.y*ml",
|
||||||
["kubernetes" ] = "*.yaml",
|
-- kubernetes = "*.yaml",
|
||||||
},
|
},
|
||||||
|
|
||||||
validate = true
|
validate = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@ require("nvim-treesitter.configs").setup {
|
||||||
use_languagetree = true,
|
use_languagetree = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
indent = {
|
||||||
|
enable = false
|
||||||
|
},
|
||||||
|
|
||||||
playground = {
|
playground = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
vim.bo.undofile = true
|
vim.cmd[[set undofile]]
|
||||||
vim.cmd('set completeopt-=preview')
|
vim.cmd[[set completeopt-=preview]]
|
||||||
vim.cmd('set viewoptions-=options')
|
vim.cmd[[set viewoptions-=options]]
|
||||||
vim.g.mapleader = ','
|
vim.g.mapleader = ','
|
||||||
vim.o.clipboard = 'unnamed'
|
vim.o.clipboard = 'unnamed'
|
||||||
vim.o.hidden = true
|
vim.o.hidden = true
|
||||||
|
@ -13,7 +13,10 @@ vim.o.updatetime = 100
|
||||||
vim.o.autochdir = true
|
vim.o.autochdir = true
|
||||||
vim.o.backupdir = "/home/dln/.local/share/nvim/backup//"
|
vim.o.backupdir = "/home/dln/.local/share/nvim/backup//"
|
||||||
|
|
||||||
|
|
||||||
--- Indent
|
--- Indent
|
||||||
|
vim.bo.autoindent = true
|
||||||
|
vim.o.breakindent = true
|
||||||
vim.bo.expandtab = true
|
vim.bo.expandtab = true
|
||||||
vim.bo.smartindent = true
|
vim.bo.smartindent = true
|
||||||
vim.o.joinspaces = false
|
vim.o.joinspaces = false
|
||||||
|
@ -21,9 +24,9 @@ vim.o.listchars = 'extends:›,precedes:‹,nbsp:·,tab:→ ,trail:·'
|
||||||
vim.wo.foldlevel = 99
|
vim.wo.foldlevel = 99
|
||||||
vim.wo.linebreak = true
|
vim.wo.linebreak = true
|
||||||
vim.wo.list = true
|
vim.wo.list = true
|
||||||
vim.o.shiftwidth = 2
|
vim.o.shiftwidth = 4
|
||||||
vim.o.tabstop = 2
|
vim.o.tabstop = 4
|
||||||
vim.o.softtabstop = 2
|
vim.o.softtabstop = 4
|
||||||
|
|
||||||
--- Search
|
--- Search
|
||||||
vim.cmd('set path+=**')
|
vim.cmd('set path+=**')
|
||||||
|
@ -48,6 +51,7 @@ vim.o.sidescrolloff = 5
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
vim.wo.cursorline = true
|
vim.wo.cursorline = true
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
|
vim.wo.signcolumn = "yes"
|
||||||
vim.o.laststatus = 0
|
vim.o.laststatus = 0
|
||||||
|
|
||||||
--- Key mappings
|
--- Key mappings
|
||||||
|
@ -63,7 +67,6 @@ vim.g.netrw_dirhistmax = 0
|
||||||
require('plugins')
|
require('plugins')
|
||||||
|
|
||||||
|
|
||||||
-- local border = { '╭', '─' ,'╮', '│', '╯', '─', '╰', '│' }
|
|
||||||
local border = { '🭽', '▔' ,'🭾', '▕', '🭿', '▂', '🭼', '▏' }
|
local border = { '🭽', '▔' ,'🭾', '▕', '🭿', '▂', '🭼', '▏' }
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/hover"] =
|
vim.lsp.handlers["textDocument/hover"] =
|
||||||
|
|
|
@ -42,7 +42,7 @@ return require('packer').startup(function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
utils.mapx("is", "<C-space>", "v:lua.complete('<C-n>', '<Tab>')")
|
utils.mapx("is", "<C-Space>", "v:lua.complete('<C-n>', '<Tab>')")
|
||||||
utils.mapx("is", "<Tab>", "v:lua.complete('<C-n>', '<Tab>')")
|
utils.mapx("is", "<Tab>", "v:lua.complete('<C-n>', '<Tab>')")
|
||||||
utils.mapx("is", "<S-Tab>", "v:lua.complete('<C-p>', '<C-h>')")
|
utils.mapx("is", "<S-Tab>", "v:lua.complete('<C-p>', '<C-h>')")
|
||||||
utils.mapx("x", "<CR>", "compe:#confirm('<CR')")
|
utils.mapx("x", "<CR>", "compe:#confirm('<CR')")
|
||||||
|
@ -83,7 +83,7 @@ return require('packer').startup(function()
|
||||||
-- vim.g.indent_blankline_show_end_of_line = true
|
-- vim.g.indent_blankline_show_end_of_line = true
|
||||||
vim.g.indent_blankline_show_first_indent_level = true
|
vim.g.indent_blankline_show_first_indent_level = true
|
||||||
vim.g.indent_blankline_show_trailing_blankline_indent = true
|
vim.g.indent_blankline_show_trailing_blankline_indent = true
|
||||||
vim.g.indent_blankline_char_highlight_list = { 'Indent1', 'Indent2', 'Indent3', 'Indent4'}
|
vim.g.indent_blankline_char_highlight_list = { 'Indent1', 'Indent2', 'Indent3', 'Indent4', 'Indent5', 'Indent6'}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,9 +99,9 @@ return require('packer').startup(function()
|
||||||
map('n', 'rn', '<Cmd>lua vim.lsp.buf.rename()<CR>')
|
map('n', 'rn', '<Cmd>lua vim.lsp.buf.rename()<CR>')
|
||||||
map('n', '[d', '<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>')
|
map('n', '[d', '<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>')
|
||||||
map('n', ']d', '<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>')
|
map('n', ']d', '<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>')
|
||||||
map('n', 'wa', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
map('n', 'gwa', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||||
map('n', 'wr', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
map('n', 'gwr', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||||
map('n', 'wl', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
map('n', 'gwl', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue