diff --git a/_cli/nvim/.stylua.toml b/_cli/nvim/.stylua.toml new file mode 100644 index 0000000..ecb6dca --- /dev/null +++ b/_cli/nvim/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/_cli/nvim/init.lua b/_cli/nvim/init.lua new file mode 100644 index 0000000..1152335 --- /dev/null +++ b/_cli/nvim/init.lua @@ -0,0 +1,39 @@ +vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/" +vim.g.mapleader = " " + +-- bootstrap lazy and all plugins +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + +if not vim.loop.fs_stat(lazypath) then + local repo = "https://github.com/folke/lazy.nvim.git" + vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath } +end + +vim.opt.rtp:prepend(lazypath) + +local lazy_config = require "configs.lazy" + +-- load plugins +require("lazy").setup({ + { + "NvChad/NvChad", + lazy = false, + branch = "v2.5", + import = "nvchad.plugins", + config = function() + require "options" + end, + }, + + { import = "plugins" }, +}, lazy_config) + +-- load theme +dofile(vim.g.base46_cache .. "defaults") +dofile(vim.g.base46_cache .. "statusline") + +require "nvchad.autocmds" + +vim.schedule(function() + require "mappings" +end) diff --git a/_cli/nvim/lua/chadrc.lua b/_cli/nvim/lua/chadrc.lua new file mode 100644 index 0000000..052c562 --- /dev/null +++ b/_cli/nvim/lua/chadrc.lua @@ -0,0 +1,30 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvconfig.lua + +---@type ChadrcConfig +local M = {} + +M.ui = { + theme = "monekai", + + hl_override = { + ColorColumn = { bg = "#770000" }, + Comment = { italic = true, }, + DiffChange = { bg = "NONE", fg = "#e7c547" }, + DiffText = { bg = "NONE", fg = "#ff8700" }, + FoldColumn = { bg = "NONE" }, + NonText = { bg = "NONE" }, + Normal = { bg = "NONE" }, + NormalFloat = { bg = "NONE" }, + SignColumn = { bg = "NONE" }, + SpellBad = { bg = "#770000", fg = "#ffffff" }, + TelescopeNormal = { bg = "NONE" }, + Visual = { bg = "#0094d8", fg = "#ffffff" }, + }, + + statusline = { + theme = "vscode_colored", + } +} + +return M diff --git a/_cli/nvim/lua/configs/conform.lua b/_cli/nvim/lua/configs/conform.lua new file mode 100644 index 0000000..a000447 --- /dev/null +++ b/_cli/nvim/lua/configs/conform.lua @@ -0,0 +1,15 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + }, + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +require("conform").setup(options) diff --git a/_cli/nvim/lua/configs/lazy.lua b/_cli/nvim/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/_cli/nvim/lua/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/_cli/nvim/lua/configs/lspconfig.lua b/_cli/nvim/lua/configs/lspconfig.lua new file mode 100644 index 0000000..7ae081f --- /dev/null +++ b/_cli/nvim/lua/configs/lspconfig.lua @@ -0,0 +1,23 @@ +-- EXAMPLE +local on_attach = require("nvchad.configs.lspconfig").on_attach +local on_init = require("nvchad.configs.lspconfig").on_init +local capabilities = require("nvchad.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" +local servers = {} + +-- lsps with default config +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, + } +end + +-- typescript +lspconfig.tsserver.setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, +} diff --git a/_cli/nvim/lua/mappings.lua b/_cli/nvim/lua/mappings.lua new file mode 100644 index 0000000..b61191c --- /dev/null +++ b/_cli/nvim/lua/mappings.lua @@ -0,0 +1,20 @@ +require "nvchad.mappings" + +-- add yours here + +local map = vim.keymap.set + +map("i", "jk", "") +map("i", "", "I" ) +map("i", "", "A" ) + +map("n", ";", ":", { desc = "CMD enter command mode" }) +map("n", "", "wq!", { desc = "Save and Exit" }) +map("n", "m", 'execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")', { desc = "Toggle Column" }) +map("n", "h", "set hlsearch!", { desc = "Toggle hlsearch" }) +map("n", "j", "bprevious", { desc = "Buffer Previous" }) +map("n", "k", "bnext", { desc = "Buffer Next" }) +map("n", "n", 'set number!IBLToggleexecute "set signcolumn=" . (&signcolumn == "yes" ? "no" : "yes")', { desc = "Toggle Decorations" }) +map("n", "w", "lua require('whitespace-nvim').trim()", { desc = "Trim Trailing Whitespaces" }) +map("n", "x", "bd", { desc = "Buffer Close" }) +map("n", "", "w", { desc = "Switch buffer" }) diff --git a/_cli/nvim/lua/options.lua b/_cli/nvim/lua/options.lua new file mode 100644 index 0000000..53d0602 --- /dev/null +++ b/_cli/nvim/lua/options.lua @@ -0,0 +1,27 @@ +require "nvchad.options" + +-- add yours here! + +local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! +o.gdefault = true +o.hlsearch = false +o.shiftround = true +o.relativenumber = false +o.wrap = true +o.writebackup = false + +o.clipboard = "" +o.foldcolumn = "0" +o.mouse = "" +o.whichwrap = '' + +local autocmd = vim.api.nvim_create_autocmd +autocmd("BufRead", { + pattern = "*.gotmpl", + command = "set filetype=yaml", +}) +autocmd("BufNewFile", { + pattern = "*.gotmpl", + command = "set filetype=yaml", +}) diff --git a/_cli/nvim/lua/plugins/init.lua b/_cli/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..ce2e92e --- /dev/null +++ b/_cli/nvim/lua/plugins/init.lua @@ -0,0 +1,66 @@ +return { + { + "stevearc/conform.nvim", + -- event = 'BufWritePre', -- uncomment for format on save + config = function() + require "configs.conform" + end, + }, + + -- These are some examples, uncomment them if you want to see them work! + -- { + -- "neovim/nvim-lspconfig", + -- config = function() + -- require("nvchad.configs.lspconfig").defaults() + -- require "configs.lspconfig" + -- end, + -- }, + + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "lua-language-server", + }, + }, + }, + + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "lua", + "markdown", + "markdown_inline", + "python", + "terraform", + "vim", + "yaml", + }, + }, + }, + + -- Install a plugin + -- { + -- "max397574/better-escape.nvim", + -- event = "InsertEnter", + -- config = function() + -- require("better_escape").setup() + -- end + -- }, + + -- To make a plugin not be loaded + -- { + -- "NvChad/nvim-colorizer.lua", + -- enabled = false + -- }, + + -- All NvChad plugins are lazy-loaded by default + -- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false` + -- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example + -- { + -- "mg979/vim-visual-multi", + -- lazy = false, + -- } +} diff --git a/astronvim/highlights/init.lua b/_unused/astronvim/highlights/init.lua similarity index 100% rename from astronvim/highlights/init.lua rename to _unused/astronvim/highlights/init.lua diff --git a/astronvim/init.lua b/_unused/astronvim/init.lua similarity index 100% rename from astronvim/init.lua rename to _unused/astronvim/init.lua diff --git a/astronvim/mappings.lua b/_unused/astronvim/mappings.lua similarity index 100% rename from astronvim/mappings.lua rename to _unused/astronvim/mappings.lua diff --git a/astronvim/options.lua b/_unused/astronvim/options.lua similarity index 100% rename from astronvim/options.lua rename to _unused/astronvim/options.lua diff --git a/astronvim/plugins/init.lua b/_unused/astronvim/plugins/init.lua similarity index 100% rename from astronvim/plugins/init.lua rename to _unused/astronvim/plugins/init.lua diff --git a/astronvim/plugins/lualine.lua b/_unused/astronvim/plugins/lualine.lua similarity index 100% rename from astronvim/plugins/lualine.lua rename to _unused/astronvim/plugins/lualine.lua diff --git a/astronvim/plugins/monokai.lua b/_unused/astronvim/plugins/monokai.lua similarity index 100% rename from astronvim/plugins/monokai.lua rename to _unused/astronvim/plugins/monokai.lua diff --git a/astronvim/plugins/neotree.lua b/_unused/astronvim/plugins/neotree.lua similarity index 100% rename from astronvim/plugins/neotree.lua rename to _unused/astronvim/plugins/neotree.lua diff --git a/astronvim/plugins/notify.lua b/_unused/astronvim/plugins/notify.lua similarity index 100% rename from astronvim/plugins/notify.lua rename to _unused/astronvim/plugins/notify.lua diff --git a/astronvim/plugins/treesitter.lua b/_unused/astronvim/plugins/treesitter.lua similarity index 100% rename from astronvim/plugins/treesitter.lua rename to _unused/astronvim/plugins/treesitter.lua diff --git a/astronvim/plugins/whitespace.lua b/_unused/astronvim/plugins/whitespace.lua similarity index 100% rename from astronvim/plugins/whitespace.lua rename to _unused/astronvim/plugins/whitespace.lua diff --git a/install.sh b/install.sh index 1d12ee1..92a6cf9 100644 --- a/install.sh +++ b/install.sh @@ -1,36 +1,33 @@ #!/bin/sh -# clean + prepare local dirs -rm -rf ~/.cache ~/.config/_cache /tmp/${USER}-cache -rm -rf ~/.fdignore ~/.fzf.bash ~/.fzf.zsh ~/.gitconfig ~/.gitignore ~/.history ~/.tmux.conf ~/.vim* ~/.zcomp* ~/.zsh* -mkdir -p /tmp/${USER}-cache/ ~/.config ~/.local/bin ~/.local/share -chmod 700 /tmp/${USER}-cache - -# export XDG stuff for later use +# variables +GIT_DIR=~/.local/git export XDG_CACHE_HOME=/tmp/${USER}-cache export XDG_CONFIG_HOME=$HOME/.config export XDG_DATA_HOME=$HOME/.local/share export XDG_STATE_HOME=$HOME/.local/state -# prepare repository -mkdir -p ~/.local/git -rm -rf ~/.local/git/dotfiles -git clone https://git.insomniac.pl/ftpd/dotfiles ~/.local/git/dotfiles - -# nvim +# clean + prepare local dirs +rm -rf ~/.cache ~/.config/_cache $XDG_CACHE_HOME rm -rf ~/.config/nvim ~/.local/share/nvim ~/.local/state/nvim -git clone --depth 1 https://github.com/AstroNvim/AstroNvim $XDG_CONFIG_HOME/nvim -ln -sf ~/.local/git/dotfiles/astronvim $XDG_CONFIG_HOME/nvim/lua/user +rm -rf ~/.fdignore ~/.fzf.bash ~/.fzf.zsh ~/.gitconfig ~/.gitignore ~/.history ~/.tmux.conf ~/.vim* ~/.zcomp* ~/.zsh* +mkdir -p ~/.local/bin $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME +chmod 700 $XDG_CACHE_HOME + +# prepare repository +mkdir -p $GIT_DIR +rm -rf $GIT_DIR/dotfiles +git clone https://git.insomniac.pl/ftpd/dotfiles $GIT_DIR/dotfiles # zsh modules -mkdir -p ~/.local/git/zsh_modules -rm -rf ~/.local/git/zsh_modules/* +mkdir -p $GIT_DIR/zsh_modules +rm -rf $GIT_DIR/zsh_modules/* for module in mfaerevaag/wd romkatv/powerlevel10k zdharma-continuum/fast-syntax-highlighting; do - git clone https://github.com/${module} ~/.local/git/zsh_modules/${module#*/} + git clone https://github.com/${module} $GIT_DIR/zsh_modules/${module#*/} done # configs -for i in ~/.local/git/dotfiles/_cli/*; do +for i in $GIT_DIR/dotfiles/_cli/*; do rm -rf $XDG_CONFIG_HOME/$(basename $i) - ln -sf ~/.local/git/dotfiles/_cli/$(basename $i) $XDG_CONFIG_HOME/ + ln -sf $GIT_DIR/dotfiles/_cli/$(basename $i) $XDG_CONFIG_HOME/ done