Change indentation size to 2 for Lua

This commit is contained in:
Sam A. 2023-05-11 02:27:50 +02:00
parent 01c2ad0ef5
commit abfbcdb504
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -1,34 +1,34 @@
-- plugins -- plugins
require('packer').startup(function(use) require('packer').startup(function(use)
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
use 'ii14/onedark.nvim' use 'ii14/onedark.nvim'
use { use {
'mengelbrecht/lightline-bufferline', 'mengelbrecht/lightline-bufferline',
requires = { requires = {
'itchyny/lightline.vim' 'itchyny/lightline.vim'
}
} }
use 'kyazdani42/nvim-web-devicons' }
use 'sheerun/vim-polyglot' use 'kyazdani42/nvim-web-devicons'
use 'editorconfig/editorconfig-vim' use 'sheerun/vim-polyglot'
use { use 'editorconfig/editorconfig-vim'
'williamboman/mason-lspconfig.nvim', use {
requires = { 'williamboman/mason-lspconfig.nvim',
{ requires = {
'williamboman/mason.nvim', {
run = ':MasonUpdate' 'williamboman/mason.nvim',
}, run = ':MasonUpdate'
'neovim/nvim-lspconfig' },
} 'neovim/nvim-lspconfig'
} }
use { }
'hrsh7th/nvim-cmp', use {
requires = { 'hrsh7th/nvim-cmp',
'hrsh7th/cmp-nvim-lsp', requires = {
'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lsp',
'L3MON4D3/LuaSnip' 'saadparwaiz1/cmp_luasnip',
} 'L3MON4D3/LuaSnip'
} }
}
end) end)
-- basics -- basics
@ -46,17 +46,17 @@ vim.cmd.colorscheme('onedark')
-- settings for specific filetypes -- settings for specific filetypes
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
pattern = { 'html', 'css', 'scss', 'json', 'yaml', 'yaml.*' }, pattern = { 'html', 'css', 'scss', 'lua', 'json', 'yaml', 'yaml.*' },
callback = function() callback = function()
vim.opt_local.tabstop = 2 vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2 vim.opt_local.shiftwidth = 2
end end
}) })
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, { vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
pattern = { 'zsh*', '.zsh*', '*.zsh' }, pattern = { 'zsh*', '.zsh*', '*.zsh' },
callback = function() callback = function()
vim.opt.filetype = 'sh' vim.opt.filetype = 'sh'
end end
}) })
-- appearance -- appearance
@ -65,17 +65,17 @@ vim.g.background = 'dark'
-- lightline config -- lightline config
vim.g.lightline = { vim.g.lightline = {
colorscheme = 'one', colorscheme = 'one',
tabline = { tabline = {
left = { { 'buffers' } }, left = { { 'buffers' } },
right = { { 'close' } } right = { { 'close' } }
}, },
component_expand = { component_expand = {
buffers = 'lightline#bufferline#buffers' buffers = 'lightline#bufferline#buffers'
}, },
component_type = { component_type = {
buffers = 'tabsel' buffers = 'tabsel'
} }
} }
-- lightline-bufferline config -- lightline-bufferline config
@ -93,127 +93,127 @@ local luasnip = require('luasnip')
luasnip.config.setup {} luasnip.config.setup {}
cmp.setup { cmp.setup {
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
end end
}, },
mapping = { mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4), ['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(), ['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm { ['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}, },
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
} }
cmp.setup.cmdline('/', { cmp.setup.cmdline('/', {
sources = { sources = {
{ name = 'buffer' } { name = 'buffer' }
} }
}) })
cmp.setup.cmdline(':', { cmp.setup.cmdline(':', {
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'path' } { name = 'path' }
}, },
{ {
{ name = 'cmdline' } { name = 'cmdline' }
}) })
}) })
-- lsp config -- lsp config
require('mason').setup {} require('mason').setup {}
require('mason-lspconfig').setup { require('mason-lspconfig').setup {
automatic_installation = true automatic_installation = true
} }
local lsp = require('lspconfig') local lsp = require('lspconfig')
local capabilities = require('cmp_nvim_lsp').default_capabilities() local capabilities = require('cmp_nvim_lsp').default_capabilities()
lsp.ansiblels.setup { lsp.ansiblels.setup {
capabilities = capabilities capabilities = capabilities
} }
lsp.bashls.setup { lsp.bashls.setup {
capabilities = capabilities capabilities = capabilities
} }
lsp.clangd.setup { lsp.clangd.setup {
capabilities = capabilities capabilities = capabilities
} }
lsp.dockerls.setup { lsp.dockerls.setup {
capabilities = capabilities capabilities = capabilities
} }
lsp.gopls.setup { lsp.gopls.setup {
capabilities = capabilities capabilities = capabilities
} }
lsp.lua_ls.setup { lsp.lua_ls.setup {
capabilities = capabilities, capabilities = capabilities,
settings = { settings = {
Lua = { Lua = {
runtime = { runtime = {
version = 'LuaJIT' version = 'LuaJIT'
}, },
diagnostics = { diagnostics = {
globals = { 'vim' } globals = { 'vim' }
}, },
workspace = { workspace = {
library = vim.api.nvim_get_runtime_file('', true), library = vim.api.nvim_get_runtime_file('', true),
checkThirdParty = false checkThirdParty = false
}, },
telemetry = { telemetry = {
enable = false enable = false
} }
}
} }
}
} }
lsp.pylsp.setup { lsp.pylsp.setup {
capabilities = capabilities capabilities = capabilities
} }
lsp.vimls.setup { lsp.vimls.setup {
capabilities = capabilities, capabilities = capabilities,
init_options = { init_options = {
diagnostic = { diagnostic = {
enable = false enable = false
}, },
isNeovim = true isNeovim = true
} }
} }
lsp.yamlls.setup { lsp.yamlls.setup {
capabilities = capabilities, capabilities = capabilities,
settings = { settings = {
redhat = { redhat = {
telemetry = { telemetry = {
enabled = false enabled = false
} }
}, },
yaml = { yaml = {
keyOrdering = false keyOrdering = false
}
} }
}
} }
-- keyboard mappings -- keyboard mappings