1
0
Fork 0

nvim: remove unneeded brackets

This commit is contained in:
tastytea 2022-08-12 14:05:53 +02:00
parent 540a03eef6
commit 6084378826
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
5 changed files with 18 additions and 18 deletions

View File

@ -9,7 +9,7 @@ packer.use {
'https://github.com/hrsh7th/nvim-cmp',
config = function()
local cmp = require'cmp'
if (cmp == nil) then
if cmp == nil then
return
end
cmp.setup({

View File

@ -20,12 +20,12 @@ vim.api.nvim_create_autocmd(
function my_insert_modeline()
local comment_string = vim.o.commentstring
local space_maybe = ''
if (string.match(comment_string, '%%s(.*)') ~= '') then
if string.match(comment_string, '%%s(.*)') ~= '' then
space_maybe = ' '
end
local fenc = vim.o.fileencoding
if (fenc == '') then
if fenc == '' then
fenc = 'utf-8'
end
@ -44,9 +44,9 @@ function my_insert_modeline()
local buffer = vim.api.nvim_win_get_buf(0)
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')
elseif (string.match(current, 'vim:')) then
elseif string.match(current, 'vim:') then
vim.api.nvim_buf_set_lines(buffer, -2, -1, true, { modeline })
print('modeline updated')
else

View File

@ -37,12 +37,12 @@ map({ 'n', 'i' }, '<C-S-Del>',
local line = vim.api.nvim_get_current_line()
local pos_start, pos_end = 0, 0
while (pos_start ~= nil) do
if (pos_start <= pos_cursor and pos_end >= pos_cursor) then
while pos_start ~= nil do
if pos_start <= pos_cursor and pos_end >= pos_cursor then
local before = line:sub(1, pos_start - 1)
local after = line:sub(pos_end + 1)
local space = ''
if (before:len() > 0 and after:len() > 0) then
if before:len() > 0 and after:len() > 0 then
space = ' '
end
vim.api.nvim_set_current_line(before .. space .. after)
@ -62,7 +62,7 @@ map('n', '<Leader>p', '"+p')
map({ 'n', 'i', 'v' }, '<Home>',
function()
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()
vim.api.nvim_win_set_cursor(0, { row, col_new })
else

View File

@ -66,7 +66,7 @@ packer.use {
vim.lsp.protocol.make_client_capabilities())
-- setup servers
if (vim.fn.executable('clangd') > 0) then
if vim.fn.executable('clangd') > 0 then
require'lspconfig'.clangd.setup{
cmd = {
'clangd',
@ -79,7 +79,7 @@ packer.use {
}
end
if (vim.fn.executable('lua-language-server') > 0) then
if vim.fn.executable('lua-language-server' > 0) then
require'lspconfig'.sumneko_lua.setup {
settings = {
Lua = {
@ -102,7 +102,7 @@ packer.use {
}
end
if (vim.fn.executable('pylsp') > 0) then
if vim.fn.executable('pylsp') > 0 then
require'lspconfig'.pylsp.setup{
settings = {
pylsp = {
@ -113,7 +113,7 @@ packer.use {
}
end
if (vim.fn.executable('lemminx') > 0) then
if vim.fn.executable('lemminx') > 0 then
require'lspconfig'.lemminx.setup{
filetypes = {
'xml', 'xsd', 'xsl', 'xslt', 'svg', 'gentoo-metadata'
@ -123,28 +123,28 @@ packer.use {
}
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{
on_attach = on_attach,
capabilities = capabilities
}
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{
on_attach = on_attach,
capabilities = capabilities
}
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{
on_attach = on_attach,
capabilities = capabilities
}
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{
on_attach = on_attach,
capabilities = capabilities

View File

@ -19,7 +19,7 @@ vim.api.nvim_create_autocmd(
pattern = { '*/nvim/lua/*.lua', '*/nvim/init.lua' },
callback = function()
-- 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([[
source <afile>
PackerInstall