nvim: remove unneeded brackets
This commit is contained in:
parent
540a03eef6
commit
6084378826
|
@ -9,7 +9,7 @@ packer.use {
|
||||||
'https://github.com/hrsh7th/nvim-cmp',
|
'https://github.com/hrsh7th/nvim-cmp',
|
||||||
config = function()
|
config = function()
|
||||||
local cmp = require'cmp'
|
local cmp = require'cmp'
|
||||||
if (cmp == nil) then
|
if cmp == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
|
|
|
@ -20,12 +20,12 @@ vim.api.nvim_create_autocmd(
|
||||||
function my_insert_modeline()
|
function my_insert_modeline()
|
||||||
local comment_string = vim.o.commentstring
|
local comment_string = vim.o.commentstring
|
||||||
local space_maybe = ''
|
local space_maybe = ''
|
||||||
if (string.match(comment_string, '%%s(.*)') ~= '') then
|
if string.match(comment_string, '%%s(.*)') ~= '' then
|
||||||
space_maybe = ' '
|
space_maybe = ' '
|
||||||
end
|
end
|
||||||
|
|
||||||
local fenc = vim.o.fileencoding
|
local fenc = vim.o.fileencoding
|
||||||
if (fenc == '') then
|
if fenc == '' then
|
||||||
fenc = 'utf-8'
|
fenc = 'utf-8'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,9 +44,9 @@ function my_insert_modeline()
|
||||||
|
|
||||||
local buffer = vim.api.nvim_win_get_buf(0)
|
local buffer = vim.api.nvim_win_get_buf(0)
|
||||||
local current = vim.api.nvim_buf_get_lines(buffer, -2, -1, true)[1]
|
local current = vim.api.nvim_buf_get_lines(buffer, -2, -1, true)[1]
|
||||||
if (current == modeline) then
|
if current == modeline then
|
||||||
print('modeline already exists')
|
print('modeline already exists')
|
||||||
elseif (string.match(current, 'vim:')) then
|
elseif string.match(current, 'vim:') then
|
||||||
vim.api.nvim_buf_set_lines(buffer, -2, -1, true, { modeline })
|
vim.api.nvim_buf_set_lines(buffer, -2, -1, true, { modeline })
|
||||||
print('modeline updated')
|
print('modeline updated')
|
||||||
else
|
else
|
||||||
|
|
|
@ -37,12 +37,12 @@ map({ 'n', 'i' }, '<C-S-Del>',
|
||||||
local line = vim.api.nvim_get_current_line()
|
local line = vim.api.nvim_get_current_line()
|
||||||
local pos_start, pos_end = 0, 0
|
local pos_start, pos_end = 0, 0
|
||||||
|
|
||||||
while (pos_start ~= nil) do
|
while pos_start ~= nil do
|
||||||
if (pos_start <= pos_cursor and pos_end >= pos_cursor) then
|
if pos_start <= pos_cursor and pos_end >= pos_cursor then
|
||||||
local before = line:sub(1, pos_start - 1)
|
local before = line:sub(1, pos_start - 1)
|
||||||
local after = line:sub(pos_end + 1)
|
local after = line:sub(pos_end + 1)
|
||||||
local space = ''
|
local space = ''
|
||||||
if (before:len() > 0 and after:len() > 0) then
|
if before:len() > 0 and after:len() > 0 then
|
||||||
space = ' '
|
space = ' '
|
||||||
end
|
end
|
||||||
vim.api.nvim_set_current_line(before .. space .. after)
|
vim.api.nvim_set_current_line(before .. space .. after)
|
||||||
|
@ -62,7 +62,7 @@ map('n', '<Leader>p', '"+p')
|
||||||
map({ 'n', 'i', 'v' }, '<Home>',
|
map({ 'n', 'i', 'v' }, '<Home>',
|
||||||
function()
|
function()
|
||||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
if (col == 0) then
|
if col == 0 then
|
||||||
local col_new = vim.api.nvim_get_current_line():match('^%s*'):len()
|
local col_new = vim.api.nvim_get_current_line():match('^%s*'):len()
|
||||||
vim.api.nvim_win_set_cursor(0, { row, col_new })
|
vim.api.nvim_win_set_cursor(0, { row, col_new })
|
||||||
else
|
else
|
||||||
|
|
|
@ -66,7 +66,7 @@ packer.use {
|
||||||
vim.lsp.protocol.make_client_capabilities())
|
vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
-- setup servers
|
-- setup servers
|
||||||
if (vim.fn.executable('clangd') > 0) then
|
if vim.fn.executable('clangd') > 0 then
|
||||||
require'lspconfig'.clangd.setup{
|
require'lspconfig'.clangd.setup{
|
||||||
cmd = {
|
cmd = {
|
||||||
'clangd',
|
'clangd',
|
||||||
|
@ -79,7 +79,7 @@ packer.use {
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if (vim.fn.executable('lua-language-server') > 0) then
|
if vim.fn.executable('lua-language-server' > 0) then
|
||||||
require'lspconfig'.sumneko_lua.setup {
|
require'lspconfig'.sumneko_lua.setup {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
|
@ -102,7 +102,7 @@ packer.use {
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if (vim.fn.executable('pylsp') > 0) then
|
if vim.fn.executable('pylsp') > 0 then
|
||||||
require'lspconfig'.pylsp.setup{
|
require'lspconfig'.pylsp.setup{
|
||||||
settings = {
|
settings = {
|
||||||
pylsp = {
|
pylsp = {
|
||||||
|
@ -113,7 +113,7 @@ packer.use {
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if (vim.fn.executable('lemminx') > 0) then
|
if vim.fn.executable('lemminx') > 0 then
|
||||||
require'lspconfig'.lemminx.setup{
|
require'lspconfig'.lemminx.setup{
|
||||||
filetypes = {
|
filetypes = {
|
||||||
'xml', 'xsd', 'xsl', 'xslt', 'svg', 'gentoo-metadata'
|
'xml', 'xsd', 'xsl', 'xslt', 'svg', 'gentoo-metadata'
|
||||||
|
@ -123,28 +123,28 @@ packer.use {
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if (vim.fn.executable('vscode-html-language-server') > 0) then
|
if vim.fn.executable('vscode-html-language-server') > 0 then
|
||||||
require'lspconfig'.html.setup{
|
require'lspconfig'.html.setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if (vim.fn.executable('vscode-css-language-server') > 0) then
|
if vim.fn.executable('vscode-css-language-server') > 0 then
|
||||||
require'lspconfig'.cssls.setup{
|
require'lspconfig'.cssls.setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if (vim.fn.executable('vscode-eslint-language-server') > 0) then
|
if vim.fn.executable('vscode-eslint-language-server') > 0 then
|
||||||
require'lspconfig'.eslint.setup{
|
require'lspconfig'.eslint.setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if (vim.fn.executable('vscode-json-language-server') > 0) then
|
if vim.fn.executable('vscode-json-language-server') > 0 then
|
||||||
require'lspconfig'.jsonls.setup{
|
require'lspconfig'.jsonls.setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
|
|
|
@ -19,7 +19,7 @@ vim.api.nvim_create_autocmd(
|
||||||
pattern = { '*/nvim/lua/*.lua', '*/nvim/init.lua' },
|
pattern = { '*/nvim/lua/*.lua', '*/nvim/init.lua' },
|
||||||
callback = function()
|
callback = function()
|
||||||
-- exclude plugins.lua, because that would re-init packer
|
-- exclude plugins.lua, because that would re-init packer
|
||||||
if (not vim.api.nvim_buf_get_name(0):match('plugins.lua$')) then
|
if not vim.api.nvim_buf_get_name(0):match('plugins.lua$') then
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
source <afile>
|
source <afile>
|
||||||
PackerInstall
|
PackerInstall
|
||||||
|
|
Loading…
Reference in New Issue
Block a user