diff --git a/init.lua b/init.lua index 5a4689a..5bd144a 100644 --- a/init.lua +++ b/init.lua @@ -25,7 +25,7 @@ vim.o.smartcase = true vim.o.hlsearch = true vim.o.incsearch = true -vim.o.wildignore = "**/node_modules/**" +vim.o.wildignore = "**/node_modules/**,*.o" vim.o.path = ".,**" -- Keybindings @@ -36,87 +36,14 @@ vim.keymap.set("n", "x", ":bd!") vim.keymap.set("n", "h", ":noh") vim.keymap.set("n", "", ":Exp") -vim.keymap.set("n", "ff", function() Snacks.picker.files({ cmd = "fd" }) end) -vim.keymap.set("n", "fw", function() Snacks.picker.grep() end) - -vim.keymap.set("n", ".", function() Snacks.scratch() end) -vim.keymap.set("n", "S", function() Snacks.scratch.select() end) - -vim.keymap.set("n", "gb", function() Snacks.git.blame_line() end) - --- Commands -local function indent(n, expand) - local size = 4 - if n ~= "" then size = n end - - local num = tonumber(size) - if num then - size = num - end - - vim.o.expandtab = expand - vim.o.shiftwidth = size - vim.o.tabstop = size -end - -vim.api.nvim_create_user_command("Tabs", function(v) - indent(v.args, false) -end, { nargs = "?" }) - -vim.api.nvim_create_user_command("Spaces", function(v) - indent(v.args, true) -end, { nargs = "?" }) - -vim.api.nvim_create_autocmd("ColorScheme", { - pattern = "*", - callback = function() - vim.cmd [[ - hi Normal guibg=none ctermbg=none - hi NonText guibg=none ctermbg=none - hi NormalFloat guibg=none ctermbg=none - ]] - end -}) - -vim.api.nvim_create_user_command("TE", function(v) - vim.cmd("split") - vim.cmd("term " .. v.args) -end, { nargs = "*", force = true }) - --- autocmd -vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { - pattern = { "*.ts", "*.tsx" }, - command = "compiler tsc" -}) - -vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { - pattern = "*.go", - command = "Tabs 4" -}) - -vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { - pattern = "*.rs", - command = "compiler cargo" -}) +-- Imports +require "core.commands" +require "core.autocmds" -- Plugins vim.pack.add({ - { src = "https://github.com/wakatime/vim-wakatime" }, - { src = "https://github.com/folke/snacks.nvim" } + { src = "https://github.com/wakatime/vim-wakatime" } }) --- Snacks -require("snacks").setup { - git = { - enabled = true, - border = "rounded" - }, - picker = { - enabled = true, - ui_select = true - }, - scratch = { enabled = true } -} - -- Theme vim.cmd [[colorscheme default]] diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua new file mode 100644 index 0000000..507f51c --- /dev/null +++ b/lua/core/autocmds.lua @@ -0,0 +1,25 @@ +vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "*", + callback = function() + vim.cmd [[ + hi Normal guibg=none ctermbg=none + hi NonText guibg=none ctermbg=none + hi NormalFloat guibg=none ctermbg=none + ]] + end +}) + +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = { "*.ts", "*.tsx" }, + command = "compiler tsc" +}) + +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = "*.go", + command = "Tabs 4" +}) + +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = "*.rs", + command = "compiler cargo" +}) diff --git a/lua/core/commands.lua b/lua/core/commands.lua new file mode 100644 index 0000000..4c87d89 --- /dev/null +++ b/lua/core/commands.lua @@ -0,0 +1,26 @@ +local function indent(n, expand) + local size = 4 + if n ~= "" then size = n end + + local num = tonumber(size) + if num then + size = num + end + + vim.o.expandtab = expand + vim.o.shiftwidth = size + vim.o.tabstop = size +end + +vim.api.nvim_create_user_command("Tabs", function(v) + indent(v.args, false) +end, { nargs = "?" }) + +vim.api.nvim_create_user_command("Spaces", function(v) + indent(v.args, true) +end, { nargs = "?" }) + +vim.api.nvim_create_user_command("TE", function(v) + vim.cmd("split") + vim.cmd("term " .. v.args) +end, { nargs = "*", force = true }) diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json new file mode 100644 index 0000000..8e59f01 --- /dev/null +++ b/nvim-pack-lock.json @@ -0,0 +1,8 @@ +{ + "plugins": { + "vim-wakatime": { + "rev": "d7973b1", + "src": "https://github.com/wakatime/vim-wakatime" + } + } +} \ No newline at end of file