Compare commits
No commits in common. "b6222e368260f6f5531b40dafce732f39900aab6" and "7f3dd527af66b7c4fbb09b4a66e6f5250e97beab" have entirely different histories.
b6222e3682
...
7f3dd527af
7 changed files with 47 additions and 73 deletions
|
|
@ -1,33 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
session_name=${PWD##*/}
|
|
||||||
project_directory="$HOME/development/$session_name"
|
|
||||||
enable_formatting=""
|
|
||||||
|
|
||||||
tmux has-session -t $session_name
|
|
||||||
|
|
||||||
if [ $? != 0 ];
|
|
||||||
then
|
|
||||||
tmux new-session \
|
|
||||||
-c $project_directory \
|
|
||||||
-ds $session_name \
|
|
||||||
-e "project_dir=$project_directory"
|
|
||||||
|
|
||||||
# FIRST WINDOW
|
|
||||||
tmux send-keys -t $session_name:0 'source ./env/bin/activate' C-m
|
|
||||||
tmux send-keys -t $session_name:0 'nvim' C-m
|
|
||||||
|
|
||||||
# SECOND WINDOW
|
|
||||||
tmux new-window -t $session_name
|
|
||||||
|
|
||||||
# THIRD WINDOW
|
|
||||||
tmux new-window -t $session_name
|
|
||||||
|
|
||||||
# FOURTH WINDOW
|
|
||||||
tmux new-window -t $session_name
|
|
||||||
|
|
||||||
# SELECT DEFAULT PANE AFTER OPENING
|
|
||||||
tmux select-window -t $session_name:0
|
|
||||||
fi
|
|
||||||
|
|
||||||
tmux attach -t $session_name
|
|
||||||
|
|
@ -29,7 +29,7 @@ language_servers:
|
||||||
|
|
||||||
- package: lua-language-server
|
- package: lua-language-server
|
||||||
server_name: 'lua_ls'
|
server_name: 'lua_ls'
|
||||||
auto_setup: false
|
auto_setup: true
|
||||||
|
|
||||||
- package: yaml-language-server
|
- package: yaml-language-server
|
||||||
server_name: 'yamlls'
|
server_name: 'yamlls'
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,3 @@
|
||||||
|
|
||||||
- src: 'templates/nvim/lua/filetype.lua.j2'
|
- src: 'templates/nvim/lua/filetype.lua.j2'
|
||||||
dest: '{{ xdg_config_dir }}/nvim/lua/_filetype.lua'
|
dest: '{{ xdg_config_dir }}/nvim/lua/_filetype.lua'
|
||||||
|
|
||||||
- src: 'templates/nvim/lua/formatting.lua.j2'
|
|
||||||
dest: '{{ xdg_config_dir }}/nvim/lua/formatting.lua'
|
|
||||||
|
|
|
||||||
|
|
@ -50,5 +50,4 @@ autocorrect = prompt
|
||||||
navigate = true
|
navigate = true
|
||||||
hyperlinks = true
|
hyperlinks = true
|
||||||
line-numbers = true
|
line-numbers = true
|
||||||
map-styles = bold purple => syntax magenta, bold cyan => syntax blue, bold yellow => syntax yellow
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
-- {{ ansible_managed }}
|
-- {{ ansible_managed }}
|
||||||
|
|
||||||
|
-- TODO: load environment vars from .env files
|
||||||
require('options')
|
require('options')
|
||||||
require('_filetype')
|
require('_filetype')
|
||||||
require('colorscheme')
|
require('colorscheme')
|
||||||
|
|
@ -11,4 +12,3 @@ require('indent-blankline')
|
||||||
require('_nvim-tree')
|
require('_nvim-tree')
|
||||||
require('lua-line')
|
require('lua-line')
|
||||||
require('_source-link')
|
require('_source-link')
|
||||||
require('formatting')
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
local enable_formatting = os.getenv("enable_formatting") == 'true';
|
|
||||||
|
|
||||||
if (enable_formatting) then
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
group = vim.api.nvim_create_augroup('lsp', { clear = true }),
|
|
||||||
callback = function(args)
|
|
||||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
|
||||||
|
|
||||||
if client.server_capabilities.documentFormattingProvider then
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
buffer = args.buf,
|
|
||||||
callback = function()
|
|
||||||
vim.lsp.buf.format {
|
|
||||||
async = false,
|
|
||||||
id = args.data.client_id
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
@ -95,18 +95,6 @@ nvim_lsp.jsonls.setup {
|
||||||
capabilities = snippet_capabilities,
|
capabilities = snippet_capabilities,
|
||||||
}
|
}
|
||||||
|
|
||||||
nvim_lsp.lua_ls.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = snippet_capabilities,
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { 'vim' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
nvim_lsp.yamlls.setup {
|
nvim_lsp.yamlls.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
|
@ -187,3 +175,48 @@ vim.diagnostic.config {
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local enable_formatting = os.getenv("ENABLE_FORMATTING")
|
||||||
|
|
||||||
|
-- format buffers before saving for specific LSPs
|
||||||
|
if (enable_formatting) then
|
||||||
|
local excluded_clients = { 'pyright' }
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
group = vim.api.nvim_create_augroup('lsp', { clear = true }),
|
||||||
|
callback = function(args)
|
||||||
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
|
buffer = args.buf,
|
||||||
|
callback = function()
|
||||||
|
local formatting_clients = vim.lsp.get_clients {
|
||||||
|
bufnr = args.buf,
|
||||||
|
method = 'textDocument/formatting'
|
||||||
|
}
|
||||||
|
|
||||||
|
local filtered_clients = {}
|
||||||
|
|
||||||
|
for _, client in pairs(formatting_clients) do
|
||||||
|
if vim.list_contains(excluded_clients, client.name) then
|
||||||
|
goto skip
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(filtered_clients, client.name)
|
||||||
|
::skip::
|
||||||
|
end
|
||||||
|
|
||||||
|
if #filtered_clients == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.lsp.buf.format {
|
||||||
|
filter = function(client)
|
||||||
|
return vim.list_contains(filtered_clients, client.name)
|
||||||
|
end,
|
||||||
|
async = false,
|
||||||
|
id = args.data.client_id
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue