1
Fork 0

A shit ton of stuff

This commit is contained in:
Matei Adriel 2022-07-19 21:19:36 +03:00
parent 7cbe73ad5b
commit c01ce48abe
20 changed files with 338 additions and 288 deletions

View file

@ -1,26 +1,26 @@
local A = require("my.helpers.augroup")
local M = {}
local extraCommentStrings = {nix = "# %s", lean = "/- %s -/", bkf = "-- %s"}
local extraCommentStrings = { lean = "/- %s -/", bkf = "-- %s" }
-- Update comments for certain languages
local function setCommentString(extension, commentString)
A.augroup('set-commentstring-' .. extension, function()
local action =
':lua vim.api.nvim_buf_set_option(0, "commentstring", "' ..
commentString .. '")'
function M.setCommentString(extension, commentString)
A.augroup('set-commentstring-' .. extension, function()
local action =
':lua vim.api.nvim_buf_set_option(0, "commentstring", "' ..
commentString .. '")'
A.autocmd('BufEnter', '*.' .. extension, action)
A.autocmd('BufFilePost', '*.' .. extension, action)
end)
A.autocmd('BufEnter', '*.' .. extension, action)
A.autocmd('BufFilePost', '*.' .. extension, action)
end)
end
function M.setup()
require('nvim_comment').setup()
require('nvim_comment').setup()
for lang, commentString in pairs(extraCommentStrings) do
setCommentString(lang, commentString)
end
for lang, commentString in pairs(extraCommentStrings) do
M.setCommentString(lang, commentString)
end
end
return M

View file

@ -0,0 +1,32 @@
local M = {}
function M.setup()
local db = require("dashboard")
-- db.custom_header = {
-- "", "",
-- [[ /\ \ /\ \ /\ \ /\ \ /\ \ ]],
-- [[ /::\____\ /::\ \ /::\ \ /::\ \ /::\ \ ]],
-- [[ /:::/ / /::::\ \ \:::\ \ /::::\ \ /::::\ \ ]],
-- [[ /:::/ _/___ /::::::\ \ \:::\ \ /::::::\ \ /::::::\ \ ]],
-- [[ /:::/ /\ \ /:::/\:::\ \ \:::\ \ /:::/\:::\ \ /:::/\:::\ \ ]],
-- [[ /:::/ /::\____\ /:::/__\:::\ \ \:::\ \ /:::/__\:::\ \ /:::/__\:::\ \ ]],
-- [[ /:::/ /:::/ / /::::\ \:::\ \ /::::\ \ /::::\ \:::\ \ /::::\ \:::\ \ ]],
-- [[ /:::/ /:::/ _/___ /::::::\ \:::\ \ /::::::\ \ /::::::\ \:::\ \ /::::::\ \:::\ \ ]],
-- [[ /:::/___/:::/ /\ \ /:::/\:::\ \:::\ \ /:::/\:::\ \ /:::/\:::\ \:::\ \ /:::/\:::\ \:::\____\ ]],
-- [[|:::| /:::/ /::\____\/:::/ \:::\ \:::\____\ /:::/ \:::\____\/:::/__\:::\ \:::\____\/:::/ \:::\ \:::| |]],
-- [[|:::|__/:::/ /:::/ /\::/ \:::\ /:::/ / /:::/ \::/ /\:::\ \:::\ \::/ /\::/ |::::\ /:::|____|]],
-- [[ \:::\/:::/ /:::/ / \/____/ \:::\/:::/ / /:::/ / \/____/ \:::\ \:::\ \/____/ \/____|:::::\/:::/ / ]],
-- [[ \::::::/ /:::/ / \::::::/ / /:::/ / \:::\ \:::\ \ |:::::::::/ / ]],
-- [[ \::::/___/:::/ / \::::/ / /:::/ / \:::\ \:::\____\ |::|\::::/ / ]],
-- [[ \:::\__/:::/ / /:::/ / \::/ / \:::\ \::/ / |::| \::/____/ ]],
-- [[ \::::::::/ / /:::/ / \/____/ \:::\ \/____/ |::| ~| ]],
-- [[ \::::::/ / /:::/ / \:::\ \ |::| | ]],
-- [[ \::::/ / /:::/ / \:::\____\ \::| | ]],
-- [[ \::/____/ \::/ / \::/ / \:| | ]],
-- [[ ~~ \/____/ \/____/ \|___| ]],
-- ""
-- }
end
return M

View file

@ -1,29 +1,30 @@
local M = {}
function M.setup()
-- Other unconfigured plugins
require('nvim-autopairs').setup()
require("startup").setup()
require("presence"):setup({}) -- wtf does the : do here?
-- require("which-key").setup()
-- Other unconfigured plugins
require('nvim-autopairs').setup()
-- require("startup").setup()
require("presence"):setup({}) -- wtf does the : do here?
-- require("which-key").setup()
-- Plugins with their own configs:
require("my.plugins.vim-tmux-navigator").setup()
-- require("my.plugins.fzf-lua").setup()
-- require("my.plugins.nerdtree").setup()
require("my.plugins.treesitter").setup()
require("my.plugins.cmp").setup()
require("my.plugins.lspconfig").setup()
require("my.plugins.null-ls").setup()
require("my.plugins.lualine").setup()
require("my.plugins.comment").setup()
require("my.plugins.nvim-tree").setup()
require("my.plugins.vimtex").setup()
require("my.plugins.telescope").setup()
require("my.plugins.vimux").setup()
-- require("my.plugins.idris").setup()
-- require("my.plugins.lh-brackets").setup()
require("my.plugins.lean").setup()
-- Plugins with their own configs:
require("my.plugins.vim-tmux-navigator").setup()
-- require("my.plugins.fzf-lua").setup()
-- require("my.plugins.nerdtree").setup()
require("my.plugins.treesitter").setup()
require("my.plugins.dashboard").setup()
require("my.plugins.cmp").setup()
require("my.plugins.lspconfig").setup()
require("my.plugins.null-ls").setup()
require("my.plugins.lualine").setup()
require("my.plugins.comment").setup()
require("my.plugins.nvim-tree").setup()
require("my.plugins.vimtex").setup()
require("my.plugins.telescope").setup()
require("my.plugins.vimux").setup()
-- require("my.plugins.idris").setup()
-- require("my.plugins.lh-brackets").setup()
require("my.plugins.lean").setup()
end
return M

View file

@ -1,143 +1,133 @@
local A = require("my.plugins.arpeggio")
local M = {}
local function map(buf, mode, lhs, rhs, opts)
local options = {noremap = true, silent = true}
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options)
local options = { noremap = true, silent = true }
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options)
end
function M.on_attach(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
if client.server_capabilities.documentFormattingProvider then
print("Initializing formatter...")
vim.cmd([[
if client.server_capabilities.documentFormattingProvider then
print("Initializing formatter...")
vim.cmd([[
augroup LspFormatting
autocmd! * <buffer>
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
augroup END
]])
end
end
print("Setting up keybinds...")
-- Go to declaration / definition / implementation
map(bufnr, "n", 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
map(bufnr, "n", 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
map(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
print("Setting up keybinds...")
-- Go to declaration / definition / implementation
map(bufnr, "n", 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
map(bufnr, "n", 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
map(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
-- Hover
map(bufnr, 'n', 'J', "<cmd>lua vim.diagnostic.open_float()<CR>")
map(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
map(bufnr, 'n', 'L', '<cmd>lua vim.lsp.buf.signature_help()<CR>')
-- Hover
map(bufnr, 'n', 'J', "<cmd>lua vim.diagnostic.open_float()<CR>")
map(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
map(bufnr, 'n', 'L', '<cmd>lua vim.lsp.buf.signature_help()<CR>')
-- Workspace stuff
-- map(bufnr, 'n', '<leader>wa',
-- '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
-- map(bufnr, 'n', '<leader>wr',
-- '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
-- map(bufnr, 'n', '<leader>wl',
-- '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
-- Workspace stuff
-- map(bufnr, 'n', '<leader>wa',
-- '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
-- map(bufnr, 'n', '<leader>wr',
-- '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
-- map(bufnr, 'n', '<leader>wl',
-- '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
-- Code actions
map(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
map(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>')
map(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>')
map(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
map(bufnr, 'n', '<leader>f',
'<cmd>lua vim.lsp.buf.format({async = true})<CR>')
-- Code actions
map(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
map(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>')
map(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>')
map(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
map(bufnr, 'n', '<leader>f',
'<cmd>lua vim.lsp.buf.format({async = true})<CR>')
print("Initialized language server!")
print("Initialized language server!")
end
local function on_attach_typescript(client, bufnr)
-- We handle formatting using null-ls and prettierd
client.server_capabilities.documentFormattingProvider = false
-- We handle formatting using null-ls and prettierd
client.server_capabilities.documentFormattingProvider = false
M.on_attach(client, bufnr)
end
local function on_attach_nix(c, b)
A.chordSilent("n", "ug",
":lua require('my.helpers.update-nix-fetchgit').update()<CR>",
{settings = "b"})
M.on_attach(c, b)
M.on_attach(client, bufnr)
end
-- General server config
local servers = {
tsserver = {on_attach = on_attach_typescript},
dhall_lsp_server = {},
sumneko_lua = {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'}
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true)
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {enable = false}
}
tsserver = { on_attach = on_attach_typescript },
dhall_lsp_server = {},
sumneko_lua = {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path
},
cmd = {"lua-language-server"}
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' }
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true)
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false }
}
},
purescriptls = {
settings = {
purescript = {
censorWarnings = {
"UnusedName", "ShadowedName", "UserDefinedWarning"
},
formatter = "purs-tidy"
}
}
},
rnix = {on_attach = on_attach_nix},
hls = {
haskell = {
-- set formatter
formattingProvider = "ormolu"
}
},
cssls = {}
-- agda = {}, Haven't gotten this one to work yet
cmd = { "lua-language-server" }
},
purescriptls = {
settings = {
purescript = {
censorWarnings = {
"UnusedName", "ShadowedName", "UserDefinedWarning"
},
formatter = "purs-tidy"
}
}
},
hls = {
haskell = {
-- set formatter
formattingProvider = "ormolu"
}
},
rnix = {},
cssls = {}
-- agda = {}, Haven't gotten this one to work yet
}
function M.setup()
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp
.protocol
.make_client_capabilities())
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp
.protocol
.make_client_capabilities())
-- Setup basic language servers
for lsp, details in pairs(servers) do
if details.on_attach == nil then
-- Default setting for on_attach
details.on_attach = M.on_attach
end
require('lspconfig')[lsp].setup {
on_attach = details.on_attach,
settings = details.settings, -- Specific per-language settings
flags = {
debounce_text_changes = 150 -- This will be the default in neovim 0.7+
},
cmd = details.cmd,
capabilities = capabilities
}
-- Setup basic language servers
for lsp, details in pairs(servers) do
if details.on_attach == nil then
-- Default setting for on_attach
details.on_attach = M.on_attach
end
require('lspconfig')[lsp].setup {
on_attach = details.on_attach,
settings = details.settings, -- Specific per-language settings
flags = {
debounce_text_changes = 150 -- This will be the default in neovim 0.7+
},
cmd = details.cmd,
capabilities = capabilities
}
end
end
return M

View file

@ -7,7 +7,7 @@ function M.setup()
local sources = {
null_ls.builtins.formatting.prettierd.with({extra_filetypes = {}}), -- format ts files
null_ls.builtins.formatting.lua_format -- format lua code
-- null_ls.builtins.formatting.lua_format -- format lua code
}
null_ls.setup({sources = sources, on_attach = lspconfig.on_attach})

View file

@ -1,24 +1,24 @@
local M = {}
function M.setup()
require'nvim-treesitter.configs'.setup {
ensure_installed = {
"bash", "javascript", "typescript", "c", "cpp", "css", "dockerfile",
"elixir", "fish", "html", "json", "latex", "python", "rust", "scss",
"toml", "tsx", "vim", "yaml", "nix"
},
sync_install = false,
indent = {enable = true},
highlight = {
enable = false,
require 'nvim-treesitter.configs'.setup {
ensure_installed = {
"bash", "javascript", "typescript", "c", "cpp", "css", "dockerfile",
"elixir", "fish", "html", "json", "latex", "python", "rust", "scss",
"toml", "tsx", "vim", "yaml", "nix"
},
sync_install = false,
indent = { enable = true },
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false
}
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false
}
}
end
return M