mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-07-24 04:34:42 +02:00
lua formatting
This commit is contained in:
parent
b29ef8fa58
commit
5f482b6054
8 changed files with 68 additions and 42 deletions
|
@ -6,10 +6,11 @@ require"lspconfig".efm.setup {
|
||||||
languages = {
|
languages = {
|
||||||
lua = {
|
lua = {
|
||||||
{
|
{
|
||||||
formatCommand = "lua-format -i --no-keep-simple-function-one-line --no-break-after-operator --column-limit=150 --break-after-table-lb",
|
formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=100",
|
||||||
formatStdin = true
|
formatStdin = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,24 @@
|
||||||
--TODO figure out why this don't work
|
-- TODO figure out why this don't work
|
||||||
vim.fn.sign_define("LspDiagnosticsSignError", {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"})
|
vim.fn.sign_define("LspDiagnosticsSignError", {
|
||||||
vim.fn.sign_define("LspDiagnosticsSignWarning", {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"})
|
texthl = "LspDiagnosticsSignError",
|
||||||
vim.fn.sign_define("LspDiagnosticsSignInformation", {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"})
|
text = "",
|
||||||
vim.fn.sign_define("LspDiagnosticsSignHint", {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"})
|
numhl = "LspDiagnosticsSignError"
|
||||||
|
})
|
||||||
|
vim.fn.sign_define("LspDiagnosticsSignWarning", {
|
||||||
|
texthl = "LspDiagnosticsSignWarning",
|
||||||
|
text = "",
|
||||||
|
numhl = "LspDiagnosticsSignWarning"
|
||||||
|
})
|
||||||
|
vim.fn.sign_define("LspDiagnosticsSignInformation", {
|
||||||
|
texthl = "LspDiagnosticsSignInformation",
|
||||||
|
text = "",
|
||||||
|
numhl = "LspDiagnosticsSignInformation"
|
||||||
|
})
|
||||||
|
vim.fn.sign_define("LspDiagnosticsSignHint", {
|
||||||
|
texthl = "LspDiagnosticsSignHint",
|
||||||
|
text = "",
|
||||||
|
numhl = "LspDiagnosticsSignHint"
|
||||||
|
})
|
||||||
|
|
||||||
vim.cmd('nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>')
|
vim.cmd('nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>')
|
||||||
vim.cmd('nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>')
|
vim.cmd('nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>')
|
||||||
|
@ -14,9 +30,11 @@ vim.cmd('nnoremap <silent> K :Lspsaga hover_doc<CR>')
|
||||||
vim.cmd('nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>')
|
vim.cmd('nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>')
|
||||||
vim.cmd('nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>')
|
vim.cmd('nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>')
|
||||||
-- scroll down hover doc or scroll in definition preview
|
-- scroll down hover doc or scroll in definition preview
|
||||||
vim.cmd('nnoremap <silent> <C-f> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(1)<CR>')
|
vim.cmd(
|
||||||
|
'nnoremap <silent> <C-f> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(1)<CR>')
|
||||||
-- scroll up hover doc
|
-- scroll up hover doc
|
||||||
vim.cmd('nnoremap <silent> <C-b> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(-1)<CR>')
|
vim.cmd(
|
||||||
|
'nnoremap <silent> <C-b> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(-1)<CR>')
|
||||||
|
|
||||||
--[[ " autoformat
|
--[[ " autoformat
|
||||||
autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
|
autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
|
||||||
|
|
|
@ -12,4 +12,7 @@ elseif vim.fn.has("unix") == 1 then
|
||||||
else
|
else
|
||||||
print("Unsupported system")
|
print("Unsupported system")
|
||||||
end
|
end
|
||||||
require('jdtls').start_or_attach({cmd = {JAVA_LS_EXECUTABLE}, root_dir = require('jdtls.setup').find_root({'gradle.build', 'pom.xml'})})
|
require('jdtls').start_or_attach({
|
||||||
|
cmd = {JAVA_LS_EXECUTABLE},
|
||||||
|
root_dir = require('jdtls.setup').find_root({'gradle.build', 'pom.xml'})
|
||||||
|
})
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
-- npm install -g typescript typescript-language-server
|
-- npm install -g typescript typescript-language-server
|
||||||
-- require'snippets'.use_suggested_mappings()
|
-- require'snippets'.use_suggested_mappings()
|
||||||
|
|
||||||
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
||||||
local on_attach_common = function(client)
|
-- local on_attach_common = function(client)
|
||||||
--print("LSP Initialized")
|
-- print("LSP Initialized")
|
||||||
-- require'completion'.on_attach(client)
|
-- require'completion'.on_attach(client)
|
||||||
require'illuminate'.on_attach(client)
|
-- require'illuminate'.on_attach(client)
|
||||||
end
|
-- end
|
||||||
|
require'lspconfig'.tsserver.setup {
|
||||||
require'lspconfig'.tsserver.setup{
|
-- on_attach = function(client)
|
||||||
on_attach = function(client)
|
-- on_attach_common(client)
|
||||||
on_attach_common(client)
|
-- end,
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,15 @@ local sumneko_root_path = ""
|
||||||
local sumneko_binary = ""
|
local sumneko_binary = ""
|
||||||
|
|
||||||
if vim.fn.has("mac") == 1 then
|
if vim.fn.has("mac") == 1 then
|
||||||
sumneko_root_path = "/Users/" .. USER .. "/.config/nvim/ls/lua-language-server"
|
sumneko_root_path = "/Users/" .. USER ..
|
||||||
sumneko_binary = "/Users/" .. USER .. "/.config/nvim/ls/lua-language-server/bin/macOS/lua-language-server"
|
"/.config/nvim/ls/lua-language-server"
|
||||||
|
sumneko_binary = "/Users/" .. USER ..
|
||||||
|
"/.config/nvim/ls/lua-language-server/bin/macOS/lua-language-server"
|
||||||
elseif vim.fn.has("unix") == 1 then
|
elseif vim.fn.has("unix") == 1 then
|
||||||
sumneko_root_path = "/home/" .. USER .. "/.config/nvim/ls/lua-language-server"
|
sumneko_root_path = "/home/" .. USER ..
|
||||||
sumneko_binary = "/home/" .. USER .. "/.config/nvim/ls/lua-language-server/bin/Linux/lua-language-server"
|
"/.config/nvim/ls/lua-language-server"
|
||||||
|
sumneko_binary = "/home/" .. USER ..
|
||||||
|
"/.config/nvim/ls/lua-language-server/bin/Linux/lua-language-server"
|
||||||
else
|
else
|
||||||
print("Unsupported system for sumneko")
|
print("Unsupported system for sumneko")
|
||||||
end
|
end
|
||||||
|
@ -30,7 +34,10 @@ require'lspconfig'.sumneko_lua.setup {
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
-- Make the server aware of Neovim runtime files
|
-- Make the server aware of Neovim runtime files
|
||||||
library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true}
|
library = {
|
||||||
|
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||||
|
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,21 +21,21 @@ function nv_utils.define_augroups(definitions) -- {{{1
|
||||||
vim.cmd('augroup END')
|
vim.cmd('augroup END')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
nv_utils.define_augroups(
|
nv_utils.define_augroups({
|
||||||
{_general_settings = {
|
_general_settings = {
|
||||||
{'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'QuickScopePrimary\', timeout = 200})'},
|
{
|
||||||
{'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
|
'TextYankPost', '*',
|
||||||
{'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
|
'lua require(\'vim.highlight\').on_yank({higroup = \'QuickScopePrimary\', timeout = 200})'
|
||||||
{'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
|
}, {'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
|
||||||
{'FileType', 'java', 'luafile ~/.config/nvim/lua/lsp/java-ls.lua'},
|
{'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
|
||||||
{'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'},
|
{'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
|
||||||
{'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'},
|
{'FileType', 'java', 'luafile ~/.config/nvim/lua/lsp/java-ls.lua'},
|
||||||
-- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'},
|
{'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'},
|
||||||
-- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'},
|
{'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'}
|
||||||
},
|
-- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'},
|
||||||
|
-- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'},
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Add this to lightbulb, java makes this annoying tho
|
-- Add this to lightbulb, java makes this annoying tho
|
||||||
-- autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()
|
-- autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()
|
||||||
|
@ -44,6 +44,7 @@ nv_utils.define_augroups(
|
||||||
|
|
||||||
function nv_utils.add_to_workspace_folder()
|
function nv_utils.add_to_workspace_folder()
|
||||||
vim.lsp.buf.add_workspace_folder()
|
vim.lsp.buf.add_workspace_folder()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function nv_utils.clear_references()
|
function nv_utils.clear_references()
|
||||||
|
@ -193,10 +194,8 @@ function nv_utils.blame_line()
|
||||||
require('gitsigns').blame_line()
|
require('gitsigns').blame_line()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- misc
|
-- misc
|
||||||
|
|
||||||
|
|
||||||
-- autoformat
|
-- autoformat
|
||||||
-- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)
|
-- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ return require('packer').startup(function(use)
|
||||||
use 'andymass/vim-matchup'
|
use 'andymass/vim-matchup'
|
||||||
use 'tpope/vim-sleuth'
|
use 'tpope/vim-sleuth'
|
||||||
use 'phaazon/hop.nvim'
|
use 'phaazon/hop.nvim'
|
||||||
|
use 'gennaro-tedesco/nvim-jqx'
|
||||||
-- use 'RRethy/vim-illuminate'
|
-- use 'RRethy/vim-illuminate'
|
||||||
-- use 'b3nj5m1n/kommentary'
|
-- use 'b3nj5m1n/kommentary'
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -17,7 +17,6 @@ vim.cmd('set sw=4') --Change the number of space characte
|
||||||
vim.bo.expandtab=true --Converts tabs to spaces
|
vim.bo.expandtab=true --Converts tabs to spaces
|
||||||
vim.bo.smartindent=true --Makes indenting smart
|
vim.bo.smartindent=true --Makes indenting smart
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
vim.o.laststatus = 2
|
|
||||||
vim.wo.cursorline=true --Enable highlighting of the current line
|
vim.wo.cursorline=true --Enable highlighting of the current line
|
||||||
vim.o.showtabline=2 --Always show tabs
|
vim.o.showtabline=2 --Always show tabs
|
||||||
vim.o.showmode=false --We don't need to see things like -- INSERT -- anymore
|
vim.o.showmode=false --We don't need to see things like -- INSERT -- anymore
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue