diff --git a/.aliases b/.aliases index fba7c5c..26aef80 100644 --- a/.aliases +++ b/.aliases @@ -8,3 +8,4 @@ alias rrm='/usr/bin/rm' alias cp='cpv' # ls sorted by modification time alias lt='ls -lath' +alias vim='nvim' diff --git a/.config/bootstrap/config_common b/.config/bootstrap/config_common index da825ae..0716c08 100644 --- a/.config/bootstrap/config_common +++ b/.config/bootstrap/config_common @@ -67,6 +67,7 @@ rofi rofimoji rsync signal-desktop +stylua telegram-desktop terminator thunderbird diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..35880e1 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,70 @@ +vim.opt.number = true + +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) +require("lazy").setup({ { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, { "mhartington/formatter.nvim" } }) + +-- Utilities for creating configurations +local util = require("formatter.util") + +-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands +require("formatter").setup({ + -- Enable or disable logging + logging = true, + -- Set the log level + log_level = vim.log.levels.WARN, + -- All formatter configurations are opt-in + filetype = { + -- Formatter configurations for filetype "lua" go here + -- and will be executed in order + lua = { + -- "formatter.filetypes.lua" defines default configurations for the + -- "lua" filetype + require("formatter.filetypes.lua").stylua, + + -- You can also define your own configuration + function() + -- Supports conditional formatting + if util.get_current_buffer_file_name() == "special.lua" then + return nil + end + + -- Full specification of configurations is down below and in Vim help + -- files + return { + exe = "stylua", + args = { + "--search-parent-directories", + "--stdin-filepath", + util.escape_path(util.get_current_buffer_file_path()), + "--", + "-", + }, + stdin = true, + } + end, + }, + + -- Use the special "*" filetype for defining formatter configurations on + -- any filetype + ["*"] = { + -- "formatter.filetypes.any" defines default configurations for any + -- filetype + require("formatter.filetypes.any").remove_trailing_whitespace, + }, + }, +}) + +require("format-lua") +vim.cmd.colorscheme("catppuccin-macchiato") +vim.api.nvim_set_keymap("n", "f", ":Format", { noremap = true, silent = true }) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..cb16c1e --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,5 @@ +{ + "catppuccin": { "branch": "main", "commit": "c2034f7b549152e5cc757820426341ea5000bc7a" }, + "formatter.nvim": { "branch": "master", "commit": "cb4778b8432f1ae86dae4634c0b611cb269a4c2f" }, + "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" } +} \ No newline at end of file diff --git a/.config/nvim/lua/format-lua.lua b/.config/nvim/lua/format-lua.lua new file mode 100644 index 0000000..741c02c --- /dev/null +++ b/.config/nvim/lua/format-lua.lua @@ -0,0 +1,41 @@ +local M = {} + +local util = require "formatter.util" + +function M.luaformatter() + return { + exe = "luaformatter", + } +end + +function M.luafmt() + return { + exe = "luafmt", + args = { "--stdin" }, + stdin = true, + } +end + +function M.luaformat() + return { + exe = "lua-format", + args = {util.escape_path(util.get_current_buffer_file_path())}, + stdin = true + } +end + +function M.stylua() + return { + exe = "stylua", + args = { + "--search-parent-directories", + "--stdin-filepath", + util.escape_path(util.get_current_buffer_file_path()), + "--", + "-", + }, + stdin = true, + } +end + +return M