Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 1 addition & 53 deletions nvim/config/init.lua
Original file line number Diff line number Diff line change
@@ -1,54 +1,2 @@
require('bootstrap')
require('options')
require('keymaps')
require('syntax')

vim.api.nvim_create_autocmd("BufWritePre", {
pattern = {"*.go"},
callback = function()
-- Format the file
vim.lsp.buf.format({
async = false,
})

-- Organize imports
local params = vim.lsp.util.make_range_params()
params.context = { only = { "source.organizeImports" } }

local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000)
if not result then return end

for _, res in pairs(result) do
for _, action in pairs(res.result or {}) do
if action.edit then
vim.lsp.util.apply_workspace_edit(action.edit, "utf-16")
else
vim.lsp.buf.execute_command(action.command)
end
end
end
end
})

vim.api.nvim_create_autocmd("BufWritePre", {
pattern = {"*.tf"},
callback = function()
vim.lsp.buf.format()
end
})

vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = "*.html",
command = "set filetype=html"
})

vim.api.nvim_create_autocmd("FileType", {
pattern = {"lua", "ruby", "yaml", "html", "json"},
callback = function ()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.expandtab = true
vim.opt_local.smartindent = true
end
})
require('autocmds')
23 changes: 0 additions & 23 deletions nvim/config/lazy-lock.json

This file was deleted.

20 changes: 20 additions & 0 deletions nvim/config/lua/autocmds.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = "*.html",
command = "set filetype=html"
})

vim.api.nvim_create_autocmd("FileType", {
pattern = { "lua", "ruby", "yaml", "html", "json" },
callback = function()
local opts = {
tabstop = 2,
shiftwidth = 2,
softtabstop = 2,
expandtab = true,
smartindent = true,
}
for k, v in pairs(opts) do
vim.opt_local[k] = v
end
end
})
15 changes: 0 additions & 15 deletions nvim/config/lua/bootstrap.lua

This file was deleted.

30 changes: 0 additions & 30 deletions nvim/config/lua/keymaps.lua

This file was deleted.

37 changes: 37 additions & 0 deletions nvim/config/lua/languages.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
return {
-- Build systems
{ treesitter = "make" },
{ treesitter = "cmake" },
{ treesitter = "dockerfile" },

-- Scripting languages
{ treesitter = "bash", lsp = "bashls" },
{ treesitter = "lua", lsp = "lua_ls" },

-- Programming languages
{ treesitter = "go", lsp = "gopls" },
{ treesitter = "gomod" },
{ treesitter = "gosum" },
{ treesitter = "rust" },
{ treesitter = "proto", lsp = "buf_ls" },
{ treesitter = "zig", lsp = "zls" },
{ treesitter = "gleam", lsp = "gleam" },
{ treesitter = "elixir" },
{ treesitter = "html" },
{ treesitter = "css" },
{ treesitter = "typescript", lsp = "ts_ls" },
{ treesitter = "javascript" },

-- Data and documentation
{ treesitter = "sql" },
{ treesitter = "csv" },
{ treesitter = "markdown", lsp = "marksman" },

-- Config and IaC
{ treesitter = "terraform", lsp = "terraformls" },
{ treesitter = "hcl" },
{ treesitter = "json" },
{ treesitter = "yaml" },
{ treesitter = "toml" },
{ treesitter = "regex" },
}
7 changes: 3 additions & 4 deletions nvim/config/lua/options.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- New UI opt-in
require('vim._core.ui2').enable({})

vim.opt.timeoutlen = 1000
vim.opt.ttimeoutlen = 0
vim.opt.number = true
Expand All @@ -12,7 +15,6 @@ vim.opt.cursorline = true
vim.opt.cursorcolumn = true
vim.opt.autowrite = true
vim.opt.shortmess = vim.opt.shortmess + 'c'
vim.opt.completeopt = {'menuone', 'noinsert', 'noselect'}
vim.opt.incsearch = true -- show search matches as you type
vim.opt.showmatch = true
vim.opt.hlsearch = true
Expand All @@ -32,6 +34,3 @@ vim.opt.spell = false

-- Change how diagnostics appear
vim.diagnostic.config({ virtual_text = true })

-- Theme
vim.cmd.colorscheme('base16-gruvbox-dark-hard')
19 changes: 0 additions & 19 deletions nvim/config/lua/plugins/completion.lua

This file was deleted.

9 changes: 0 additions & 9 deletions nvim/config/lua/plugins/fzf.lua

This file was deleted.

13 changes: 0 additions & 13 deletions nvim/config/lua/plugins/git.lua

This file was deleted.

31 changes: 0 additions & 31 deletions nvim/config/lua/plugins/lsp.lua

This file was deleted.

7 changes: 0 additions & 7 deletions nvim/config/lua/plugins/motion.lua

This file was deleted.

22 changes: 0 additions & 22 deletions nvim/config/lua/plugins/oil.lua

This file was deleted.

38 changes: 0 additions & 38 deletions nvim/config/lua/plugins/theme.lua

This file was deleted.

40 changes: 0 additions & 40 deletions nvim/config/lua/plugins/treesitter.lua

This file was deleted.

Loading