Add bashls and format using formatter built into lua lsp

This commit is contained in:
Fabian Schmidt 2022-10-18 17:42:03 +02:00
parent a8818ea92a
commit fe9da6af57
8 changed files with 84 additions and 80 deletions

View File

@ -1,6 +1,6 @@
-- init.lua
require'plugins'
require'settings'.init()
require'maps'.init()
require'commands'
require('plugins')
require('settings').init()
require('maps').init()
require('commands')

View File

@ -3,18 +3,18 @@
local maps = {}
local function map(mode, lhs, rhs, opts)
local options = {noremap = true}
local options = { noremap = true }
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
function maps.toggleGoyo()
map('n', '<C-g>', ':Goyo<Enter>', {noremap = false})
map('n', '<C-g>', ':Goyo<Enter>', { noremap = false })
end
function maps.term()
-- Open and move to resized terminal
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', {noremap = false})
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', { noremap = false })
-- Enter normal mode in terminal
map('t', 'ß<C-N>', '<C-\\><C-N>')
end
@ -33,8 +33,8 @@ end
function maps.moveByRow()
-- When text is wrapped, move by terminal rows, not lines, unles a count is provided
map('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'', {silent = true, expr = true})
map('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'', {silent = true, expr = true})
map('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'', { silent = true, expr = true })
map('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'', { silent = true, expr = true })
end
function maps.centeredSearch()

View File

@ -1,7 +1,7 @@
-- plugin.lua
require "paq" {
require 'paq' {
-- Handle itself
'savq/paq-nvim';

View File

@ -1,8 +1,8 @@
-- Completion
local completion = {}
local cmp = require'cmp'
local lspkind = require'lspkind'
local cmp = require('cmp')
local lspkind = require('lspkind')
vim.opt.shortmess:append 'c'

View File

@ -32,16 +32,16 @@ function settings.initMisc()
end
function settings.initVimWiki()
vim.g.vimwiki_list = {{path = '~/Documents/Buch/wiki', syntax = 'markdown', ext = '.md'}}
vim.g.vimwiki_list = { { path = '~/Documents/Buch/wiki', syntax = 'markdown', ext = '.md' } }
end
function settings.init()
settings.initMisc()
settings.initVimWiki()
require'settings.theme'.init()
require'settings.lsp'.init()
require'settings.completion'
require'settings.tree'
require('settings.theme').init()
require('settings.lsp').init()
require('settings.completion')
require('settings.tree')
end
return settings

View File

@ -7,7 +7,7 @@ local lsp_attach = function(client, buf)
vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc")
vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc")
local bufopts = { noremap=true, silent=true, buffer=buf }
local bufopts = { noremap = true, silent = true, buffer = buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
@ -20,11 +20,11 @@ local lsp_attach = function(client, buf)
end
function lsp.init()
require'mason'.setup()
require'mason-lspconfig'.setup()
require('mason').setup()
require('mason-lspconfig').setup()
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
local lspconfig = require'lspconfig'
local lspconfig = require('lspconfig')
lspconfig.sumneko_lua.setup {
capabilities = capabilities,
@ -56,6 +56,10 @@ function lsp.init()
standalone = false
}
})
lspconfig.bashls.setup {
capabilities = capabilities,
on_attach = lsp_attach
}
end
return lsp

View File

@ -7,11 +7,11 @@ function theme.initFont()
end
function theme.lsp_status()
require'fidget'.setup {}
require('fidget').setup {}
end
function theme.initStatusline()
require'lualine'.setup {
require('lualine').setup {
options = {
theme = 'onedark'
}
@ -19,14 +19,14 @@ function theme.initStatusline()
end
function theme.initBufferline()
local bufferline = require'bufferline'
local bufferline = require 'bufferline'
bufferline.setup()
end
function theme.initColorscheme()
vim.g.limelight_conceal_ctermfg = 'gray'
vim.cmd'colorscheme darcula-solid'
vim.cmd'set termguicolors'
vim.cmd 'colorscheme darcula-solid'
vim.cmd 'set termguicolors'
vim.opt.syntax = 'on'
end

View File

@ -2,7 +2,7 @@
local tree = {}
require'nvim-tree'.setup {
require('nvim-tree').setup {
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,