set up jai config
This commit is contained in:
54
init.lua
54
init.lua
@@ -1,8 +1,10 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = ","
|
||||
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.tabstop = 4
|
||||
vim.opt.expandtab = true -- Convert tabs to spaces
|
||||
vim.opt.tabstop = 4 -- Number of spaces per tab
|
||||
vim.opt.shiftwidth = 4 -- Spaces used for autoindent
|
||||
vim.opt.softtabstop = 4 -- Spaces inserted when pressing Tab
|
||||
|
||||
vim.o.number = true
|
||||
|
||||
@@ -32,8 +34,9 @@ vim.o.timeoutlen = 300
|
||||
-- Configure how new splits should be opened
|
||||
vim.o.splitright = true
|
||||
vim.o.splitbelow = true
|
||||
vim.o.list = true
|
||||
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||
|
||||
vim.o.list = false
|
||||
-- vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.o.inccommand = "split"
|
||||
@@ -70,8 +73,8 @@ vim.diagnostic.config({
|
||||
underline = { severity = { min = vim.diagnostic.severity.WARN } },
|
||||
|
||||
-- Can switch between these as you prefer
|
||||
virtual_text = false, -- Text shows up at the end of the line
|
||||
virtual_lines = true, -- Text shows up underneath the line, with virtual lines
|
||||
virtual_text = true, -- Text shows up at the end of the line
|
||||
virtual_lines = false, -- Text shows up underneath the line, with virtual lines
|
||||
|
||||
-- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
|
||||
jump = { float = true },
|
||||
@@ -84,8 +87,9 @@ vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" }
|
||||
vim.keymap.set("n", "K", function()
|
||||
vim.lsp.buf.hover({ border = "rounded" })
|
||||
end)
|
||||
vim.keymap.set("n", "grd", vim.lsp.buf.definition)
|
||||
|
||||
vim.lsp.enable({ "lua_ls", "dartls" })
|
||||
vim.lsp.enable({ "lua_ls", "dartls", "clangd", "ols" })
|
||||
|
||||
local github = "https://github.com/"
|
||||
vim.pack.add({
|
||||
@@ -102,17 +106,31 @@ vim.pack.add({
|
||||
github .. "tjdevries/colorbuddy.nvim",
|
||||
github .. "hgranthorner/ghosttybuddy.nvim",
|
||||
github .. "nvim-treesitter/nvim-treesitter",
|
||||
github .. "rluba/jai.vim",
|
||||
github .. "m00qek/baleia.nvim",
|
||||
github .. "ej-shafran/compile-mode.nvim",
|
||||
})
|
||||
|
||||
-- Telescope
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Telescope find files" })
|
||||
vim.keymap.set("n", "<leader>ff", function()
|
||||
require("telescope.builtin").find_files({
|
||||
cwd = require("oil").get_current_dir(),
|
||||
})
|
||||
end, { desc = "Telescope find files" })
|
||||
vim.keymap.set("n", "<leader>fc", function()
|
||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
||||
end, { desc = "Telescope find config" })
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Telescope live grep" })
|
||||
vim.keymap.set("n", "<leader>fg", function()
|
||||
builtin.live_grep({
|
||||
cwd = require("oil").get_current_dir(),
|
||||
})
|
||||
end, { desc = "Telescope live grep" })
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Telescope buffers" })
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Telescope help tags" })
|
||||
vim.keymap.set("n", "<leader>fm", builtin.marks, { desc = "Telescope marks" })
|
||||
vim.keymap.set("n", "<leader>f/", builtin.current_buffer_fuzzy_find, { desc = "Telescope current buffer" })
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("telescope-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
@@ -142,6 +160,7 @@ require("mini.surround").setup()
|
||||
require("mini.snippets").setup()
|
||||
|
||||
-- Neogit
|
||||
require("neogit").setup({ kind = "split" })
|
||||
vim.keymap.set("n", "<leader>gg", "<CMD>Neogit<CR>")
|
||||
|
||||
-- Conform
|
||||
@@ -153,6 +172,8 @@ require("conform").setup({
|
||||
python = { "ruff" },
|
||||
-- You can customize some of the format options for the filetype (:help conform.format)
|
||||
rust = { "rustfmt", lsp_format = "fallback" },
|
||||
cpp = { "clang-format" },
|
||||
odin = { "odinfmt" },
|
||||
-- Conform will run the first available formatter
|
||||
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
@@ -180,8 +201,21 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
vim.treesitter.start()
|
||||
-- folds, provided by Neovim
|
||||
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.wo.foldmethod = "expr"
|
||||
vim.wo.foldmethod = "manual"
|
||||
-- indentation, provided by nvim-treesitter
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end,
|
||||
})
|
||||
|
||||
-- compile mode
|
||||
require("compile-mode")
|
||||
vim.g.compile_mode = {
|
||||
default_command = {
|
||||
jai = "jai -quiet %",
|
||||
},
|
||||
baleia_setup = true,
|
||||
bang_expansion = true,
|
||||
}
|
||||
vim.keymap.set("n", "<leader>r", function()
|
||||
require("compile-mode").recompile()
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user