├── .DS_Store ├── lua ├── .DS_Store ├── mood-scripts │ ├── restart-lsp.lua │ ├── layout_strategy.lua │ ├── install-config.lua │ ├── formatter_rubocop.lua │ ├── auto-save-session.lua │ ├── quit_neovim.lua │ ├── command-on-start.lua │ ├── icons.lua │ ├── rubocop.lua │ ├── ask_delete.lua │ ├── bg-color.lua │ ├── tmux-integration.lua │ ├── statusline.lua │ ├── open-files.lua │ ├── setup-telescope.lua │ ├── custom_telescope.lua │ ├── quick-consult.lua │ └── rspec.lua ├── plugins │ ├── telescope-cmdline-word.lua │ ├── vim-visual-multi.lua │ ├── persistence.lua │ ├── ctrlsf.lua │ ├── trouble.lua │ ├── codeium.lua │ ├── spectra.lua │ ├── illuminate.lua │ ├── mini.lua │ ├── autopairs.lua │ ├── lualine.lua │ ├── search-replace.lua │ ├── dashboard_plugin.lua │ ├── telescope.lua │ ├── tree-sitter.lua │ ├── lsp.lua │ └── init.lua ├── core │ ├── start.lua │ ├── plugins.lua │ ├── settings.lua │ ├── globals.lua │ ├── set.lua │ └── autocmds.lua ├── utils │ ├── buf_count.lua │ ├── maximize.lua │ ├── valid_listed_buffers.lua │ ├── insert_rspec.lua │ ├── goto_last_file_buffer.lua │ ├── buffer_path_display.lua │ └── table_functions.lua ├── helpers │ ├── user-functions.lua │ ├── term-functions.lua │ └── vim-functions.lua └── tutorial │ └── init.lua ├── extra ├── examples │ ├── templates │ │ ├── javascriptreact.lua │ │ ├── typescriptreact.lua │ │ └── ruby.lua │ ├── before_start.lua │ ├── vs-snippets │ │ ├── typescript.json │ │ ├── typescriptreact.json │ │ ├── package.json │ │ └── eruby.json │ ├── lazygit.yml │ ├── plugins.lua │ ├── after_start.lua │ ├── config.lua │ ├── keybindings.lua │ └── lsp.lua ├── .tmux.conf ├── tutorial.rb ├── Gruvbox Dark.itermcolors ├── alacritty.yml └── alacritty.toml ├── .gitignore ├── bin ├── test.sh ├── basic_clean.sh ├── clean_all_except_config.sh ├── clean.sh ├── setup.sh └── mood-installer.sh ├── .luarc.json ├── init.lua ├── helpers └── vim_formatter.rb ├── README.md └── lazy-lock.json /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/otavioschwanck/mood-nvim/HEAD/.DS_Store -------------------------------------------------------------------------------- /lua/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/otavioschwanck/mood-nvim/HEAD/lua/.DS_Store -------------------------------------------------------------------------------- /extra/examples/templates/javascriptreact.lua: -------------------------------------------------------------------------------- 1 | return require("templates.typescriptreact") 2 | -------------------------------------------------------------------------------- /extra/examples/before_start.lua: -------------------------------------------------------------------------------- 1 | -- This code is runned before neovim starts 2 | 3 | vim.cmd("colorscheme catppuccin") 4 | -------------------------------------------------------------------------------- /lua/mood-scripts/restart-lsp.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.restart_lsp() 4 | vim.diagnostic.reset() 5 | 6 | vim.cmd("LspStart") 7 | end 8 | 9 | return M 10 | -------------------------------------------------------------------------------- /extra/examples/vs-snippets/typescript.json: -------------------------------------------------------------------------------- 1 | { 2 | "af": { 3 | "prefix": ["af"], 4 | "body": "($1) => ${2:{ ${3:} \\}}", 5 | "description": "arrow function" 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /extra/examples/vs-snippets/typescriptreact.json: -------------------------------------------------------------------------------- 1 | { 2 | "af": { 3 | "prefix": ["af"], 4 | "body": "($1) => ${2:{ ${3:} \\}}", 5 | "description": "arrow function" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/telescope-cmdline-word.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "otavioschwanck/telescope-cmdline-word.nvim", 4 | event = "VeryLazy", 5 | opts = { 6 | add_mappings = true, 7 | }, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Files 2 | plugin/ 3 | lua/templates/* 4 | user.vim 5 | user-snippets/ 6 | coc-settings.json 7 | lua/user-plugins.lua 8 | lua/user_lsp.lua 9 | databases/ 10 | lua/user/* 11 | /vs-snippets 12 | -------------------------------------------------------------------------------- /lua/core/start.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.setup() 4 | require('telescope').setup({ 5 | defaults = { 6 | file_ignore_patterns = vim.g.folder_to_ignore, 7 | } 8 | }) 9 | end 10 | 11 | return M 12 | -------------------------------------------------------------------------------- /bin/test.sh: -------------------------------------------------------------------------------- 1 | # Pega o caminho completo do arquivo de configuração do Neovim 2 | MYVIMRC_PATH="$MYVIMRC" 3 | 4 | # Usa 'dirname' para pegar somente o diretório 5 | CONFIG_DIR=$(dirname "$MYVIMRC_PATH") 6 | 7 | # Exibe o diretório 8 | echo "$CONFIG_DIR" 9 | -------------------------------------------------------------------------------- /extra/examples/lazygit.yml: -------------------------------------------------------------------------------- 1 | gui: 2 | showIcons: true 3 | showFileTree: false 4 | theme: 5 | selectedLineBgColor: 6 | - reverse 7 | 8 | keybinding: 9 | files: 10 | toggleTreeView: 't' 11 | 12 | git: 13 | paging: 14 | colorArg: always 15 | pager: delta --dark --paging=never 16 | -------------------------------------------------------------------------------- /bin/basic_clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TMUX=~/.tmux.conf 4 | if test -f "$TMUX"; then 5 | rm $TMUX 6 | echo "$TMUX Removed successfully..." 7 | fi 8 | 9 | ALACRITTY=~/.config/alacritty/alacritty.toml 10 | if test -f "$ALACRITTY"; then 11 | rm $ALACRITTY 12 | echo "$ALACRITTY Removed successfully..." 13 | fi 14 | -------------------------------------------------------------------------------- /extra/examples/plugins.lua: -------------------------------------------------------------------------------- 1 | -- Plugins ------------- 2 | -- Add your plugins here 3 | ------------------------ 4 | 5 | local user_plugins = { 6 | -- { 'goolord/alpha-nvim', enabled = false }, 7 | 'kat0h/nyancat.vim', 8 | -- { 'glacambre/firenvim', run = function() vim.fn['firenvim#install'](0) end } 9 | } 10 | 11 | return user_plugins 12 | 13 | -------------------------------------------------------------------------------- /.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", 3 | "Lua.diagnostics.disable": [ 4 | "unused-local", 5 | "redefined-local" 6 | ], 7 | "Lua.diagnostics.globals": [ 8 | "vim", 9 | "use", 10 | "require", 11 | "table" 12 | ] 13 | } -------------------------------------------------------------------------------- /lua/mood-scripts/layout_strategy.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.grep_layout() 4 | local columns = vim.o.columns 5 | local lines = vim.o.lines 6 | 7 | if columns > 280 and lines > 30 then 8 | return "horizontal" 9 | elseif lines > 30 then 10 | return "vertical" 11 | else 12 | return "flex" 13 | end 14 | end 15 | 16 | return M 17 | -------------------------------------------------------------------------------- /lua/mood-scripts/install-config.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.setup() 4 | vim.cmd([[ 5 | function s:InstallConfigs() 6 | execute "!sh " .. fnamemodify(expand("$MYVIMRC"), ":h") .. "/bin/setup.sh" 7 | endfunction 8 | 9 | command! InstallConfigs :call s:InstallConfigs() 10 | 11 | silent :InstallConfigs 12 | ]]) 13 | end 14 | 15 | return M 16 | -------------------------------------------------------------------------------- /extra/examples/after_start.lua: -------------------------------------------------------------------------------- 1 | -- AFTER START------------------------------------- 2 | -- Commands to run after neovim is started -------- 3 | --------------------------------------------------- 4 | 5 | -- Autoload session, first uncomment that: 6 | -- require('persistence').load() 7 | -- 8 | -- Go to your plugins with SPC f p and add: 9 | -- { 'goolord/alpha-nvim', enabled = false } 10 | -- inside user_plugins 11 | -------------------------------------------------------------------------------- /lua/mood-scripts/formatter_rubocop.lua: -------------------------------------------------------------------------------- 1 | local util = require("formatter.util") 2 | 3 | local function rubocop() 4 | return { 5 | exe = "bundle", 6 | args = { 7 | "exec", 8 | "rubocop", 9 | "-A", 10 | "--stdin", 11 | util.escape_path(util.get_current_buffer_file_path()), 12 | "--format", 13 | "files", 14 | "--stderr", 15 | }, 16 | stdin = true, 17 | } 18 | end 19 | 20 | return rubocop 21 | -------------------------------------------------------------------------------- /lua/plugins/vim-visual-multi.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "mg979/vim-visual-multi", 4 | init = function() 5 | vim.cmd( 6 | [[ 7 | let g:VM_leader="n" 8 | let g:VM_check_mappings = 0 9 | let g:VM_maps = {} 10 | let g:VM_maps['Add Cursor Down'] = '' 11 | let g:VM_maps['Add Cursor Up'] = '' 12 | ]] 13 | ) 14 | end, 15 | event = "VeryLazy" 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /extra/examples/vs-snippets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "otavio-snippets", 3 | "contributes": { 4 | "snippets": [ 5 | { 6 | "language": [ 7 | "ruby" 8 | ], 9 | "path": "./ruby.json" 10 | }, 11 | { 12 | "language": [ 13 | "typescriptreact" 14 | ], 15 | "path": "./typescriptreact.json" 16 | }, 17 | { 18 | "language": [ 19 | "typescript" 20 | ], 21 | "path": "./typescript.json" 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lua/plugins/persistence.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "folke/persistence.nvim", 4 | event = "BufReadPre", 5 | config = function() 6 | require("persistence").setup({ 7 | dir = vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/"), -- directory where session files are saved 8 | options = { "buffers", "curdir", "tabpages", "winsize", "globals" }, 9 | pre_save = function() 10 | vim.api.nvim_exec_autocmds("User", { pattern = "SessionSavePre" }) 11 | end, 12 | }) 13 | end, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /bin/clean_all_except_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONFIG_DIR=$(dirname "$MYVIMRC") 4 | 5 | USER_LSP="$CONFIG_DIR/lua/user/lsp.lua" 6 | if test -f "$USER_LSP"; then 7 | rm "$USER_LSP" 8 | echo "$USER_LSP removed successfully..." 9 | fi 10 | 11 | TMUX=~/.tmux.conf 12 | if test -f "$TMUX"; then 13 | rm $TMUX 14 | echo "$TMUX Removed successfully..." 15 | fi 16 | 17 | ALACRITTY=~/.config/alacritty/alacritty.toml 18 | if test -f "$ALACRITTY"; then 19 | rm $ALACRITTY 20 | echo "$ALACRITTY Removed successfully..." 21 | fi 22 | -------------------------------------------------------------------------------- /lua/mood-scripts/auto-save-session.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.save_session(ft) 4 | if vim.g.scheduled_save_session == true then 5 | return 6 | end 7 | 8 | if vim.g.exiting == false and ft.file and ft.file ~= "" then 9 | vim.g.scheduled_save_session = true 10 | 11 | vim.fn.timer_start(1500, function() 12 | vim.api.nvim_exec_autocmds('User', { pattern = 'SessionSavePre' }) 13 | 14 | require('persistence').save() 15 | 16 | vim.g.scheduled_save_session = false 17 | end) 18 | end 19 | end 20 | 21 | return M 22 | 23 | -------------------------------------------------------------------------------- /lua/plugins/ctrlsf.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "dyng/ctrlsf.vim", 4 | event = "VeryLazy", 5 | config = function() 6 | vim.g.ctrlsf_mapping = { 7 | open = { "", "o" }, 8 | openb = "O", 9 | split = "", 10 | vsplit = "", 11 | tab = "t", 12 | tabb = "T", 13 | popen = "p", 14 | popenf = "P", 15 | quit = "q", 16 | next = "", 17 | prev = "", 18 | nfile = "", 19 | pfile = "", 20 | pquit = "q", 21 | loclist = "", 22 | chgmode = "", 23 | stop = "", 24 | } 25 | end, 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lua/mood-scripts/quit_neovim.lua: -------------------------------------------------------------------------------- 1 | local filter = vim.tbl_filter 2 | 3 | local function quit_neovim() 4 | local term = require('tmux-awesome-manager') 5 | 6 | local keyset = {} 7 | local n = 0 8 | 9 | for k, v in pairs(vim.g.tmux_open_terms) do 10 | n = n + 1 11 | keyset[n] = k 12 | end 13 | 14 | if n > 0 then 15 | local response = vim.fn.input("There is some terminals open. Close then before exit? y/n ") 16 | 17 | if response == 'y' or response == 's' or response == 'Y' then 18 | term.kill_all_terms() 19 | end 20 | end 21 | end 22 | 23 | return quit_neovim 24 | -------------------------------------------------------------------------------- /lua/utils/buf_count.lua: -------------------------------------------------------------------------------- 1 | local function buf_count() 2 | local win_count = vim.fn.winnr('$') 3 | 4 | local buffers = {} 5 | 6 | for i = 1, win_count, 1 do 7 | table.insert(buffers, vim.fn.winbufnr(i)) 8 | end 9 | 10 | local real_buffers = {} 11 | 12 | for i = 1, #buffers, 1 do 13 | if (vim.fn.getbufvar(buffers[i], '&buftype', 'ERROR') == 'terminal' or vim.fn.getbufvar(buffers[i], '&filetype', 'ERROR')) 14 | and vim.fn.bufname(buffers[i]) ~= '' then 15 | table.insert(real_buffers, buffers[i]) 16 | end 17 | end 18 | 19 | return #real_buffers 20 | end 21 | 22 | return buf_count 23 | -------------------------------------------------------------------------------- /lua/core/plugins.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.setup() 4 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 5 | if not vim.loop.fs_stat(lazypath) then 6 | vim.fn.system({ 7 | "git", 8 | "clone", 9 | "--filter=blob:none", 10 | "https://github.com/folke/lazy.nvim.git", 11 | "--branch=stable", -- latest stable release 12 | lazypath, 13 | }) 14 | end 15 | 16 | vim.opt.runtimepath:prepend(lazypath) 17 | 18 | require("lazy").setup("plugins", { 19 | change_detection = { 20 | enabled = false, 21 | notify = false, 22 | }, 23 | lazy = true, 24 | }) 25 | end 26 | 27 | return M 28 | -------------------------------------------------------------------------------- /lua/plugins/trouble.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "folke/trouble.nvim", 4 | cmd = { "TroubleToggle", "Trouble" }, 5 | opts = { use_diagnostic_signs = true }, 6 | keys = { 7 | { "xx", "TroubleToggle document_diagnostics", desc = "Document Diagnostics (Trouble)" }, 8 | { "xX", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" }, 9 | { "xL", "TroubleToggle loclist", desc = "Location List (Trouble)" }, 10 | { "xQ", "TroubleToggle quickfix", desc = "Quickfix List (Trouble)" }, 11 | }, 12 | }, 13 | } 14 | 15 | -------------------------------------------------------------------------------- /lua/utils/maximize.lua: -------------------------------------------------------------------------------- 1 | local maximize = function() 2 | local currentLine = vim.fn.line('.') 3 | 4 | vim.cmd("tabnew %") 5 | vim.cmd("" .. currentLine) 6 | vim.cmd("norm! zz") 7 | 8 | vim.g.maximized = true 9 | end 10 | 11 | local toggleMaximize = function() 12 | if vim.g.maximized then 13 | if vim.fn.tabpagenr() ~= 1 then 14 | vim.cmd("tabclose") 15 | 16 | vim.g.maximized = false 17 | else 18 | vim.g.maximized = false 19 | 20 | maximize() 21 | end 22 | else 23 | if require('utils.buf_count')() > 1 then 24 | maximize() 25 | end 26 | end 27 | end 28 | 29 | return toggleMaximize 30 | -------------------------------------------------------------------------------- /lua/utils/valid_listed_buffers.lua: -------------------------------------------------------------------------------- 1 | local function return_listed_valid_buffers() 2 | local buffers = vim.api.nvim_list_bufs() 3 | local buffersToUse = {} 4 | local bufferIndex = 1 5 | 6 | for i=1,#buffers,1 do 7 | local buf = buffers[i] 8 | local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf)) 9 | 10 | local buf_type = vim.fn.getbufvar(buf, '&buftype', 'ERROR') 11 | 12 | if not (byte_size > 1024 * 128) and (vim.fn.buflisted(buf) == 1 or buf_type == 'terminal' or buf_type == 'nofile') then -- 1 Megabyte max 13 | buffersToUse[bufferIndex] = buf 14 | bufferIndex = bufferIndex + 1 15 | end 16 | end 17 | 18 | return buffersToUse 19 | end 20 | 21 | return return_listed_valid_buffers 22 | -------------------------------------------------------------------------------- /lua/plugins/codeium.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "Exafunction/codeium.vim", 4 | event = "InsertEnter", 5 | config = function() 6 | vim.g.codeium_disable_bindings = 1 7 | vim.g.codeium_filetypes = { TelescopePrompt = false } 8 | 9 | vim.keymap.set("i", "", function() 10 | return vim.fn["codeium#Accept"]() 11 | end, { expr = true }) 12 | vim.keymap.set("i", "", function() 13 | return vim.fn["codeium#CycleCompletions"](1) 14 | end, { expr = true }) 15 | vim.keymap.set("i", "", function() 16 | return vim.fn["codeium#CycleCompletions"](-1) 17 | end, { expr = true }) 18 | vim.keymap.set("i", "", function() 19 | return vim.fn["codeium#Clear"]() 20 | end, { expr = true }) 21 | end, 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /lua/plugins/spectra.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "windwp/nvim-spectre", 4 | event = "VeryLazy", 5 | config = function() 6 | local args = {} 7 | local is_mac = vim.loop.os_uname().sysname == "Darwin" 8 | 9 | if is_mac then 10 | args = { 11 | replace_engine = { 12 | ["sed"] = { 13 | cmd = "sed", 14 | args = { 15 | "-i", 16 | "", 17 | "-E", 18 | } 19 | }, 20 | } 21 | } 22 | end 23 | 24 | require("spectre").setup(args) 25 | end, 26 | keys = { 27 | { "sr", function() require("spectre").open() end, desc = "Replace in files (Spectre)" }, 28 | }, 29 | }, 30 | } 31 | -------------------------------------------------------------------------------- /lua/helpers/user-functions.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.call_term(command, title, unique, close_after_create, term_opts) 4 | local opts = term_opts or {} 5 | 6 | local pre = opts.pre_command or '' 7 | 8 | if opts.input then 9 | command = command .. " ' . " .. 'input("' .. opts.input .. '")' 10 | else 11 | command = command .. "'" 12 | end 13 | 14 | return { pre .. 15 | "call OpenTerm('" .. command .. ", '" .. title .. "', " .. unique .. ", " .. close_after_create .. ")", title } 16 | end 17 | 18 | function M.find_in_folder(folder, title) 19 | return { "call FindInFolder('" .. folder .. "', '" .. title .. "')", title } 20 | end 21 | 22 | function M.find_on_folder(command, folder, title) 23 | return { command, "call FindInFolder('" .. folder .. "', '" .. title .. "')", desc = title } 24 | end 25 | 26 | return M 27 | -------------------------------------------------------------------------------- /lua/mood-scripts/command-on-start.lua: -------------------------------------------------------------------------------- 1 | local function osExecute(cmd) 2 | local fileHandle = assert(io.popen(cmd, 'r')) 3 | local commandOutput = assert(fileHandle:read('*a')) 4 | local returnTable = {fileHandle:close()} 5 | return commandOutput,returnTable[3] 6 | end 7 | 8 | local function Split(s, delimiter) 9 | local result = {}; 10 | 11 | for match in (s..delimiter):gmatch("(.-)"..delimiter) do 12 | table.insert(result, match); 13 | end 14 | return result; 15 | end 16 | 17 | local function restart_all() 18 | local tmux_windows = Split(osExecute('tmux list-window -F "#I"'), "\n") 19 | table.remove(tmux_windows, #tmux_windows) 20 | 21 | for __, number in ipairs(tmux_windows) do 22 | osExecute('tmux send-keys -t ' .. number .. ' C-\\\\ C-n') 23 | osExecute('tmux send-keys -t ' .. number .. ' " #"') 24 | end 25 | end 26 | 27 | return { 28 | restart_all = restart_all, 29 | } 30 | -------------------------------------------------------------------------------- /lua/plugins/illuminate.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "RRethy/vim-illuminate", 4 | event = { "BufReadPost", "BufNewFile" }, 5 | opts = { 6 | delay = 200, 7 | filetypes_denylist = { 8 | "dirbuf", 9 | "dirvish", 10 | "fugitive", 11 | "NvimTree", 12 | }, 13 | }, 14 | config = function(_, opts) 15 | require("illuminate").configure(opts) 16 | vim.api.nvim_create_autocmd("FileType", { 17 | callback = function() 18 | local buffer = vim.api.nvim_get_current_buf() 19 | pcall(vim.keymap.del, "n", "]]", { buffer = buffer }) 20 | pcall(vim.keymap.del, "n", "[[", { buffer = buffer }) 21 | end, 22 | }) 23 | end, 24 | -- stylua: ignore 25 | keys = { 26 | { "]]", function() require("illuminate").goto_next_reference(false) end, desc = "Next Reference", }, 27 | { "[[", function() require("illuminate").goto_prev_reference(false) end, desc = "Prev Reference" }, 28 | }, 29 | }, 30 | } 31 | -------------------------------------------------------------------------------- /lua/mood-scripts/icons.lua: -------------------------------------------------------------------------------- 1 | return { 2 | Namespace = "󰌗", 3 | Text = "󰉿", 4 | Method = "󰆧", 5 | Function = "󰆧", 6 | Constructor = "", 7 | Field = "󰜢", 8 | Variable = "󰀫", 9 | Class = "󰠱", 10 | Interface = "", 11 | Module = "", 12 | Property = "󰜢", 13 | Unit = "󰑭", 14 | Value = "󰎠", 15 | Enum = "", 16 | Keyword = "󰌋", 17 | Snippet = "", 18 | Color = "󰏘", 19 | File = "󰈚", 20 | Reference = "󰈇", 21 | Folder = "󰉋", 22 | EnumMember = "", 23 | Constant = "󰏿", 24 | Struct = "󰙅", 25 | Event = "", 26 | Operator = "󰆕", 27 | TypeParameter = "󰊄", 28 | Table = "", 29 | Object = "󰅩", 30 | Tag = "", 31 | Array = "[]", 32 | Boolean = "", 33 | Number = "", 34 | Null = "󰟢", 35 | String = "󰉿", 36 | Calendar = "", 37 | Watch = "󰥔", 38 | Package = "", 39 | Copilot = "", 40 | Codeium = "", 41 | TabNine = "", 42 | nvim_lsp = 'λ', 43 | luasnip = '󰅩', 44 | buffer = '', 45 | path = '󰉋', 46 | } 47 | -------------------------------------------------------------------------------- /lua/utils/insert_rspec.lua: -------------------------------------------------------------------------------- 1 | local split = require("utils.table_functions").Split 2 | local toCamel = require("utils.table_functions").camelCaseB 3 | local singularize = require("utils.table_functions").singularize 4 | 5 | local function insert_test_template() 6 | local relative_path = vim.fn.fnamemodify(vim.fn.expand("%"), ":~:.") 7 | local splitted_path = split(relative_path, "/") 8 | local class_name = "" 9 | 10 | for i = 3, #splitted_path do 11 | class_name = class_name .. toCamel(split(splitted_path[i], "_spec.rb")[1]) 12 | 13 | if i < #splitted_path then 14 | class_name = class_name .. "::" 15 | end 16 | end 17 | 18 | local type = singularize(splitted_path[2]) 19 | 20 | local text_to_insert = { 21 | 'require "rails_helper"', 22 | "", 23 | "RSpec.describe " .. class_name .. ", type: :" .. type .. " do", 24 | "", 25 | "end", 26 | } 27 | 28 | vim.api.nvim_buf_set_lines(0, 0, 4, false, text_to_insert) 29 | vim.fn.feedkeys("3jI ") 30 | end 31 | 32 | return insert_test_template 33 | -------------------------------------------------------------------------------- /lua/plugins/mini.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "echasnovski/mini.bufremove", 4 | keys = { 5 | { 6 | "k", 7 | function() 8 | require("mini.bufremove").delete(0, false) 9 | end, 10 | desc = "Delete Buffer", 11 | }, 12 | { 13 | "K", 14 | function() 15 | require("mini.bufremove").delete(0, true) 16 | end, 17 | desc = "Delete Buffer (Force)", 18 | }, 19 | }, 20 | event = "VeryLazy", 21 | }, 22 | { 23 | "echasnovski/mini.ai", 24 | -- keys = { 25 | -- { "a", mode = { "x", "o" } }, 26 | -- { "i", mode = { "x", "o" } }, 27 | -- }, 28 | event = "VeryLazy", 29 | opts = function() 30 | local ai = require("mini.ai") 31 | return { 32 | n_lines = 500, 33 | custom_textobjects = { 34 | o = ai.gen_spec.treesitter({ 35 | a = { "@block.outer", "@conditional.outer", "@loop.outer" }, 36 | i = { "@block.inner", "@conditional.inner", "@loop.inner" }, 37 | }, {}), 38 | f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}), 39 | c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}), 40 | }, 41 | } 42 | end, 43 | }, 44 | } 45 | -------------------------------------------------------------------------------- /extra/examples/templates/typescriptreact.lua: -------------------------------------------------------------------------------- 1 | local utils = require("new-file-template.utils") 2 | 3 | local function base_template(relative_path, filename) 4 | local file = vim.split(filename, "%.")[1] 5 | 6 | return string.format( 7 | [[ 8 | const %s = () => { 9 | |cursor| 10 | } 11 | 12 | export default %s]], 13 | file, 14 | file 15 | ) 16 | end 17 | 18 | local function index_template(relative_path, filename) 19 | local file = vim.split(relative_path, "/") 20 | file = file[#file] 21 | 22 | return string.format( 23 | [[ 24 | export * from "./%s";|cursor|]], 25 | file 26 | ) 27 | end 28 | 29 | --- @param opts table 30 | --- A table containing the following fields: 31 | --- - `full_path` (string): The full path of the new file, e.g., "lua/new-file-template/templates/init.lua". 32 | --- - `relative_path` (string): The relative path of the new file, e.g., "lua/new-file-template/templates/init.lua". 33 | --- - `filename` (string): The filename of the new file, e.g., "init.lua". 34 | return function(opts) 35 | local template = { 36 | { pattern = ".*components/.*index.tsx", content = index_template }, 37 | { pattern = ".*components/.*", content = base_template }, 38 | } 39 | 40 | return utils.find_entry(template, opts) 41 | end 42 | -------------------------------------------------------------------------------- /lua/plugins/autopairs.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "windwp/nvim-autopairs", 4 | event = "VeryLazy", 5 | config = function() 6 | require("nvim-autopairs").setup({ 7 | disable_filetype = { "TelescopePrompt", "vim", "norg" }, 8 | }) 9 | 10 | local npairs = require("nvim-autopairs") 11 | local Rule = require("nvim-autopairs.rule") 12 | 13 | npairs.add_rules({ 14 | Rule(" ", " "):with_pair(function(opts) 15 | local pair = opts.line:sub(opts.col - 1, opts.col) 16 | return vim.tbl_contains({ "()", "[]", "{}" }, pair) 17 | end), 18 | Rule("( ", " )") 19 | :with_pair(function() 20 | return false 21 | end) 22 | :with_move(function(opts) 23 | return opts.prev_char:match(".%)") ~= nil 24 | end) 25 | :use_key(")"), 26 | Rule("{ ", " }") 27 | :with_pair(function() 28 | return false 29 | end) 30 | :with_move(function(opts) 31 | return opts.prev_char:match(".%}") ~= nil 32 | end) 33 | :use_key("}"), 34 | Rule("[ ", " ]") 35 | :with_pair(function() 36 | return false 37 | end) 38 | :with_move(function(opts) 39 | return opts.prev_char:match(".%]") ~= nil 40 | end) 41 | :use_key("]"), 42 | }) 43 | end, 44 | }, 45 | } 46 | -------------------------------------------------------------------------------- /lua/helpers/term-functions.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.setup() 4 | vim.cmd([[ 5 | function OpenTerm(command, name, unique, close_after_create) 6 | lua vim.notify("Your mood config.lua is outdated. Fixing for you.") 7 | 8 | lua vim.fn.system("mv " .. vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/config.lua ~/.config/nvim/lua/user/config.lua.bak") 9 | 10 | lua vim.notify("Moved your old config to ~/.config/nvim/lua/user/config.lua") 11 | lua vim.notify("IMPORTANT: Please restart your neovim.") 12 | endfunction 13 | 14 | function ResetRailsDb(command) 15 | call KillRubyInstances() 16 | 17 | lua require('tmux-awesome-manager').execute_command({ cmd = vim.api.nvim_eval('a:command'), name = 'db:reset', open_as = 'pane', focus_when_call = false, visit_first_call = true, size='25%' }) 18 | endfunction 19 | 20 | function KillRubyInstances() 21 | execute "silent !killall -9 rails ruby spring bundle;lsof -i :3000 | grep LISTEN | awk '{print $2}' | xargs kill;" 22 | 23 | lua require('notify')('Ruby Instances killed.', 'info', { title='mooD' }) 24 | 25 | call timer_start(2000, {-> execute("LspStart solargraph") }) 26 | endfunction 27 | ]]) 28 | end 29 | 30 | return M 31 | -------------------------------------------------------------------------------- /lua/plugins/lualine.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvim-lualine/lualine.nvim", 4 | dependencies = { "nvim-tree/nvim-web-devicons" }, 5 | event = "VeryLazy", 6 | init = function() 7 | vim.g.lualine_laststatus = 3 8 | if vim.fn.argc(-1) > 0 then 9 | -- set an empty statusline till lualine loads 10 | vim.o.statusline = " " 11 | else 12 | -- hide the statusline on the starter page 13 | vim.o.laststatus = 0 14 | end 15 | end, 16 | config = function() 17 | vim.o.laststatus = vim.g.lualine_laststatus 18 | 19 | local open_terms = { 20 | require("tmux-awesome-manager.src.integrations.status").open_terms, 21 | color = { fg = "green" }, 22 | } 23 | 24 | require("lualine").setup({ 25 | options = { 26 | disabled_filetypes = { 27 | statusline = { "dashboard" }, 28 | }, 29 | component_separators = { left = "", right = "" }, 30 | section_separators = { left = "", right = "" }, 31 | globalstatus = true, 32 | }, 33 | sections = { 34 | lualine_a = { "mode" }, 35 | lualine_b = {}, 36 | lualine_c = { "diagnostics", "diff" }, 37 | lualine_x = { open_terms, "branch" }, 38 | lualine_y = { "progress" }, 39 | lualine_z = { "location" }, 40 | }, 41 | }) 42 | end, 43 | }, 44 | } 45 | -------------------------------------------------------------------------------- /lua/plugins/search-replace.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "roobert/search-replace.nvim", 4 | event = "VeryLazy", 5 | config = function() 6 | require("search-replace").setup({}) 7 | 8 | local opts = {} 9 | 10 | local get_selected_lines_count = function() 11 | local start_line = vim.fn.getpos("v")[2] 12 | local end_line = vim.fn.getpos(".")[2] 13 | 14 | return math.abs(end_line - start_line) + 1 15 | end 16 | 17 | local call_visual_command = function() 18 | local current_mode = vim.fn.mode() 19 | local number_of_lines_selected_in_visual_mode = get_selected_lines_count() 20 | 21 | if (current_mode == "V" or current_mode == "") and number_of_lines_selected_in_visual_mode == 1 then 22 | vim.cmd("SearchReplaceSingleBufferCWord") 23 | elseif current_mode == "V" or current_mode == "" then 24 | vim.cmd("SearchReplaceWithinVisualSelection") 25 | else 26 | vim.cmd("SearchReplaceSingleBufferVisualSelection") 27 | end 28 | end 29 | 30 | vim.keymap.set("x", "gq", call_visual_command, opts) 31 | 32 | vim.api.nvim_set_keymap("n", "gq", "SearchReplaceSingleBufferCWord", opts) 33 | vim.api.nvim_set_keymap("n", "gQ", "SearchReplaceSingleBufferCExpr", opts) 34 | end, 35 | }, 36 | } 37 | -------------------------------------------------------------------------------- /lua/utils/goto_last_file_buffer.lua: -------------------------------------------------------------------------------- 1 | local filter = vim.tbl_filter 2 | 3 | local function map(tbl, f) 4 | local t = {} 5 | for k,v in pairs(tbl) do 6 | t[k] = f(v) 7 | end 8 | 9 | return t 10 | end 11 | 12 | local function goto_last_file_buffer() 13 | local bufnrs = filter(function(b) 14 | if vim.fn.getbufvar(b, '&filetype', 'ERROR') == '' then 15 | return false 16 | end 17 | 18 | if not vim.fn.buflisted(b) == 1 then 19 | return false 20 | end 21 | 22 | if vim.fn.bufname(b) == '' then 23 | return false 24 | end 25 | 26 | return true 27 | end, require('utils.valid_listed_buffers')()) 28 | 29 | local times = map(bufnrs, function(item) return vim.fn.getbufvar(item, 'visit_time') or nil end) 30 | 31 | if #bufnrs > 0 then 32 | if #times > 0 then 33 | local higherTime = 0 34 | local higherId = 0 35 | 36 | for i = 1, #times, 1 do 37 | local cur_time = times[i] 38 | 39 | if cur_time == '' or not cur_time then 40 | cur_time = 1 41 | end 42 | 43 | if cur_time > higherTime then 44 | higherTime = cur_time 45 | higherId = i 46 | end 47 | end 48 | 49 | vim.cmd("b " .. bufnrs[higherId]) 50 | end 51 | else 52 | vim.cmd("tabnew") 53 | end 54 | end 55 | 56 | return goto_last_file_buffer 57 | -------------------------------------------------------------------------------- /bin/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONFIG_DIR=$(dirname "$MYVIMRC") 4 | 5 | USER_CONFIG="$CONFIG_DIR/lua/user/config.lua" 6 | if test -f "$USER_CONFIG"; then 7 | rm "$USER_CONFIG" 8 | echo "$USER_CONFIG removed successfully..." 9 | fi 10 | 11 | BEFORE_START="$CONFIG_DIR/lua/user/before_start.lua" 12 | if test -f "$BEFORE_START"; then 13 | rm "$BEFORE_START" 14 | echo "$BEFORE_START removed successfully..." 15 | fi 16 | 17 | AFTER_CONFIG="$CONFIG_DIR/lua/user/after_start.lua" 18 | if test -f "$AFTER_CONFIG"; then 19 | rm "$AFTER_CONFIG" 20 | echo "$AFTER_CONFIG removed successfully..." 21 | fi 22 | 23 | KEYBINDINGS="$CONFIG_DIR/lua/user/keybindings.lua" 24 | if test -f "$KEYBINDINGS"; then 25 | rm "$KEYBINDINGS" 26 | echo "$KEYBINDINGS removed successfully..." 27 | fi 28 | 29 | USER_LSP="$CONFIG_DIR/lua/user/lsp.lua" 30 | if test -f "$USER_LSP"; then 31 | rm "$USER_LSP" 32 | echo "$USER_LSP removed successfully..." 33 | fi 34 | 35 | TMUX=~/.tmux.conf 36 | if test -f "$TMUX"; then 37 | rm "$TMUX" 38 | echo "$TMUX removed successfully..." 39 | fi 40 | 41 | ALACRITTY=~/.config/alacritty/alacritty.toml 42 | if test -f "$ALACRITTY"; then 43 | rm "$ALACRITTY" 44 | echo "$ALACRITTY removed successfully..." 45 | fi 46 | 47 | PLUGINS="$CONFIG_DIR/lua/user/plugins.lua" 48 | if test -f "$PLUGINS"; then 49 | rm "$PLUGINS" 50 | echo "$PLUGINS removed successfully..." 51 | fi 52 | -------------------------------------------------------------------------------- /lua/mood-scripts/rubocop.lua: -------------------------------------------------------------------------------- 1 | vim.notify = require("notify") 2 | 3 | local function filter_inplace(arr, func) 4 | local new_index = 1 5 | local size_orig = #arr 6 | for old_index, v in ipairs(arr) do 7 | if func(v, old_index) then 8 | arr[new_index] = v 9 | new_index = new_index + 1 10 | end 11 | end 12 | for i = new_index, size_orig do 13 | arr[i] = nil 14 | end 15 | end 16 | 17 | function Split(s, delimiter) 18 | local result = {} 19 | for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do 20 | table.insert(result, match) 21 | end 22 | return result 23 | end 24 | 25 | local function comment_rubocop() 26 | local error = vim.diagnostic.get() 27 | local line = vim.fn.line(".") 28 | local bufnr = vim.fn.bufnr() 29 | local current_error 30 | 31 | ---@diagnostic disable-next-line: unused-local 32 | for __, v in ipairs(error) do 33 | if v.lnum + 1 == line and bufnr == v.bufnr then 34 | if not current_error then 35 | current_error = v 36 | end 37 | end 38 | end 39 | 40 | if current_error then 41 | local current_line = vim.fn.getline(".") 42 | local real_cop_name = current_error.code 43 | 44 | if string.match(current_line, "# rubocop:disable") then 45 | vim.cmd("normal! A, " .. real_cop_name) 46 | else 47 | vim.cmd("normal! A # rubocop:disable " .. real_cop_name) 48 | end 49 | end 50 | end 51 | 52 | return { comment_rubocop = comment_rubocop } 53 | -------------------------------------------------------------------------------- /lua/mood-scripts/ask_delete.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local function t(str) 4 | return vim.api.nvim_replace_termcodes(str, true, true, true) 5 | end 6 | 7 | function M.require_ask_delete_if_fails(module, file_path, example_path) 8 | local ok, err = pcall(require, module) 9 | 10 | if not ok then 11 | vim.notify( 12 | "Looks like an error happens while loading your " .. 13 | module .. 14 | ".\n\nThis could be some plugin beign removed from mood\n The Error:\n " .. 15 | err .. "\n\n1 - Recreate default\n2 - Open File\n3 - Ignore", vim.log.levels.ERROR) 16 | 17 | local input = vim.fn.input("What do you want to do? (1/2/3): ") 18 | 19 | if input == "1" then 20 | vim.fn.system("cp " .. file_path .. " " .. file_path .. ".bak") 21 | vim.fn.system("rm " .. file_path) 22 | vim.fn.system("cp " .. example_path .. " " .. file_path) 23 | 24 | vim.notify("Recreated default config file. Your old file is in " .. file_path .. ".bak", vim.log.levels.INFO) 25 | 26 | require(module) 27 | 28 | local open_input = vim.fn.input("Do you want to open the file? (y/n): ") 29 | 30 | if open_input == "y" then 31 | vim.cmd("edit " .. file_path .. ".bak") 32 | vim.cmd(t("norm! v")) 33 | vim.cmd("edit " .. file_path) 34 | end 35 | elseif input == "2" then 36 | vim.cmd("edit " .. file_path) 37 | end 38 | end 39 | end 40 | 41 | return M 42 | -------------------------------------------------------------------------------- /lua/utils/buffer_path_display.lua: -------------------------------------------------------------------------------- 1 | local buffer_path_display = function(opts, path) 2 | local tail = require("telescope.utils").path_tail(path) 3 | local split = require("utils.table_functions").Split 4 | 5 | local splitted_tail = split(path, "/") 6 | 7 | local path_name = "" 8 | 9 | if #splitted_tail >= 2 then 10 | for i = 1, #splitted_tail - 1, 1 do 11 | if i < #splitted_tail - 1 then 12 | path_name = path_name .. "/" .. splitted_tail[i] 13 | else 14 | path_name = path_name .. "/" .. splitted_tail[i] 15 | end 16 | end 17 | else 18 | path_name = "/" 19 | end 20 | 21 | -- get all buffer names of current cwd 22 | local buffers = vim.api.nvim_list_bufs() 23 | local buffer_names = {} 24 | for _, buffer in pairs(buffers) do 25 | -- insert buffer name only filename no path 26 | table.insert(buffer_names, require("telescope.utils").path_tail(vim.api.nvim_buf_get_name(buffer))) 27 | end 28 | 29 | local max_width = 0 30 | 31 | for _, buffer_name in pairs(buffer_names) do 32 | local width = #buffer_name 33 | if width > max_width then 34 | max_width = width 35 | end 36 | end 37 | 38 | local displayer = require("telescope.pickers.entry_display").create({ 39 | separator = " ", 40 | items = { 41 | { width = max_width }, 42 | { remaining = true }, 43 | }, 44 | }) 45 | 46 | return displayer({ tail, { "󰉋 " .. path_name:sub(2, #path_name), "TelescopeResultsComment" } }) 47 | end 48 | 49 | return buffer_path_display 50 | -------------------------------------------------------------------------------- /lua/core/settings.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.show_message(expected, instead, goToInsert, hasCtrl) 4 | if goToInsert and hasCtrl then 5 | require('notify')('Use Ctrl-' .. expected .. ' or go to insert and use ' .. expected .. ' instead of ' .. instead .. '.', 'warn', { title = 'Bycicle without small whells' }) 6 | elseif goToInsert then 7 | require('notify')('Go to insert and use ' .. expected .. ' instead of ' .. instead .. '.', 'warn', { title = 'Bycicle without small whells' }) 8 | else 9 | require('notify')('Use ' .. expected .. ' instead of ' .. instead .. '.', 'warn', { title = 'Bycicle without small whells' }) 10 | end 11 | end 12 | 13 | function M.remove_bicycle_small_whells(opts) 14 | local set = vim.keymap.set 15 | 16 | set('i', '', function() M.show_message("H", "Left Arrow", true, true) end) 17 | set('i', '', function() M.show_message("L", "Right Arrow", true, true) end) 18 | set('i', '', function() M.show_message("K", "Up Arrow", true) end) 19 | set('i', '', function() M.show_message("J", "Down Arrow", true) end) 20 | 21 | if opts.includeNormalMode then 22 | set({ 'n', 'x' }, '', function() M.show_message("H", "Left Arrow") end) 23 | set({ 'n', 'x' }, '', function() M.show_message("L", "Right Arrow") end) 24 | set({ 'n', 'x' }, '', function() M.show_message("K", "Up Arrow") end) 25 | set({ 'n', 'x' }, '', function() M.show_message("J", "Down Arrow") end) 26 | end 27 | end 28 | 29 | return M 30 | -------------------------------------------------------------------------------- /lua/core/globals.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.setup() 4 | vim.g.camelsnek_i_am_an_old_fart_with_no_sense_of_humour_or_internet_culture = 1 5 | vim.g.closetag_filenames = "*.html,*.xhtml,*.phtml,*.erb" 6 | vim.g.multi_cursor_use_default_mapping = 0 7 | vim.g.yoinkSavePersistently = 1 8 | vim.g.yoinkIncludeDeleteOperations = 1 9 | vim.g.yoinkMaxItems = 20 10 | vim.g.ruby_debugger = "byebug" 11 | vim.g.last_term_command = {} 12 | vim.g.any_jump_disable_default_keybindings = 1 13 | vim.g.ruby_refactoring_map_keys = 0 14 | vim.g["test#strategy"] = "mood-term" 15 | vim.g.dashboard_default_executive = "telescope" 16 | vim.g.table_mode_disable_tableize_mappings = 1 17 | vim.g.table_mode_disable_mappings = 1 18 | vim.g.send_disable_mapping = 1 19 | vim.g.folder_to_ignore = { ".*.git/.*", "node_modules/.*" } 20 | vim.g["test#runner_commands"] = { "RSpec" } 21 | vim.g.choosewin_overlay_enable = 1 22 | 23 | local host = string.gsub(vim.fn.system("which python3"), "\n", "") 24 | 25 | if string.match(host, "not found") then 26 | host = string.gsub(vim.fn.system("which python"), "\n", "") 27 | end 28 | 29 | vim.g.python3_host_prog = host 30 | 31 | local neovim_file_path = vim.fn.stdpath("config") 32 | 33 | local full_command = "--require=" 34 | .. neovim_file_path 35 | .. "/helpers/vim_formatter.rb --format VimFormatter --out /tmp/quickfix.out --format progress" 36 | 37 | vim.cmd("let test#ruby#rspec#options = { 'file': '" .. full_command .. "', 'nearest': '" .. full_command .. "' }") 38 | 39 | vim.cmd("let g:test#custom_strategies = {'mood-term': function('TermStrategy')}") 40 | end 41 | 42 | M.setup() 43 | 44 | return M 45 | -------------------------------------------------------------------------------- /lua/mood-scripts/bg-color.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local fn = vim.fn 4 | 5 | function M.window_id() 6 | return vim.g.tmux_window_id or M.normalize_return(vim.fn.system("tmux display-message -p '#I'")) or "1" 7 | end 8 | 9 | local function get_color(group, attr) 10 | return fn.synIDattr(fn.synIDtrans(fn.hlID(group)), attr) 11 | end 12 | 13 | function M.normalize_return(str) 14 | local str = string.gsub(str, "\n", "") 15 | str = str.gsub(str, " ", "") 16 | 17 | return str 18 | end 19 | 20 | local function set_win_stuff() 21 | M.winhighlight = get_color('winhighlight', 'bg#') 22 | 23 | vim.cmd("hi ActiveWindow guibg=#" .. M.winhighlight) 24 | vim.cmd("hi InactiveWindow guibg=#292c41") 25 | end 26 | 27 | local function call_blink() 28 | if not M.winhighlight then 29 | set_win_stuff() 30 | end 31 | 32 | local win_id = vim.fn.win_getid() 33 | 34 | vim.fn.setwinvar(win_id, "&winhighlight", "Normal:InactiveWindow") 35 | 36 | vim.fn.timer_start(100, function() 37 | vim.fn.setwinvar(win_id, "&winhighlight", "Normal:ActiveWindow") 38 | end) 39 | end 40 | 41 | local function blink() 42 | local count_cmd = tonumber(M.normalize_return(vim.fn.system("tmux list-panes -t " .. M.window_id() .. " | wc -l"))) 43 | 44 | if not count_cmd then 45 | return 46 | end 47 | 48 | if count_cmd > 1 or require("utils.buf_count")() > 1 then 49 | call_blink() 50 | end 51 | end 52 | 53 | function M.setup() 54 | vim.api.nvim_create_autocmd('FocusGained', { 55 | pattern = '*', 56 | callback = blink, 57 | }) 58 | 59 | vim.api.nvim_create_autocmd('ColorScheme', { 60 | pattern = '*', 61 | callback = set_win_stuff, 62 | }) 63 | 64 | set_win_stuff() 65 | end 66 | 67 | return M 68 | -------------------------------------------------------------------------------- /lua/utils/table_functions.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.Split(s, delimiter) 4 | local result = {} 5 | 6 | for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do 7 | table.insert(result, match) 8 | end 9 | 10 | return result 11 | end 12 | 13 | function M.camelCaseB(s) 14 | local camel = string.gsub(s, "_%a+", function(word) 15 | local first = string.sub(word, 2, 2) 16 | local rest = string.sub(word, 3) 17 | return string.upper(first) .. rest 18 | end) 19 | 20 | return string.upper(string.sub(camel, 1, 1)) .. string.sub(camel, 2, #camel) 21 | end 22 | 23 | M.pluralize = function(inputString) 24 | local lastCharacter = inputString:sub(-1, -1) 25 | 26 | if lastCharacter == "y" then 27 | local stringWithoutY = inputString:sub(1, -2) 28 | 29 | return stringWithoutY .. "ies" 30 | elseif lastCharacter == "s" then 31 | return inputString 32 | else 33 | return inputString .. "s" 34 | end 35 | end 36 | 37 | M.singularize = function(inputString) 38 | local lastCharacter = inputString:sub(-1, -1) 39 | 40 | local lastThreeCharacters = "" 41 | local lastTwoCharacters = "" 42 | 43 | if #inputString >= 3 then 44 | lastThreeCharacters = inputString:sub(-3, -1) 45 | end 46 | 47 | if #inputString >= 2 then 48 | lastTwoCharacters = inputString:sub(-2, -1) 49 | end 50 | 51 | if lastThreeCharacters == "ies" then 52 | local stringWithoutIes = inputString:sub(1, -4) 53 | 54 | return stringWithoutIes .. "y" 55 | elseif lastTwoCharacters == "ss" then 56 | return inputString 57 | elseif lastCharacter == "s" then 58 | return inputString:sub(1, -2) 59 | else 60 | return inputString 61 | end 62 | end 63 | 64 | function M.SplitWithDot(s) 65 | local lines = {} 66 | for line in s:gsub("%f[.]%.%f[^.]", "\0"):gmatch("%Z+") do 67 | table.insert(lines, line) 68 | end 69 | 70 | return lines 71 | end 72 | 73 | return M 74 | -------------------------------------------------------------------------------- /extra/examples/vs-snippets/eruby.json: -------------------------------------------------------------------------------- 1 | { 2 | "if": { 3 | "prefix": "if", 4 | "body": [ 5 | "<% if ${1:truevalue} %>", 6 | " $2", 7 | "<% end %>" 8 | ], 9 | "description": "if .. end" 10 | }, 11 | "else": { 12 | "prefix": "else", 13 | "body": [ 14 | "<% else %>" 15 | ], 16 | "description": "else" 17 | }, 18 | "elsif": { 19 | "prefix": "elsif", 20 | "body": [ 21 | "<% elsif ${1:truevalue} %>" 22 | ], 23 | "description": "elsif" 24 | }, 25 | "end": { 26 | "prefix": "end", 27 | "body": [ 28 | "<% end %>" 29 | ], 30 | "description": "end" 31 | }, 32 | "ife": { 33 | "prefix": "ife", 34 | "body": [ 35 | "<% if ${1:truevalue} %>", 36 | " $2", 37 | "<% else %>", 38 | " $3", 39 | "<% end %>" 40 | ], 41 | "description": "if .. else .. end" 42 | }, 43 | "unless": { 44 | "prefix": "unless", 45 | "body": [ 46 | "<% unless ${1:falsevalue} %>", 47 | " $2", 48 | "<% end %>" 49 | ], 50 | "description": "unless .. end" 51 | }, 52 | "unlesse": { 53 | "prefix": "unlesse", 54 | "body": [ 55 | "<% unless ${1:falsevalue} %>", 56 | " $2", 57 | "<% else %>", 58 | " $3", 59 | "<% end %>" 60 | ], 61 | "description": "unless .. end" 62 | }, 63 | "each": { 64 | "prefix": "each", 65 | "body": [ 66 | "<% ${1:items}.each do |${2:item}| %>", 67 | " $2", 68 | "<% end %>" 69 | ], 70 | "description": "each do" 71 | }, 72 | "render": { 73 | "prefix": "pe", 74 | "body": [ 75 | "<%= $1 %>" 76 | ], 77 | "description": "render block pe" 78 | }, 79 | "exec": { 80 | "prefix": "er", 81 | "body": [ 82 | "<% $1 %>" 83 | ], 84 | "description": "erb exec block" 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lua/mood-scripts/tmux-integration.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local function t(str) 4 | return vim.api.nvim_replace_termcodes(str, true, true, true) 5 | end 6 | 7 | function M.normalize_return(str) 8 | local str = string.gsub(str, "\n", "") 9 | 10 | str = str.gsub(str, " ", "") 11 | 12 | return str 13 | end 14 | 15 | function M.real_window_count() 16 | local wins = vim.api.nvim_list_wins() 17 | local count = 0 18 | 19 | for i=1,#wins do 20 | local cfg = vim.api.nvim_win_get_config(wins[i]) 21 | 22 | if cfg.focusable then 23 | count = count + 1 24 | end 25 | end 26 | 27 | return count 28 | end 29 | 30 | function M.go_to_next() 31 | local is_last_window = vim.fn.winnr() == M.real_window_count() 32 | 33 | local pane_count = tonumber(vim.fn.system("tmux display-message -p '#{window_panes}' ")) 34 | local window_id = M.normalize_return(vim.fn.system("tmux display-message -p '#I'")) 35 | local is_maximized = M.normalize_return(vim.fn.system("tmux list-panes -t " .. window_id .. " -F '#F'")) 36 | 37 | if is_last_window and pane_count and pane_count > 1 and not(string.match(is_maximized, "Z")) then 38 | vim.fn.system("tmux select-pane -t :.+") 39 | else 40 | vim.cmd(t("norm! w")) 41 | end 42 | end 43 | 44 | function M.go_to_prev() 45 | local is_first_window = vim.fn.winnr() == 1 46 | local pane_count = tonumber(vim.fn.system("tmux display-message -p '#{window_panes}' ")) 47 | local window_id = M.normalize_return(vim.fn.system("tmux display-message -p '#I'")) 48 | local is_maximized = M.normalize_return(vim.fn.system("tmux list-panes -t " .. window_id .. " -F '#F'")) 49 | 50 | if is_first_window and pane_count and pane_count > 1 and not(string.match(is_maximized, "Z")) then 51 | vim.fn.system("tmux select-pane -t :.-") 52 | else 53 | vim.cmd(t("norm! W")) 54 | end 55 | end 56 | 57 | return M 58 | -------------------------------------------------------------------------------- /lua/tutorial/init.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local exerciseComment = 'Exercise \\d' 4 | local exerciseStart = '# << Start' 5 | 6 | function M.start(ignore_notification) 7 | vim.cmd("silent !cp " .. vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/extra/tutorial.rb ~/.tutorial.rb") 8 | vim.cmd("silent e ~/.tutorial.rb") 9 | 10 | if not ignore_notification then 11 | require('notify')("Welcome to mood nvim editing Tutorial.", 'info', { title = 'mooD Nvim' }) 12 | end 13 | 14 | M.define_mappings() 15 | 16 | vim.cmd('norm! gg') 17 | end 18 | 19 | function M.jump() 20 | local exercise_count = vim.fn.input('Jump to exercise (input the number): ') 21 | 22 | vim.cmd("norm gg") 23 | 24 | ---@diagnostic disable-next-line: unused-local 25 | for __ = 1, exercise_count, 1 do 26 | M.next_exercise() 27 | end 28 | end 29 | 30 | function M.define_mappings() 31 | local bufnr = vim.fn.bufnr('.tutorial.rb') 32 | 33 | local bufopts = { noremap = true, silent = true, buffer = bufnr } 34 | 35 | vim.keymap.set('n', '', M.next_exercise, bufopts) 36 | vim.keymap.set('n', '', M.prev_exercise, bufopts) 37 | 38 | vim.keymap.set('n', 'zj', M.next_exercise, bufopts) 39 | vim.keymap.set('n', 'zk', M.prev_exercise, bufopts) 40 | vim.keymap.set('n', 'zJ', M.jump, bufopts) 41 | 42 | vim.keymap.set('n', 'zr', M.reset_exercise, bufopts) 43 | end 44 | 45 | function M.reset_exercise() 46 | local line_number = vim.fn.line('.') 47 | 48 | vim.cmd("w") 49 | M.start(true) 50 | 51 | vim.cmd('' .. line_number) 52 | 53 | vim.fn.search(exerciseComment, 'b') 54 | vim.fn.search(exerciseStart) 55 | vim.cmd("norm 0") 56 | 57 | M.define_mappings() 58 | 59 | vim.cmd("norm zb\\\\") 60 | end 61 | 62 | function M.next_exercise() 63 | vim.fn.search(exerciseComment) 64 | vim.fn.search(exerciseStart) 65 | vim.cmd("norm zb\\\\") 66 | vim.cmd("norm 0") 67 | end 68 | 69 | function M.prev_exercise() 70 | vim.fn.search(exerciseComment, 'b') 71 | vim.fn.search(exerciseStart, 'b') 72 | vim.cmd("norm zb\\\\") 73 | vim.cmd("norm 0") 74 | end 75 | 76 | return M 77 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | vim.opt.termguicolors = true 2 | 3 | local not_ok = {} 4 | 5 | local function setup(path) 6 | local ok, res = pcall(require(path).setup) 7 | 8 | if not ok then 9 | table.insert(not_ok, path) 10 | 11 | if os.getenv("DEBUG") == "true" then 12 | print("[WARN] [" .. path .. "]: " .. res) 13 | end 14 | end 15 | 16 | return ok 17 | end 18 | 19 | vim.g.mapleader = " " 20 | 21 | setup("mood-scripts.install-config") 22 | 23 | -- vim script functions 24 | setup("helpers.vim-functions") 25 | setup("helpers.term-functions") 26 | setup("core.plugins") 27 | 28 | pcall(require, "user.before_start") 29 | 30 | setup("core.set") 31 | setup("core.globals") 32 | setup("mood-scripts.quick-consult") 33 | 34 | setup("core.start") 35 | 36 | if #not_ok > 0 then 37 | print("Some Error happening when loading neovim: \n") 38 | print( 39 | "Try to restart Neovim. If the error persist:\n1 - Run :Lazy install\n2 - Run :UpdateMood\n3 - Try to reinstall neovim.\n4 - Create an issue to help to fix\n5 - run neovim with DEBUG=true nvim" 40 | ) 41 | print("Modules with errors: ") 42 | 43 | for i = 1, #not_ok, 1 do 44 | print(" - " .. not_ok[i]) 45 | end 46 | else 47 | require("mood-scripts.ask_delete").require_ask_delete_if_fails( 48 | "user.after_start", 49 | vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/after_start.lua", 50 | vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/extra/examples/after_start.lua" 51 | ) 52 | 53 | require("user.config") 54 | 55 | setup("core.autocmds") 56 | 57 | require("core.mappings").setup() 58 | 59 | require("mood-scripts.ask_delete").require_ask_delete_if_fails( 60 | "user.keybindings", 61 | vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/keybindings.lua", 62 | vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/extra/examples/keybindings.lua" 63 | ) 64 | 65 | require("mood-scripts.statusline")() 66 | 67 | require("mood-scripts.ask_delete").require_ask_delete_if_fails( 68 | "user.config", 69 | vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/config.lua", 70 | vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/extra/examples/config.lua" 71 | ) 72 | 73 | require("mood-scripts.setup-telescope").setup() 74 | 75 | setup("core.autocmds") 76 | end 77 | -------------------------------------------------------------------------------- /lua/plugins/dashboard_plugin.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvimdev/dashboard-nvim", 4 | event = "VimEnter", 5 | opts = function() 6 | local logo = [[ ]] 7 | 8 | logo = string.rep("\n", 8) .. logo .. "\n\n" 9 | 10 | local opts = { 11 | theme = "doom", 12 | hide = { 13 | -- this is taken care of by lualine 14 | -- enabling this messes up the actual laststatus setting after loading a file 15 | statusline = false, 16 | }, 17 | config = { 18 | header = vim.split(logo, "\n"), 19 | -- stylua: ignore 20 | center = { 21 | { key = "SPC h l", icon = "󰉙 ", desc = " Load Session", action = 'lua require("persistence").load() ' }, 22 | { key = "SPC tab", icon = " ", desc = " Git Status", action = "Telescope git_status " }, 23 | { key = "SPC h m", icon = "󰑶 ", desc = " Mason (Manage LSP / Linters)", action = "Mason" }, 24 | { key = "SPC f p", icon = " ", desc = " User Settings", action = "lua require('mood-scripts.open-files').open_dotfiles()" }, 25 | { key = "SPC h h", icon = " ", desc = " Open Handbook (docs)", action = "e " .. vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/handbook.md " }, 26 | { key = "SPC h T", icon = "ﲉ ", desc = " Open Tutorial for mooD", action = 'lua require("tutorial").start() ' }, 27 | { key = "SPC h u", icon = " ", desc = " Update mooD", action = "UpdateMood" }, 28 | { key = "SPC q q", icon = " ", desc = " Quit", action = "qa" }, 29 | }, 30 | footer = function() 31 | local stats = require("lazy").stats() 32 | local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) 33 | return { 34 | "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms", 35 | } 36 | end, 37 | }, 38 | } 39 | 40 | for _, button in ipairs(opts.config.center) do 41 | button.desc = button.desc .. string.rep(" ", 43 - #button.desc) 42 | button.key_format = " %s" 43 | end 44 | 45 | -- close Lazy and re-open when the dashboard is ready 46 | if vim.o.filetype == "lazy" then 47 | vim.cmd.close() 48 | vim.api.nvim_create_autocmd("User", { 49 | pattern = "DashboardLoaded", 50 | callback = function() 51 | require("lazy").show() 52 | end, 53 | }) 54 | end 55 | 56 | return opts 57 | end, 58 | }, 59 | } 60 | -------------------------------------------------------------------------------- /lua/plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { "otavioschwanck/telescope-alternate.nvim", event = "VeryLazy" }, 3 | { 4 | "nvim-telescope/telescope.nvim", 5 | event = "VeryLazy", 6 | dependencies = { 7 | "nvim-telescope/telescope-ui-select.nvim", 8 | "nvim-telescope/telescope-file-browser.nvim", 9 | { "fdschmidt93/telescope-egrepify.nvim" }, 10 | "nvim-lua/plenary.nvim", 11 | { 12 | "gbprod/yanky.nvim", 13 | config = function() 14 | local mapping = require("yanky.telescope.mapping") 15 | local utils = require("yanky.utils") 16 | local _, actions = pcall(require, "telescope.actions") 17 | 18 | require("yanky").setup({ 19 | ring = { 20 | history_length = 50, 21 | storage = "shada", 22 | sync_with_numbered_registers = true, 23 | }, 24 | preserve_cursor_position = { 25 | enabled = true, 26 | }, 27 | picker = { 28 | telescope = { 29 | mappings = { 30 | default = mapping.put("p"), 31 | i = { 32 | [""] = actions.move_selection_previous, 33 | [""] = actions.move_selection_next, 34 | [""] = mapping.put("P"), 35 | [""] = mapping.delete(), 36 | [""] = mapping.set_register("+"), 37 | }, 38 | n = { 39 | p = mapping.put("p"), 40 | P = mapping.put("P"), 41 | d = mapping.delete(), 42 | r = mapping.set_register(utils.get_default_register()), 43 | }, 44 | }, 45 | }, 46 | }, 47 | }) 48 | 49 | vim.api.nvim_set_keymap("n", "p", "(YankyPutAfter)", {}) 50 | vim.api.nvim_set_keymap("n", "P", "(YankyPutBefore)", {}) 51 | vim.api.nvim_set_keymap("x", "p", "(YankyPutAfter)", {}) 52 | vim.api.nvim_set_keymap("x", "P", "(YankyPutBefore)", {}) 53 | 54 | vim.api.nvim_set_keymap("n", "y", "(YankyYank)", {}) 55 | vim.api.nvim_set_keymap("x", "y", "(YankyYank)", {}) 56 | 57 | vim.api.nvim_set_keymap("n", "", "(YankyCycleForward)", {}) 58 | vim.api.nvim_set_keymap("n", "", "(YankyCycleBackward)", {}) 59 | end, 60 | }, 61 | { 'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release' } 62 | }, 63 | }, 64 | } 65 | -------------------------------------------------------------------------------- /lua/core/set.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.setup() 4 | -- This file is automatically loaded by plugins.config 5 | 6 | vim.g.mapleader = " " 7 | vim.g.maplocalleader = "" 8 | 9 | local opt = vim.opt 10 | 11 | vim.g.VM_theme = "olive" 12 | vim.g.VM_show_warnings = false 13 | 14 | opt.autowrite = true -- Enable auto write 15 | opt.clipboard = "unnamedplus" -- Sync with system clipboard 16 | opt.completeopt = "menu,menuone,noselect" 17 | opt.conceallevel = 3 -- Hide * markup for bold and italic 18 | opt.confirm = true -- Confirm to save changes before exiting modified buffer 19 | opt.cursorline = true -- Enable highlighting of the current line 20 | opt.expandtab = true -- Use spaces instead of tabs 21 | opt.formatoptions = "jcroqlnt" -- tcqj 22 | opt.grepformat = "%f:%l:%c:%m" 23 | opt.grepprg = "rg --vimgrep" 24 | opt.ignorecase = true -- Ignore case 25 | opt.inccommand = "nosplit" -- preview incremental substitute 26 | -- opt.laststatus = 0 27 | opt.list = true -- Show some invisible characters (tabs... 28 | opt.mouse = "a" -- Enable mouse mode 29 | opt.number = true -- Print line number 30 | opt.pumblend = 10 -- Popup blend 31 | opt.pumheight = 10 -- Maximum number of entries in a popup 32 | opt.scrolloff = 4 -- Lines of context 33 | opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "globals" } 34 | opt.shiftround = true -- Round indent 35 | opt.shiftwidth = 2 -- Size of an indent 36 | opt.shortmess:append({ W = true, I = true, c = true, A = true }) 37 | -- opt.showmode = false -- Dont show mode since we have a statusline 38 | opt.sidescrolloff = 8 -- Columns of context 39 | opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time 40 | opt.smartcase = true -- Don't ignore case with capitals 41 | opt.smartindent = true -- Insert indents automatically 42 | opt.spelllang = { "en" } 43 | opt.splitbelow = true -- Put new windows below current 44 | opt.splitright = true -- Put new windows right of current 45 | opt.tabstop = 2 -- Number of spaces tabs count for 46 | opt.termguicolors = true -- True color support 47 | opt.timeoutlen = 300 48 | opt.undofile = true 49 | opt.undolevels = 10000 50 | opt.updatetime = 200 -- Save swap file and trigger CursorHold 51 | opt.wildmode = "longest:full,full" -- Command-line completion mode 52 | opt.winminwidth = 5 -- Minimum window width 53 | opt.wrap = false -- Disable line wrap 54 | opt.pumblend = 0 55 | 56 | if vim.fn.has("nvim-0.9.0") == 1 then 57 | opt.shortmess:append({ C = true }) 58 | end 59 | 60 | opt.splitkeep = "cursor" 61 | 62 | -- Fix markdown indentation settings 63 | vim.g.markdown_recommended_style = 0 64 | end 65 | 66 | return M 67 | -------------------------------------------------------------------------------- /lua/mood-scripts/statusline.lua: -------------------------------------------------------------------------------- 1 | local function setup() 2 | vim.o.laststatus = vim.g.lualine_laststatus 3 | 4 | local theme = require("lualine.themes.catppuccin-mocha") 5 | local catppuccin_colors = require("catppuccin.palettes").get_palette() 6 | 7 | local open_terms = { 8 | require("tmux-awesome-manager.src.integrations.status").open_terms, 9 | color = { fg = catppuccin_colors.green }, 10 | } 11 | 12 | local function arrow() 13 | local status = require("arrow.statusline").text_for_statusline_with_icons() 14 | 15 | return status 16 | end 17 | 18 | local arrow_module = { 19 | arrow, 20 | color = { fg = catppuccin_colors.pink }, 21 | } 22 | 23 | local filename_with_icon = require('lualine.components.filename'):extend() 24 | filename_with_icon.apply_icon = require('lualine.components.filetype').apply_icon 25 | filename_with_icon.icon_hl_cache = {} 26 | 27 | 28 | local conditions = { 29 | buffer_not_empty = function() 30 | return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 31 | end, 32 | } 33 | 34 | local function count(base, pattern) 35 | return select(2, string.gsub(base, pattern, '')) 36 | end 37 | 38 | local function shorten_path(path, sep) 39 | -- ('([^/])[^/]+%/', '%1/', 1) 40 | return path:gsub(string.format('([^%s])[^%s]+%%%s', sep, sep, sep), '%1' .. sep, 1) 41 | end 42 | 43 | local function path() 44 | local dir = vim.fn.expand("%:p:h") 45 | 46 | if dir == vim.fn.getcwd() then 47 | return " Project Root" 48 | else 49 | local windwidth = vim.go.columns or vim.fn.winwidth(0) 50 | local estimated_space_available = windwidth - 30 51 | 52 | local data = vim.fn.fnamemodify(dir, ":~:.") 53 | for _ = 0, count(data, '/') do 54 | if windwidth <= 84 or #data > estimated_space_available then 55 | data = shorten_path(data, '/') 56 | end 57 | end 58 | 59 | return " " .. data 60 | end 61 | end 62 | 63 | 64 | require("lualine").setup({ 65 | options = { 66 | disabled_filetypes = { 67 | statusline = { "dashboard" }, 68 | }, 69 | section_separators = { left = '', right = '' }, 70 | component_separators = { left = '', right = '' }, 71 | globalstatus = true, 72 | }, 73 | sections = { 74 | lualine_a = { "mode" }, 75 | lualine_b = { { filename_with_icon, color = { gui = 'bold' } }, { path, color = { fg = catppuccin_colors.pink } } }, 76 | lualine_c = { arrow_module, "diagnostics", "diff" }, 77 | lualine_x = { open_terms, "branch" }, 78 | lualine_y = { "progress" }, 79 | lualine_z = { "location" }, 80 | }, 81 | inactive_sections = { 82 | lualine_a = {}, 83 | lualine_b = {}, 84 | lualine_c = { 'filename', arrow }, 85 | lualine_x = { 'location' }, 86 | lualine_y = {}, 87 | lualine_z = {} 88 | }, 89 | }) 90 | end 91 | 92 | return setup 93 | -------------------------------------------------------------------------------- /lua/mood-scripts/open-files.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local pickers = require("telescope.pickers") 4 | local finders = require("telescope.finders") 5 | local conf = require("telescope.config").values 6 | local actions = require("telescope.actions") 7 | local action_state = require("telescope.actions.state") 8 | local alternate = require("telescope-alternate.finders") 9 | 10 | function M.call(files) 11 | pickers 12 | .new({}, { 13 | prompt_title = "User Files", 14 | finder = finders.new_table({ 15 | results = files, 16 | entry_maker = function(entry) 17 | return { 18 | value = entry.path, 19 | display = entry.display or entry.path, 20 | ordinal = (entry.order or "") .. (entry.display or "") .. entry.path, 21 | } 22 | end, 23 | }), 24 | sorter = conf.generic_sorter({}), 25 | previewer = conf.file_previewer({}), 26 | attach_mappings = function(prompt_bufnr, _) 27 | actions.select_default:replace(function() 28 | actions.close(prompt_bufnr) 29 | local selection = action_state.get_selected_entry().value 30 | 31 | vim.cmd("e " .. selection) 32 | end) 33 | return true 34 | end, 35 | }) 36 | :find() 37 | end 38 | 39 | function M.open_dotfiles() 40 | local mood_dotfiles = { 41 | { 42 | path = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/config.lua", 43 | display = "User Configuration | Configure your neovim plugins, themes, etc.", 44 | order = "1", 45 | }, 46 | { 47 | path = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/before_start.lua", 48 | display = "Before Start | Run before neovim starts. Useful for colorschemes", 49 | order = "2", 50 | }, 51 | { 52 | path = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/keybindings.lua", 53 | display = "Keybindings | Configure your personal keybindings.", 54 | order = "2", 55 | }, 56 | { 57 | path = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/lsp.lua", 58 | display = "LSP | Configure the LSP (Language server protocol) and linters / formatters", 59 | order = "3", 60 | }, 61 | { 62 | path = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/plugins.lua", 63 | display = "Plugins | Add more plugins to your neovim.", 64 | order = "4", 65 | }, 66 | { 67 | path = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/after_start.lua", 68 | display = "After Start | commands that should run after vim start.", 69 | order = "5", 70 | }, 71 | { 72 | path = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/vs-snippets/", 73 | display = "Snippets | Write your own snippets!", 74 | order = "6", 75 | }, 76 | } 77 | 78 | local user_dotfiles = vim.g.dotfiles 79 | 80 | if user_dotfiles then 81 | for i = 1, #user_dotfiles do 82 | table.insert(mood_dotfiles, user_dotfiles[i]) 83 | end 84 | end 85 | 86 | M.call(mood_dotfiles) 87 | end 88 | 89 | return M 90 | -------------------------------------------------------------------------------- /lua/plugins/tree-sitter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { "nvim-treesitter/nvim-treesitter-textobjects", event = "VeryLazy" }, 3 | { "RRethy/nvim-treesitter-endwise", event = "VeryLazy" }, 4 | { 5 | "nvim-treesitter/nvim-treesitter", 6 | build = ":TSUpdate", 7 | event = "VeryLazy", 8 | config = function() 9 | require("nvim-treesitter.configs").setup({ 10 | ensure_installed = { 11 | "ruby", 12 | "html", 13 | "css", 14 | "scss", 15 | "javascript", 16 | "typescript", 17 | "solidity", 18 | "yaml", 19 | "json", 20 | "lua", 21 | "vim", 22 | "query", 23 | "embedded_template", 24 | "bash", 25 | }, 26 | 27 | auto_install = true, 28 | 29 | textobjects = { 30 | move = { 31 | enable = true, 32 | set_jumps = true, -- whether to set jumps in the jumplist 33 | goto_next_start = { 34 | ["]m"] = "@function.outer", 35 | ["]]"] = "@class.outer", 36 | }, 37 | goto_next_end = { 38 | ["]M"] = "@function.outer", 39 | ["]["] = "@class.outer", 40 | }, 41 | goto_previous_start = { 42 | ["[m"] = "@function.outer", 43 | ["[["] = "@class.outer", 44 | }, 45 | goto_previous_end = { 46 | ["[M"] = "@function.outer", 47 | ["[]"] = "@class.outer", 48 | }, 49 | }, 50 | select = { 51 | enable = true, 52 | 53 | keymaps = { 54 | ["af"] = "@function.outer", 55 | ["if"] = "@function.inner", 56 | ["ac"] = "@class.outer", 57 | ["ic"] = "@class.inner", 58 | }, 59 | }, 60 | }, 61 | 62 | endwise = { 63 | enable = true, 64 | }, 65 | 66 | -- List of parsers to ignore installing 67 | ignore_install = { "phpdoc" }, 68 | 69 | autotag = { 70 | enable = true, 71 | }, 72 | -- Install languages synchronously (only applied to `ensure_installed`) 73 | sync_install = false, 74 | 75 | indent = { enable = true, disable = { "ruby", "python" } }, 76 | 77 | highlight = { 78 | enable = true, 79 | }, 80 | }) 81 | end, 82 | }, 83 | { 84 | "nvim-treesitter/nvim-treesitter-context", 85 | config = function() 86 | require("treesitter-context").setup({ 87 | enable = true, 88 | max_lines = 1, 89 | trim_scope = "outer", 90 | patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. 91 | -- For all filetypes 92 | -- Note that setting an entry here replaces all other patterns for this entry. 93 | -- By setting the 'default' entry below, you can control which nodes you want to 94 | -- appear in the context window. 95 | default = { 96 | "class", 97 | "function", 98 | "method", 99 | "for", -- These won't appear in the context 100 | "while", 101 | "if", 102 | "switch", 103 | "case", 104 | "element", 105 | "call", 106 | }, 107 | }, 108 | exact_patterns = {}, 109 | 110 | zindex = 20, -- The Z-index of the context window 111 | mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' 112 | separator = nil, -- Separator between context and content. Should be a single character string, like '-'. 113 | }) 114 | end, 115 | }, 116 | } 117 | -------------------------------------------------------------------------------- /lua/mood-scripts/setup-telescope.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local telescope = require("telescope") 4 | 5 | function M.setup() 6 | local _, actions = pcall(require, "telescope.actions") 7 | 8 | local fb_actions = require("telescope").extensions.file_browser.actions 9 | local mapping = require("yanky.telescope.mapping") 10 | 11 | require("telescope").setup({ 12 | defaults = { 13 | layout_strategy = "flex", 14 | layout_config = { 15 | horizontal = { 16 | prompt_position = "top", 17 | height = 0.9, 18 | }, 19 | vertical = { 20 | prompt_position = "top", 21 | }, 22 | }, 23 | sorting_strategy = "ascending", 24 | prompt_prefix = " ", 25 | file_ignore_patterns = vim.g.folder_to_ignore, 26 | mappings = { 27 | i = { 28 | [""] = function(picker) 29 | actions.send_selected_to_qflist(picker) 30 | vim.cmd("copen") 31 | end, 32 | }, 33 | }, 34 | }, 35 | pickers = { 36 | find_files = { 37 | hidden = true, 38 | path_display = require("mood-scripts.custom_telescope").filename_first, 39 | }, 40 | git_files = { 41 | show_untracked = true, 42 | path_display = require("mood-scripts.custom_telescope").filename_first, 43 | }, 44 | }, 45 | extensions = { 46 | egrepify = { 47 | filename_hl = "@attribute", 48 | lnum_hl = "LineNr", 49 | }, 50 | fzy_native = { 51 | override_generic_sorter = false, 52 | override_file_sorter = true, 53 | }, 54 | fzf = { 55 | fuzzy = true, 56 | override_generic_sorter = true, 57 | override_file_sorter = true, 58 | }, 59 | ["ui-select"] = { 60 | require("telescope.themes").get_dropdown({}), 61 | }, 62 | file_browser = { 63 | hidden = true, 64 | prompt_path = true, 65 | hide_parent_dir = true, 66 | grouped = true, 67 | mappings = { 68 | ["i"] = { 69 | [""] = fb_actions.remove, 70 | [""] = fb_actions.copy, 71 | [""] = fb_actions.move, 72 | [""] = fb_actions.create_from_prompt, 73 | [""] = fb_actions.rename, 74 | [""] = fb_actions.goto_cwd, 75 | [""] = function() 76 | vim.cmd("normal vbd") 77 | end, 78 | }, 79 | ["n"] = { 80 | [""] = fb_actions.remove, 81 | [""] = fb_actions.copy, 82 | [""] = fb_actions.move, 83 | [""] = fb_actions.create_from_prompt, 84 | [""] = fb_actions.rename, 85 | [""] = fb_actions.goto_cwd, 86 | }, 87 | }, 88 | }, 89 | }, 90 | }) 91 | 92 | require("telescope").load_extension("yank_history") 93 | require("telescope").load_extension("ui-select") 94 | require("telescope").load_extension("file_browser") 95 | require("telescope").load_extension("telescope-alternate") 96 | require("telescope").load_extension("fzf") 97 | require("telescope").load_extension("tmux-awesome-manager") 98 | require("telescope").load_extension("egrepify") 99 | end 100 | 101 | return M 102 | -------------------------------------------------------------------------------- /lua/plugins/lsp.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "neovim/nvim-lspconfig", 4 | event = "VeryLazy", 5 | dependencies = { 6 | { "williamboman/mason.nvim", event = "VeryLazy" }, -- Optional 7 | { "hrsh7th/cmp-calc", event = "VeryLazy" }, 8 | { "nvimtools/none-ls.nvim", event = "VeryLazy" }, 9 | { "hrsh7th/cmp-cmdline", event = "VeryLazy" }, 10 | { "williamboman/mason-lspconfig.nvim", event = "VeryLazy" }, -- Optional 11 | -- Autocompletion 12 | { "hrsh7th/nvim-cmp", event = "VeryLazy" }, -- Required 13 | { "hrsh7th/cmp-nvim-lsp", event = "VeryLazy" }, -- Required 14 | { "hrsh7th/cmp-buffer", event = "VeryLazy" }, -- Optional 15 | { "hrsh7th/cmp-path", event = "VeryLazy" }, -- Optional 16 | { "saadparwaiz1/cmp_luasnip", event = "VeryLazy" }, -- Optional 17 | { "hrsh7th/cmp-nvim-lua", event = "VeryLazy" }, -- Optional 18 | 19 | -- Snippets 20 | { "L3MON4D3/LuaSnip", build = "make install_jsregexp" }, -- Required 21 | { "rafamadriz/friendly-snippets" }, -- Optional 22 | }, 23 | config = function() 24 | require("mood-scripts.ask_delete").require_ask_delete_if_fails( 25 | "user.lsp", 26 | vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/lua/user/lsp.lua", 27 | vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":h") .. "/extra/examples/lsp.lua" 28 | ) 29 | local util = require("luasnip.util.util") 30 | local node_util = require("luasnip.nodes.util") 31 | 32 | require("luasnip").setup({ 33 | parser_nested_assembler = function(_, snippet) 34 | local select = function(snip, no_move) 35 | snip.parent:enter_node(snip.indx) 36 | -- upon deletion, extmarks of inner nodes should shift to end of 37 | -- placeholder-text. 38 | for _, node in ipairs(snip.nodes) do 39 | node:set_mark_rgrav(true, true) 40 | end 41 | 42 | -- SELECT all text inside the snippet. 43 | if not no_move then 44 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), "n", true) 45 | node_util.select_node(snip) 46 | end 47 | end 48 | function snippet:jump_into(dir, no_move) 49 | if self.active then 50 | -- inside snippet, but not selected. 51 | if dir == 1 then 52 | self:input_leave() 53 | return self.next:jump_into(dir, no_move) 54 | else 55 | select(self, no_move) 56 | return self 57 | end 58 | else 59 | -- jumping in from outside snippet. 60 | self:input_enter() 61 | if dir == 1 then 62 | select(self, no_move) 63 | return self 64 | else 65 | return self.inner_last:jump_into(dir, no_move) 66 | end 67 | end 68 | end 69 | 70 | -- this is called only if the snippet is currently selected. 71 | function snippet:jump_from(dir, no_move) 72 | if dir == 1 then 73 | return self.inner_first:jump_into(dir, no_move) 74 | else 75 | self:input_leave() 76 | return self.prev:jump_into(dir, no_move) 77 | end 78 | end 79 | 80 | return snippet 81 | end, 82 | }) 83 | end, 84 | }, 85 | } 86 | -------------------------------------------------------------------------------- /lua/core/autocmds.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.setup() 4 | vim.g.exiting = false 5 | vim.g.scheduled_save_session = false 6 | 7 | local autocommands = { 8 | { 9 | { "FileType" }, 10 | { "qf" }, 11 | function() 12 | vim.cmd("map dd :RemoveQFItem") 13 | end, 14 | }, 15 | { 16 | { "VimLeavePre" }, 17 | { "*" }, 18 | function() 19 | vim.g.exiting = true 20 | end, 21 | }, 22 | { 23 | { "FileType" }, 24 | { "TelescopePrompt" }, 25 | function() 26 | vim.cmd("setlocal nocursorline") 27 | end, 28 | }, 29 | { 30 | { "BufWritePre" }, 31 | { "*" }, 32 | function() 33 | vim.cmd('call mkdir(expand(":p:h"), "p")') 34 | end, 35 | }, 36 | { 37 | { "BufReadPost", "BufDelete" }, 38 | { "*" }, 39 | function(ft) 40 | require("mood-scripts.auto-save-session").save_session(ft) 41 | end, 42 | }, 43 | } 44 | 45 | for i = 1, #autocommands, 1 do 46 | vim.api.nvim_create_autocmd(autocommands[i][1], { pattern = autocommands[i][2], callback = autocommands[i][3] }) 47 | end 48 | 49 | vim.api.nvim_create_autocmd("BufRead", { 50 | pattern = "*.norg", 51 | command = "norm zR", 52 | }) 53 | 54 | local function augroup(name) 55 | return vim.api.nvim_create_augroup("otavioschwanck_" .. name, { clear = true }) 56 | end 57 | 58 | -- Check if we need to reload the file when it changed 59 | vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { 60 | group = augroup("checktime"), 61 | command = "checktime", 62 | }) 63 | 64 | -- resize splits if window got resized 65 | vim.api.nvim_create_autocmd({ "VimResized" }, { 66 | group = augroup("resize_splits"), 67 | callback = function() 68 | vim.cmd("tabdo wincmd =") 69 | end, 70 | }) 71 | 72 | -- go to last loc when opening a buffer 73 | vim.api.nvim_create_autocmd("BufReadPost", { 74 | group = augroup("last_loc"), 75 | callback = function() 76 | local mark = vim.api.nvim_buf_get_mark(0, '"') 77 | local lcount = vim.api.nvim_buf_line_count(0) 78 | if mark[1] > 0 and mark[1] <= lcount then 79 | pcall(vim.api.nvim_win_set_cursor, 0, mark) 80 | end 81 | end, 82 | }) 83 | 84 | vim.api.nvim_create_autocmd("FileType", { 85 | group = augroup("close_with_q"), 86 | pattern = { 87 | "qf", 88 | "help", 89 | "man", 90 | "notify", 91 | "lspinfo", 92 | "spectre_panel", 93 | "startuptime", 94 | "tsplayground", 95 | "PlenaryTestPopup", 96 | }, 97 | callback = function(event) 98 | vim.bo[event.buf].buflisted = false 99 | vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) 100 | end, 101 | }) 102 | 103 | vim.api.nvim_create_autocmd("FileType", { 104 | pattern = "TelescopeResults", 105 | callback = function(ctx) 106 | vim.api.nvim_buf_call(ctx.buf, function() 107 | vim.fn.matchadd("TelescopeParent", "\t\t.*$") 108 | vim.api.nvim_set_hl(0, "TelescopeParent", { link = "Comment" }) 109 | end) 110 | end, 111 | }) 112 | 113 | -- wrap and check for spell in text filetypes 114 | vim.api.nvim_create_autocmd("FileType", { 115 | group = augroup("wrap_spell"), 116 | pattern = { "gitcommit", "markdown" }, 117 | callback = function() 118 | vim.opt_local.wrap = true 119 | vim.opt_local.spell = true 120 | end, 121 | }) 122 | end 123 | 124 | return M 125 | -------------------------------------------------------------------------------- /helpers/vim_formatter.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class VimFormatter 4 | RSpec::Core::Formatters.register self, :example_failed, :close 5 | 6 | def initialize(output) 7 | @output = output 8 | end 9 | 10 | def example_failed(notification) 11 | @output << format(notification) + "\n" 12 | end 13 | 14 | def close(notification) 15 | @output << "finished\n" 16 | end 17 | 18 | private 19 | 20 | def format(notification) 21 | example_location = notification.example.location 22 | expect_location = extract_expect_location(notification.exception.backtrace, example_location) 23 | 24 | message = notification.exception.message.gsub("\n", "\\n") 25 | 26 | backtraces = find_backtrace(notification.exception.backtrace, example_location, expect_location) 27 | 28 | if backtraces.any? 29 | message = "#{message}\\n\\nBacktrace:\\n#{backtraces[0..7].join("\\n")}" 30 | end 31 | 32 | message = message.gsub(/\e\[\d+m/, '') 33 | 34 | rtn = "%s: %s" % [expect_location || example_location, message] 35 | rtn.gsub("\n", ' ') 36 | end 37 | 38 | def find_backtrace(backtrace, example_location, expect_location) 39 | if example_location[0..1] == "./" 40 | example_location = example_location[2..] 41 | end 42 | 43 | example_location_line = example_location.split(':').last 44 | example_location_file = example_location.split(':').first 45 | 46 | expect_location_line = nil 47 | 48 | if expect_location 49 | expect_location = expect_location[2..] if expect_location[0..1] == "./" 50 | 51 | expect_location_line = expect_location.split(':').last 52 | end 53 | 54 | project_dir = Dir.pwd 55 | 56 | backtrace_filtered = backtrace.select do |line| 57 | line.include?(project_dir) 58 | end 59 | 60 | project_backtraces = backtrace_filtered.select do |line| 61 | line_number = line.split(':')[1] 62 | path = line.split(':')[0] 63 | 64 | if (line_number.to_i == example_location_line.to_i || line_number.to_i == expect_location_line.to_i) && path.include?(example_location_file) 65 | false 66 | else 67 | true 68 | end 69 | end 70 | 71 | project_backtraces 72 | rescue StandardError => e 73 | [] 74 | end 75 | 76 | def extract_expect_location(backtrace, example_location) 77 | if example_location[0..1] == "./" 78 | example_location = example_location[2..] 79 | end 80 | 81 | example_location_line = example_location.split(':').last 82 | example_location_file = example_location.split(':').first 83 | 84 | backtrace_lines = backtrace.select { |line| line.include?(example_location_file) } 85 | 86 | return nil if backtrace_lines.empty? 87 | 88 | sorted_backtrace_lines = backtrace_lines.sort do |a, b| 89 | a.split(':')[1].to_i <=> b.split(':')[1].to_i 90 | end 91 | 92 | backtrace_line = sorted_backtrace_lines.select { |line| line.split(':')[1].to_i > example_location_line.to_i }.first 93 | 94 | return nil unless backtrace_line 95 | 96 | example_file = example_location.split(':').first 97 | 98 | match = backtrace_line.match(/(.+_spec\.rb):(\d+)/) 99 | return nil unless match 100 | 101 | backtrace_file = match[1] 102 | backtrace_line_number = match[2] 103 | 104 | if File.basename(example_file) == File.basename(backtrace_file) 105 | relative_path = Pathname.new(backtrace_file).relative_path_from(Pathname.new(Dir.pwd)).to_s 106 | "#{relative_path}:#{backtrace_line_number}" 107 | end 108 | rescue StandardError => e 109 | # do nothing 110 | end 111 | end 112 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ⚠️ MIGRATION NOTICE 2 | 3 | **🚨 This configuration has been migrated to [NeoMood](https://github.com/otavioschwanck/neomood) and will no longer be updated! 🚨** 4 | 5 | **NeoMood** is simpler to configure and much better documented. It includes all the features from this configuration and more. 6 | 7 | This configuration still works if you want to use it, but I strongly recommend migrating to **NeoMood** for the best experience and future updates. 8 | 9 | --- 10 | 11 | # Introduction 12 | 13 | mooD Nvim is a configuration made for those who wants to install and use, without worries. 14 | 15 | 16 | - [🪄 Features](#-features) 17 | - [📃 Dependencies](#-dependencies) 18 | - [💾 Installation](#-installation) 19 | - [⚠️ Disclaimer](#️-disclaimer) 20 | - [🔗 Useful links](#-useful-links) 21 | - [🎓 How to learn the keybindings of this configuration?](#-how-to-learn-the-keybindings-of-this-configuration) 22 | 23 | 24 | ![image 1](https://i.imgur.com/GhD6HgM.png) 25 | ![image 2](https://i.imgur.com/nCPvYFN.png) 26 | ![image 3](https://i.imgur.com/baphYpq.png) 27 | ![image 4](https://i.imgur.com/sYYWXYt.png) 28 | 29 | # 🪄 Features 30 | 31 | - 🌜 100% on Lua 32 | - 💡 IDE Features: LSP, snippets, autocomplete, go to definition, go to references, etc. 33 | - 📚 Handbook (SPC h h) and Tutorial (SPC h T) natively. Most of cool feature are listed there. 34 | - ▶️ Awesome Test Runner. 35 | - 🧑‍✈️ Codeium Integration (like Copilot or Whisperer) 36 | - ✏️ Fully customizable by user (plugins, settings, LSP) 37 | - 🔎 Find In Folder helpers: Find inside models, controller, etc using keybindngs. See `keybindings.lua` (`SPC f p`) for more examples. You can define your own custom finders. 38 | - 🪟 TMUX Framework with `tmux-awesome-manager` that can: 39 | - 🖥️ You can bind terminal commands in your `keybindings.lua` (`SPC f p`). 40 | - 🚃 Useful for commands such as rails console, server, sidekiq, yarn start, generate, open production stuff, etc. (Examples on `keybindings.lua`) 41 | - 📽️ You can define server terminal commands separated by project and run with a single command. 42 | 43 | # 📃 Dependencies 44 | 45 | - Neovim >= 0.9.5 < 0.10 (Neovim 0.10 is still buggy for rubocop LSP, lets use 0.9) You can use [Bob](https://github.com/MordechaiHadad/bob) to install the 0.9.5 46 | - lazygit (optional) 47 | - ripgrep 48 | - NerdFonts 49 | - Python 50 | - pynvim (without this, it will thrown an error when you open mood) 51 | - git-delta (for lazygit, optional) - [Installation](https://dandavison.github.io/delta/installation.html) 52 | 53 | # 💾 Installation 54 | 55 | We created a bash script to make your life easier and install Mood Nvim automatically. 56 | Just run the below command in the terminal on either mac or linux (ubuntu only), choose what you want to install and have fun! 57 | 58 | ```sh 59 | bash <(curl -Ls https://raw.githubusercontent.com/otavioschwanck/mood-nvim/main/bin/mood-installer.sh) 60 | ``` 61 | If you will use tmux, after the first open, press `C-x I` to install the packages. 62 | 63 | To install manually, check the [Manual Installation Page](https://github.com/otavioschwanck/mood-nvim/wiki/Manual-Installation#manual-installation). 64 | 65 | After the installation, check if is missing something with `:checkhealth` 66 | 67 | When you run the tmux for the first time, press `C-x I` to install the missing plugins. 68 | 69 | # ⚠️ Disclaimer 70 | 71 | This configuration is made to use with Alacritty and Tmux. Please install it and learn before use it. 72 | 73 | # 🔗 Useful links 74 | 75 | - [changelog](https://github.com/otavioschwanck/mood-nvim/wiki/Changelog) 76 | - [breaking changes](https://github.com/otavioschwanck/mood-nvim/wiki/Breaking-Changes) 77 | 78 | # 🎓 How to learn the keybindings of this configuration? 79 | 80 | Just press `SPC h h` to open the handbook inside vim. 81 | -------------------------------------------------------------------------------- /bin/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONFIG_DIR=$(dirname "$MYVIMRC") 4 | 5 | mkdir -p "$CONFIG_DIR/lua/user/" 6 | 7 | USER_CONFIG="$CONFIG_DIR/lua/user/config.lua" 8 | if test -f "$USER_CONFIG"; then 9 | echo "$USER_CONFIG exists. Ignoring..." 10 | else 11 | cp "$CONFIG_DIR/extra/examples/config.lua" "$USER_CONFIG" 12 | echo "$USER_CONFIG created." 13 | fi 14 | 15 | BEFORE_START="$CONFIG_DIR/lua/user/before_start.lua" 16 | if test -f "$BEFORE_START"; then 17 | echo "$BEFORE_START exists. Ignoring..." 18 | else 19 | cp "$CONFIG_DIR/extra/examples/before_start.lua" "$BEFORE_START" 20 | echo "$BEFORE_START created." 21 | fi 22 | 23 | VS_SNIPPETS="$CONFIG_DIR/vs-snippets" 24 | if test -d "$VS_SNIPPETS"; then 25 | echo "$VS_SNIPPETS exists. Ignoring..." 26 | else 27 | cp -r "$CONFIG_DIR/extra/examples/vs-snippets/" "$VS_SNIPPETS" 28 | echo "$VS_SNIPPETS created." 29 | fi 30 | 31 | AFTER_CONFIG="$CONFIG_DIR/lua/user/after_start.lua" 32 | if test -f "$AFTER_CONFIG"; then 33 | echo "$AFTER_CONFIG exists. Ignoring..." 34 | else 35 | cp "$CONFIG_DIR/extra/examples/after_start.lua" "$AFTER_CONFIG" 36 | echo "$AFTER_CONFIG created." 37 | fi 38 | 39 | USER_KEYBINDINGS="$CONFIG_DIR/lua/user/keybindings.lua" 40 | if test -f "$USER_KEYBINDINGS"; then 41 | echo "$USER_KEYBINDINGS exists. Ignoring..." 42 | else 43 | cp "$CONFIG_DIR/extra/examples/keybindings.lua" "$USER_KEYBINDINGS" 44 | echo "$USER_KEYBINDINGS created." 45 | fi 46 | 47 | USER_LSP="$CONFIG_DIR/lua/user/lsp.lua" 48 | if test -f "$USER_LSP"; then 49 | echo "$USER_LSP exists. Ignoring..." 50 | else 51 | cp "$CONFIG_DIR/extra/examples/lsp.lua" "$USER_LSP" 52 | echo "$USER_LSP created." 53 | fi 54 | 55 | TMUX=~/.tmux.conf 56 | if test -f "$TMUX"; then 57 | echo "$TMUX exists. Ignoring..." 58 | else 59 | cp "$CONFIG_DIR/extra/.tmux.conf" "$TMUX" 60 | echo "$TMUX created." 61 | fi 62 | 63 | ALACRITTY=~/.config/alacritty/alacritty.toml 64 | if test -f "$ALACRITTY"; then 65 | echo "$ALACRITTY exists. Ignoring..." 66 | else 67 | mkdir -p ~/.config/alacritty 68 | cp "$CONFIG_DIR/extra/alacritty.toml" "$ALACRITTY" 69 | echo "$ALACRITTY created." 70 | fi 71 | 72 | PLUGINS="$CONFIG_DIR/lua/user/plugins.lua" 73 | if test -f "$PLUGINS"; then 74 | echo "$PLUGINS exists. Ignoring..." 75 | else 76 | cp "$CONFIG_DIR/extra/examples/plugins.lua" "$PLUGINS" 77 | echo "$PLUGINS created." 78 | fi 79 | 80 | TEMPLATES="$CONFIG_DIR/lua/templates/ruby.lua" 81 | if test -f "$TEMPLATES"; then 82 | echo "$TEMPLATES exists. Ignoring..." 83 | else 84 | cp -r "$CONFIG_DIR/extra/examples/templates/" "$CONFIG_DIR/lua/templates/" 85 | echo "$TEMPLATES created." 86 | fi 87 | 88 | get_machine_type () { 89 | unameOut="$(uname -s)" 90 | case "${unameOut}" in 91 | Linux*) machine=Linux;; 92 | Darwin*) machine=Mac;; 93 | CYGWIN*) machine=Cygwin;; 94 | MINGW*) machine=MinGw;; 95 | *) machine="UNKNOWN:${unameOut}" 96 | esac 97 | echo "Proceeding instalation for OS ${machine}" 98 | } 99 | 100 | linux_workflow () { 101 | LAZYGIT=~/.config/lazygit/config.yml 102 | if test -f "$LAZYGIT"; then 103 | echo "$LAZYGIT exists. Ignoring..." 104 | else 105 | cp "$CONFIG_DIR/extra/examples/lazygit.yml" ~/.config/lazygit/config.yml 106 | echo "$LAZYGIT created." 107 | fi 108 | } 109 | 110 | mac_workflow () { 111 | LAZYGIT=~/Library/Application\ Support/lazygit/config.yml 112 | if test -f "$LAZYGIT"; then 113 | echo "$LAZYGIT exists. Ignoring..." 114 | else 115 | cp "$CONFIG_DIR/extra/examples/lazygit.yml" ~/Library/Application\ Support/lazygit/config.yml 116 | echo "$LAZYGIT created." 117 | fi 118 | } 119 | 120 | get_machine_type 121 | 122 | case "${machine}" in 123 | Linux) linux_workflow;; 124 | Mac) mac_workflow;; 125 | *) echo "OS not recognized" 126 | esac 127 | -------------------------------------------------------------------------------- /extra/.tmux.conf: -------------------------------------------------------------------------------- 1 | set -g @plugin 'tmux-plugins/tpm' 2 | set -g @plugin 'tmux-plugins/tmux-sensible' 3 | set -g @plugin 'laktak/extrakto' 4 | 5 | set-option -g detach-on-destroy off 6 | 7 | set -g default-terminal 'screen-256color' 8 | 9 | set -g @plugin 'tmux-plugins/tmux-open' 10 | set -g @plugin 'tmux-plugins/tmux-copycat' 11 | set -g @plugin 'tmux-plugins/tmux-cowboy' 12 | set -g @plugin 'tmux-plugins/tmux-sessionist' 13 | 14 | set -g window-status-format " #[fg=#f5bde6]#I#{?paneguibg=NONE _in_mode,  #{pane_mode},} #[fg=#63698c]#W #[fg=#222437]" 15 | set -g window-status-separator "" 16 | set -g window-status-current-format " #[fg=#f5bde6]#I#[fg=red]#{?pane_in_mode,  #{pane_mode},} #[fg=#ffffff]#W #[fg=#222437]" 17 | set -g window-status-current-style "bg=default fg=#ffffff" 18 | set -g status-style "bg=default fg=#63698c" 19 | set -g status-right-length 0 20 | set -g status-left "" 21 | set -g status-right-style "bg=default bold" 22 | set -g status-right " #[fg=#ffffff]#{session_name} " 23 | 24 | set-option -sa terminal-overrides ',xterm-256color:RGB' 25 | set-option -sa terminal-overrides ',xterm-256color:Tc' 26 | 27 | set-option -g renumber-windows on 28 | set-option -sa terminal-overrides ',alacritty:RGB' 29 | set-option -sa terminal-overrides ',alacritty:Tc' 30 | 31 | set-option -g prefix C-x 32 | unbind-key C-x 33 | bind-key C-x send-prefix 34 | 35 | bind-key x kill-pane 36 | 37 | set -g base-index 1 38 | setw -g mode-keys vi 39 | 40 | bind -n C-1 previous-window 41 | 42 | bind -T copy-mode-vi v send -X begin-selection 43 | bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" 44 | bind P paste-buffer 45 | bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy" 46 | 47 | setw -g mouse on 48 | unbind -T copy-mode MouseDragEnd1Pane 49 | unbind -T copy-mode-vi MouseDragEnd1Pane 50 | 51 | set-option -g default-terminal screen-256color 52 | set -s escape-time 0 53 | set -g @continuum-restore 'on' 54 | 55 | bind-key V split-window -v -c "#{pane_current_path}" 56 | bind-key v split-window -h -c "#{pane_current_path}" 57 | bind-key C-a select-pane -t :.+ \; resize-pane -Z 58 | 59 | unbind-key c 60 | bind-key c new-window -c "#{pane_current_path}" 61 | 62 | # For normal monitors: 63 | bind -r C-h resize-pane -L 45 64 | bind -r C-l resize-pane -R 45 65 | bind -r C-j resize-pane -D 15 66 | bind -r C-k resize-pane -U 15 67 | 68 | # For ultrawide, i recommend: 69 | # bind -r C-h resize-pane -L 75 70 | # bind -r C-l resize-pane -R 75 71 | # bind -r C-j resize-pane -D 15 72 | # bind -r C-k resize-pane -U 15 73 | 74 | bind-key m choose-tree -Zw "join-pane -t '%%'" 75 | bind-key M choose-tree -Zs "join-pane -t '%%'" 76 | 77 | bind-key b break-pane 78 | 79 | unbind-key t 80 | bind-key = last-window 81 | 82 | bind-key > swap-window -t +1 \; next-window 83 | bind-key < swap-window -t -1 \; previous-window 84 | 85 | bind-key ! next-layout 86 | unbind-key $ 87 | bind-key $ swap-pane -D 88 | 89 | bind-key h select-pane -L 90 | bind-key j select-pane -D 91 | bind-key k select-pane -U 92 | bind-key l select-pane -R 93 | 94 | set-option -g focus-events on 95 | 96 | is_many="if [ #{window_panes} -eq 1 ]; then exit 1; fi" 97 | set-hook -g pane-focus-in 'if-shell "$is_many" "selectp -P bg=#292c41; run \"sleep 0.1\"; selectp -P bg=default"' 98 | 99 | set-option -g status "on" 100 | 101 | is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ 102 | | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'" 103 | 104 | bind-key C-p if-shell "$is_vim" 'send-keys C-w ,' 'select-pane -t :.-' 105 | bind-key C-n if-shell "$is_vim" 'send-keys C-w \\;' 'select-pane -t :.+' 106 | 107 | run '~/.tmux/plugins/tpm/tpm' 108 | 109 | set -g pane-active-border-style bg=default,fg=#1a1b26 110 | set -g pane-border-style fg=#1a1b26 111 | 112 | set-option -g status-interval 5 113 | set-option -g automatic-rename on 114 | set-option -g automatic-rename-format '#{b:pane_current_path}: #{b:pane_current_command}' 115 | 116 | # set-option -g status-style bg=default 117 | -------------------------------------------------------------------------------- /lua/mood-scripts/custom_telescope.lua: -------------------------------------------------------------------------------- 1 | local Path = require("plenary.path") 2 | local action_set = require("telescope.actions.set") 3 | local action_state = require("telescope.actions.state") 4 | local actions = require("telescope.actions") 5 | local conf = require("telescope.config").values 6 | local finders = require("telescope.finders") 7 | local make_entry = require("telescope.make_entry") 8 | local os_sep = Path.path.sep 9 | local pickers = require("telescope.pickers") 10 | local builtin = require("telescope.builtin") 11 | local scan = require("plenary.scandir") 12 | local telescopeMakeEntryModule = require("telescope.make_entry") 13 | 14 | local custom_pickers = {} 15 | 16 | -- We cache the results of "git rev-parse" 17 | -- Process creation is expensive in Windows, so this reduces latency 18 | local is_inside_work_tree = {} 19 | 20 | custom_pickers.filename_first = function(_, path) 21 | local tail = vim.fs.basename(path) 22 | local parent = vim.fs.dirname(path) 23 | 24 | if parent == "." then return tail end 25 | 26 | return string.format("%s\t\t%s", tail, parent) 27 | end 28 | 29 | custom_pickers.project_files = function() 30 | local cwd = vim.fn.getcwd() 31 | if is_inside_work_tree[cwd] == nil then 32 | vim.fn.system("git rev-parse --is-inside-work-tree") 33 | 34 | is_inside_work_tree[cwd] = vim.v.shell_error == 0 35 | end 36 | 37 | if is_inside_work_tree[cwd] then 38 | require("telescope.builtin").git_files({}) 39 | else 40 | require("telescope.builtin").find_files({}) 41 | end 42 | end 43 | 44 | custom_pickers.ripgrep = function() 45 | vim.ui.input({ prompt = "Enter something to query: " }, function(input) 46 | builtin.grep_string({ 47 | find_command = { 48 | "rg", 49 | "-g", 50 | "!.git", 51 | "-g", 52 | "!node_modules", 53 | "-g", 54 | "!package-lock.json", 55 | "-g", 56 | "!yarn.lock", 57 | "--hidden", 58 | "--no-ignore-global", 59 | "--color=never", 60 | "--no-heading", 61 | "--with-filename", 62 | "--line-number", 63 | "--column", 64 | }, 65 | search = input, 66 | }) 67 | end) 68 | end 69 | 70 | custom_pickers.live_grep_in_folder = function(opts) 71 | opts = opts or {} 72 | local data = {} 73 | scan.scan_dir(vim.loop.cwd(), { 74 | hidden = opts.hidden, 75 | only_dirs = true, 76 | respect_gitignore = opts.respect_gitignore, 77 | on_insert = function(entry) 78 | table.insert(data, entry .. os_sep) 79 | end, 80 | }) 81 | table.insert(data, 1, "." .. os_sep) 82 | 83 | pickers 84 | .new(opts, { 85 | prompt_title = "Folders for Live Grep", 86 | finder = finders.new_table({ results = data, entry_maker = make_entry.gen_from_file(opts) }), 87 | previewer = conf.file_previewer(opts), 88 | sorter = conf.file_sorter(opts), 89 | additional_args = { "-j1" }, 90 | attach_mappings = function(prompt_bufnr) 91 | action_set.select:replace(function() 92 | local current_picker = action_state.get_current_picker(prompt_bufnr) 93 | local dirs = {} 94 | local selections = current_picker:get_multi_selection() 95 | if vim.tbl_isempty(selections) then 96 | table.insert(dirs, action_state.get_selected_entry().value) 97 | else 98 | for _, selection in ipairs(selections) do 99 | table.insert(dirs, selection.value) 100 | end 101 | end 102 | actions._close(prompt_bufnr, current_picker.initial_mode == "insert") 103 | 104 | local cwd = vim.fn.getcwd() .. "/" 105 | 106 | for i, item in ipairs(dirs) do 107 | dirs[i] = string.gsub(item, cwd, "") 108 | end 109 | 110 | require("telescope").extensions.egrepify.egrepify({ 111 | search_dirs = dirs, 112 | layout_strategy = require("mood-scripts.layout_strategy").grep_layout(), 113 | }) 114 | end) 115 | return true 116 | end, 117 | }) 118 | :find() 119 | end 120 | 121 | local filter = vim.tbl_filter 122 | 123 | return custom_pickers 124 | -------------------------------------------------------------------------------- /lua/mood-scripts/quick-consult.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.setup() 4 | vim.cmd([[ 5 | function! OpenConsultationWindow() abort 6 | let filepath = shellescape(fnamemodify('~/.nvim-quick-consult', ':p'))[1:-2] 7 | let filepath_of_filetype = shellescape(fnamemodify('~/.nvim-quick-consult-filetype', ':p'))[1:-2] 8 | 9 | if(filereadable(filepath)) 10 | let ui = nvim_list_uis()[0] 11 | 12 | let width = ui.width / 2 - 2 13 | let height = len(readfile(filepath)) 14 | 15 | let buf = nvim_create_buf(v:false, v:true) 16 | 17 | let file = readfile(filepath) 18 | call nvim_buf_set_lines(buf, 0, len(file), 0, file) 19 | 20 | let closingKeys = ['', '', 'q', ''] 21 | for closingKey in closingKeys 22 | call nvim_buf_set_keymap(buf, 'n', closingKey, ':close', {'silent': v:true, 'nowait': v:true, 'noremap': v:true}) 23 | endfor 24 | 25 | let win_count = luaeval('require("utils.buf_count")()') 26 | 27 | if win_count 28 | let col = (ui.width/2) 29 | else 30 | let col = 2 31 | endif 32 | 33 | let opts = {'relative': 'editor', 34 | \ 'width': width, 35 | \ 'height': height, 36 | \ 'col': col, 37 | \ 'row': 3, 38 | \ 'anchor': 'NW', 39 | \ 'style': 'minimal', 40 | \ 'border': 'single' 41 | \ } 42 | let win = nvim_open_win(buf, 1, opts) 43 | 44 | execute "set filetype=" . readfile(filepath_of_filetype)[0] 45 | else 46 | lua require('notify')("Nothing to consult.", 'warn', { title='Quick Consult' }) 47 | endif 48 | endfunction 49 | 50 | function! GetVisualSelection() 51 | let [line_start, column_start] = getpos("'<")[1:2] 52 | let [line_end, column_end] = getpos("'>")[1:2] 53 | let lines = getline(line_start, line_end) 54 | if len(lines) == 0 55 | return '' 56 | endif 57 | let lines[-1] = lines[-1][: column_end - (&selection == 'inclusive' ? 1 : 2)] 58 | let lines[0] = lines[0][column_start - 1:] 59 | return join(lines, "\n") 60 | endfunction 61 | 62 | function SaveSelectionToQuickConsult() 63 | echo 'Overwrite current consult? y/n ' 64 | let l:answer = nr2char(getchar()) 65 | 66 | if l:answer ==? 'y' 67 | let filepath = shellescape(fnamemodify('~/.nvim-quick-consult', ':p'))[1:-2] 68 | let filepath_of_filetype = shellescape(fnamemodify('~/.nvim-quick-consult-filetype', ':p'))[1:-2] 69 | 70 | let selected_text = GetVisualSelection() 71 | call writefile(split(selected_text, "\n"), filepath) 72 | call writefile([&filetype], filepath_of_filetype) 73 | lua require('notify')("Saved!", 'info', { title='Quick Consult' }) 74 | elseif l:answer ==? 'n' 75 | return 0 76 | else 77 | lua require('notify')('Please enter "y" or "n"', 'info', { title='Quick Consult' }) 78 | return SaveSelectionToQuickConsult() 79 | endif 80 | endfunction 81 | 82 | function AppendSelectionToQuickConsult() 83 | let filepath = shellescape(fnamemodify('~/.nvim-quick-consult', ':p'))[1:-2] 84 | 85 | let selected_text = GetVisualSelection() 86 | call writefile(split(selected_text, "\n"), filepath, "a") 87 | lua require('notify')("Text added to quick consult!", 'info', { title='Quick Consult' }) 88 | endfunction 89 | 90 | function SaveClipboardToQuickConsult() 91 | let filepath = shellescape(fnamemodify('~/.nvim-quick-consult', ':p'))[1:-2] 92 | 93 | let text = getreg("\"") 94 | 95 | call writefile(split(text, "\n"), filepath) 96 | lua require('notify')("Saved!", 'info', { title='Quick Consult' }) 97 | endfunction 98 | 99 | function AppendClipboardToQuickConsult() 100 | let filepath = shellescape(fnamemodify('~/.nvim-quick-consult', ':p'))[1:-2] 101 | 102 | let text = getreg("\"") 103 | 104 | call writefile(split(text, "\n"), filepath, "a") 105 | 106 | lua require('notify')("Text Added to quick consult!", 'info', { title='Quick Consult' }) 107 | endfunction 108 | ]]) 109 | end 110 | 111 | return M 112 | -------------------------------------------------------------------------------- /extra/examples/config.lua: -------------------------------------------------------------------------------- 1 | -- SETTINGS --------------------------------------- 2 | -- Use this file to configure your settings/plugins 3 | --------------------------------------------------- 4 | 5 | -- Theme? 6 | -- Set your theme on SPC f p -> before_start 7 | 8 | vim.g.format_on_save = true -- To configure your formatters, press SPC f p and find LSP. SPC h f to enable/disable format on save. 9 | 10 | -- Configure your per project commands. See more at: https://github.com/otavioschwanck/tmux-awesome-manager.nvim 11 | -- Run the per project with SPC # 12 | require("tmux-awesome-manager").setup({ 13 | -- Open in separated session? 14 | project_open_as = "window", -- can be 'separated_session' and 'window' 15 | session_name = "Neovim Terms", 16 | per_project_commands = { 17 | api = { { cmd = "rails s", name = "Rails Server" } }, 18 | front = { { cmd = "yarn start", name = "react server" } }, 19 | }, 20 | default_size = "25%", -- use Alt + , and Alt + ; to switch between neovim and tmux panes 21 | use_icon = true, 22 | open_new_as = "pane", -- change to window to open terms in new tab 23 | }) 24 | 25 | -- Directory to store your notes (SPC z z) 26 | vim.g.ruby_debugger = "debugger" -- can be changed to byebug or pry, call with SPC d 27 | 28 | local two_space_languages = 29 | { "ruby", "yaml", "javascript", "typescript", "typescriptreact", "javascriptreact", "eruby", "lua" } 30 | local four_space_languages = { "solidity" } 31 | 32 | -- autocmd array(AutoCmd, pattern, callback) 33 | local autocommands = { 34 | { 35 | { "FileType" }, 36 | two_space_languages, 37 | function() 38 | vim.cmd("setlocal shiftwidth=2 tabstop=2") 39 | end, 40 | }, 41 | { 42 | { "FileType" }, 43 | four_space_languages, 44 | function() 45 | vim.cmd("setlocal shiftwidth=4 tabstop=4") 46 | end, 47 | }, 48 | } 49 | 50 | -- loading the autocmds 51 | for i = 1, #autocommands, 1 do 52 | vim.api.nvim_create_autocmd(autocommands[i][1], { pattern = autocommands[i][2], callback = autocommands[i][3] }) 53 | end 54 | 55 | -- Use SPC f d to navigate to your dotfiles, configure then here. 56 | vim.g.dotfiles = { 57 | { path = "~/.zshrc", display = "zshrc" }, 58 | { path = "~/.config/alacritty/alacritty.toml", display = "Alacritty" }, 59 | { path = "~/.tmux.conf", display = "TMUX" }, 60 | { path = "~/Library/Application Support/lazygit/config.yml", display = "Lazygit" }, 61 | -- { path = "~/.config/lazygit/config.yml", display = "Lazygit" }, -- (for Linux) 62 | { path = "~/.gitconfig", display = "GitConfig" }, 63 | } 64 | 65 | -- see more at https://github.com/otavioschwanck/telescope-alternate.nvim 66 | require("telescope-alternate").setup({ 67 | mappings = { 68 | { 69 | pattern = "app/services/(.*)_services/(.*).rb", 70 | targets = { 71 | { template = "app/contracts/[1]_contracts/[2].rb", label = "Contract" }, 72 | }, 73 | }, 74 | { "app/contracts/(.*)_contracts/(.*).rb", { { "app/services/[1]_services/[2].rb", "Service" } } }, 75 | { 76 | "src/(.*)/service(.*)/(.*).service.ts", 77 | { 78 | { "src/[1]/controller*/*.controller.ts", "Controller", true }, 79 | { "src/[1]/dto/*", "DTO", true }, 80 | }, 81 | }, 82 | { 83 | "src/(.*)/controller(.*)/(.*).controller.ts", 84 | { 85 | { "src/[1]/service*/*.service.ts", "Service", true }, 86 | { "src/[1]/dto/*", "DTO", true }, 87 | }, 88 | }, 89 | { 90 | "src/(.*)/dto(.*)/(.*)", 91 | { 92 | { "src/[1]/service*/*.service.ts", "Service", true }, 93 | { "src/[1]/controller*/*.controller.ts", "Controller", true }, 94 | }, 95 | }, 96 | }, 97 | }) 98 | 99 | vim.g.folder_to_ignore = { ".*.git/.*", "node_modules/.*", "sorbet/.*", "tmp/.*" } -- Ignore some folders on search? 100 | 101 | -- access your dotfiles with SPC f d 102 | vim.g.dotfiles = { 103 | { path = "~/.zshrc", display = "zshrc" }, 104 | { path = "~/.config/alacritty/alacritty.toml", display = "Alacritty" }, 105 | { path = "~/.tmux.conf", display = "TMUX" }, 106 | { path = "~/Library/Application Support/lazygit/config.yml", display = "Lazygit" }, 107 | -- { path = "~/.config/lazygit/config.yml", display = "Lazygit" }, -- (for Linux) 108 | { path = "~/.gitconfig", display = "GitConfig" }, 109 | } 110 | 111 | -- Mouse? 112 | vim.api.nvim_set_option("mouse", "a") 113 | 114 | local set = vim.api.nvim_set_option 115 | -- set('relativenumber', true) -- relative numbers? 116 | 117 | require("core.settings").remove_bicycle_small_whells({ includeNormalMode = true }) 118 | 119 | -- require("arrow.config").setState("hide_handbook", true) -- disable handbook from arrow 120 | 121 | -- set('colorcolumn', '125') -- column length helper 122 | -------------------------------------------------------------------------------- /extra/examples/templates/ruby.lua: -------------------------------------------------------------------------------- 1 | local utils = require("new-file-template.utils") 2 | 3 | local function generate_module_structure(yield, qtd_dirs_to_hide, path) 4 | local directories = {} 5 | for dir in path:gmatch("[^/]+") do 6 | table.insert(directories, dir) 7 | end 8 | 9 | if qtd_dirs_to_hide >= #directories then 10 | return "# frozen_string_literal: true\n\n" .. yield 11 | end 12 | 13 | for _ = 1, qtd_dirs_to_hide do 14 | table.remove(directories, 1) 15 | end 16 | 17 | local moduleStructure = "" 18 | local indentation = "" 19 | for _, dir in ipairs(directories) do 20 | moduleStructure = moduleStructure .. indentation .. "module " .. utils.snake_to_class_camel(dir) .. "\n" 21 | indentation = indentation .. " " 22 | end 23 | 24 | local classLines = {} 25 | local classIndentation = indentation:sub(1, -3) .. " " 26 | for line in yield:gmatch("[^\n]+") do 27 | table.insert(classLines, classIndentation .. line) 28 | end 29 | yield = table.concat(classLines, "\n") 30 | 31 | moduleStructure = moduleStructure .. yield .. "\n" 32 | 33 | for _ = #directories, 1, -1 do 34 | indentation = indentation:sub(1, -3) 35 | moduleStructure = moduleStructure .. indentation .. "end\n" 36 | end 37 | 38 | return "# frozen_string_literal: true\n\n" .. moduleStructure:sub(1, -2) 39 | end 40 | 41 | local function get_class_name(filename) 42 | return utils.snake_to_class_camel(vim.split(filename, "%.")[1]) 43 | end 44 | 45 | local function inheritance_class(filename, class) 46 | return [[ 47 | class ]] .. get_class_name(filename) .. " < " .. class .. [[ 48 | 49 | |cursor| 50 | end]] 51 | end 52 | 53 | local function base_template(path, filename) 54 | local is_call 55 | 56 | while not (is_call == "1") and not (is_call == "2") do 57 | print("Você tá criando uma classe do ChainApi. Como você deseja criar ela?") 58 | is_call = vim.fn.input("1 - CallBase. 2 - ReadBase >> ") 59 | end 60 | 61 | local inheritance 62 | 63 | if is_call == "1" then 64 | inheritance = "CallBase" 65 | else 66 | inheritance = "ReadBase" 67 | end 68 | 69 | local class_text = string.format( 70 | [[ 71 | class %s < ChainApi::%s 72 | 73 | contract_address ChainApi::ChangeContractHere::CONTRACT_ADDRESS 74 | config :ContractName, :ContractFunction 75 | via_wallet { Wallet.amfi }\n 76 | 77 | def initialize|cursor| 78 | end\n 79 | 80 | def unique_key 81 | "Add A Unique Key Here" 82 | end\n 83 | 84 | def contract_args 85 | [] 86 | end 87 | end]], 88 | get_class_name(filename), 89 | inheritance 90 | ) 91 | 92 | print(class_text) 93 | 94 | return generate_module_structure(class_text, 2, path) 95 | end 96 | 97 | local function create_service_template(path, filename) 98 | print( 99 | "Mood Tip: Para criar ou ir até o contrato referente a este service. Digite: SPC f a (telescope-alternate plugin)" 100 | ) 101 | 102 | local class_text = inheritance_class(filename, "CreateService") 103 | 104 | return generate_module_structure(class_text, 2, path) 105 | end 106 | 107 | local function update_service_template(path, filename) 108 | print( 109 | "Mood Tip: Para criar ou ir até o contrato referente a este service. Digite: SPC f a (telescope-alternate plugin)" 110 | ) 111 | 112 | local class_text = inheritance_class(filename, "UpdateService") 113 | 114 | return generate_module_structure(class_text, 2, path) 115 | end 116 | 117 | local function delete_service_template(path, filename) 118 | print( 119 | "Mood Tip: Para criar ou ir até o contrato referente a este service. Digite: SPC f a (telescope-alternate plugin)" 120 | ) 121 | 122 | local class_text = inheritance_class(filename, "DeleteService") 123 | 124 | return generate_module_structure(class_text, 2, path) 125 | end 126 | 127 | local function contract_template(path, filename) 128 | print( 129 | "Mood Tip: Para criar ou ir até o service referente a este contrato. Digite: SPC f a (telescope-alternate plugin)" 130 | ) 131 | 132 | local class_text = inheritance_class(filename, "BaseContract") 133 | 134 | return generate_module_structure(class_text, 2, path) 135 | end 136 | 137 | --- @param opts table 138 | --- A table containing the following fields: 139 | --- - `full_path` (string): The full path of the new file, e.g., "lua/new-file-template/templates/init.lua". 140 | --- - `relative_path` (string): The relative path of the new file, e.g., "lua/new-file-template/templates/init.lua". 141 | --- - `filename` (string): The filename of the new file, e.g., "init.lua". 142 | return function(opts) 143 | local template = { 144 | { pattern = "app/services/.*_services/create.rb", content = create_service_template }, 145 | { pattern = "app/services/.*_services/delete.rb", content = delete_service_template }, 146 | { pattern = "app/services/.*_services/.*.rb", content = update_service_template }, 147 | { pattern = "app/contracts/.*_contracts/.*.rb", content = contract_template }, 148 | { pattern = "app/business/chain_api/.*/.*", content = base_template }, 149 | } 150 | 151 | return utils.find_entry(template, opts) 152 | end 153 | -------------------------------------------------------------------------------- /extra/examples/keybindings.lua: -------------------------------------------------------------------------------- 1 | -- KEYBINDING --------------------------------- 2 | -- Use this file to set your custom keybindings 3 | ----------------------------------------------- 4 | 5 | -- Some helpers 6 | local find_in_folder = require('helpers.user-functions').find_on_folder 7 | local wk = require("which-key") 8 | local tmux = require('tmux-awesome-manager.src.term') 9 | 10 | -- Arguments for tmux.run_wk: 11 | -- opts.focus_when_call -- Focus terminal instead opening a enw one - default = true 12 | -- opts.visit_first_call -- Focus the new opened window / pane. default = true 13 | -- opts.size -- If open_as = pane, split with this size. default = 50% 14 | -- opts.open_as -- Open as window or pane? Default: what is setted on setup (window) 15 | -- opts.use_cwd -- Use current cwd on new window / pane? Default: what is setted on setup (true) 16 | -- opts.close_on_timer -- When the command completed, sleep for some seconds - default = what is setted on setup: 0 17 | -- opts.read_after_cmd -- When the command completed, wait for enter to close the window. default = true 18 | 19 | -- Registering your keybindings for SPC key. 20 | wk.add({ 21 | { "=", ":w | :silent !bundle exec rubocop -A %:e %", desc = "Rubocop on current file" }, 22 | { "+", tmux.run({ cmd = 'bundle exec rubocop -A', name = 'rubocop', open_as = 'pane', close_on_timer = 2, visit_first_call = false, focus_when_call = false }), desc = "rubocop" }, 23 | 24 | { "o", group = "Term Commands" }, 25 | { "o1", tmux.run({ cmd = 'docker-compose up -d', name = 'Docker Compose up' }), desc = "Docker Compose up" }, 26 | -- Yarn commands 27 | { "oy", group = "yarn" }, 28 | { "oyi", tmux.run({ cmd = 'yarn install', name = 'Yarn Install' }), desc = "Yarn Install" }, 29 | { "oya", tmux.run({ cmd = 'yarn add %1', name = 'Yarn Add', questions = { { question = 'package name: ', required = true } } }), desc = "Yarn Add" }, 30 | { "oyd", tmux.run({ cmd = 'yarn dev', name = 'Yarn Dev' }), desc = "Yarn Dev" }, 31 | 32 | -- Rubocop on current file 33 | { "or", ":silent !bundle exec rubocop -a %", desc = "Rubocop on current file" }, 34 | 35 | -- Brownie commands 36 | { "ob", group = "Brownie" }, 37 | { "obt", tmux.run({ cmd = 'brownie test', name = 'Brownie Test' }), desc = "Brownie Test" }, 38 | { "obC", tmux.run({ cmd = 'brownie compile', name = 'Brownie Compile' }), desc = "Brownie Compile" }, 39 | { "obc", tmux.run({ cmd = 'brownie console', name = 'brownie console' }), desc = "brownie console" }, 40 | 41 | -- Rails commands 42 | { "r", group = "Rails" }, 43 | { "rr", tmux.run({ cmd = 'rails c', name = 'Rails Console', close_on_timer = 3 }), desc = "Rails Console" }, 44 | { "rR", tmux.run({ cmd = 'rails s', name = 'Rails Server', visit_first_call = false, open_as = 'window' }), desc = "Rails Server" }, 45 | { "rb", tmux.run({ cmd = 'bundle install', name = 'Bundle Install', open_as = 'pane', close_on_timer = 2, visit_first_call = false, focus_when_call = false }), desc = "Bundle Install" }, 46 | { "rg", tmux.run({ cmd = 'rails generate %1', name = 'Rails Generate', questions = { { question = "Rails generate: ", required = true } } }), desc = "Rails Generate" }, 47 | { "rd", tmux.run({ cmd = 'rails destroy %1', name = 'Rails Destroy', questions = { { question = "Rails destroy: ", required = true } } }), desc = "Rails Destroy" }, 48 | { "ri", tmux.run({ cmd = 'rails db:migrate', name = 'Rails db:migrate' }), desc = "Rails db:migrate" }, 49 | { "rI", ":call ResetRailsDb('bin/rails db:environment:set RAILS_ENV=development; rails db:drop db:create db:migrate;rails db:seed')", desc = "Rails Reset DB" }, 50 | 51 | -- Rails file finders 52 | find_in_folder("rm", 'app/models', 'Find Model'), 53 | find_in_folder("rq", 'app/avo/resources', 'Find Avo Resources'), 54 | find_in_folder("rq", 'app/contracts', 'Find Contracts'), 55 | find_in_folder("rz", 'app/serializers', 'Find Serializers'), 56 | find_in_folder("rc", 'app/controllers', 'Find Controller'), 57 | find_in_folder("rv", 'app/views', 'Find View'), 58 | find_in_folder("rl", 'config/locales', 'Find Locales'), 59 | find_in_folder("ru", 'spec/factories', 'Find Factories'), 60 | find_in_folder("rs", 'app/services', 'Find Services'), 61 | find_in_folder("rS", 'app/business', 'Find Business'), 62 | find_in_folder("rM", 'db/migrate', 'Find Migration'), 63 | 64 | -- Miscellaneous Rails commands 65 | { "rM", ":Emodel", desc = "Find Model" }, 66 | { "rC", ":Econtroller", desc = "Find Controller" }, 67 | { "rK", ":call KillRubyInstances()", desc = "Kill Ruby Instances" }, 68 | { "rU", ":Efixtures", desc = "Find Current Fixture" }, 69 | { "rN", ":Emigration", desc = "Find Current Migration" } 70 | }) 71 | -------------------------------------------------------------------------------- /extra/examples/lsp.lua: -------------------------------------------------------------------------------- 1 | -- LSP -------------------------------------------- 2 | -- Your Language server protocol stuff 3 | --------------------------------------------------- 4 | 5 | require("luasnip.loaders.from_vscode").lazy_load() 6 | require("luasnip.loaders.from_vscode").lazy_load({ paths = { "./vs-snippets" } }) 7 | 8 | -- Plugins that we will use to setup LSP 9 | local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities() 10 | local lspconfig = require("lspconfig") 11 | local cmp = require("cmp") 12 | local luasnip = require("luasnip") 13 | 14 | -- Setup Mason 15 | require("mason").setup() 16 | 17 | -- Configure your servers. 18 | require("mason-lspconfig").setup({ 19 | ensure_installed = { 20 | "ts_ls", 21 | "lua_ls", 22 | "jsonls", 23 | "solidity", 24 | "yamlls", 25 | "jsonls", -- Don't install solargraph with mason, it sucks. 26 | }, 27 | }) 28 | 29 | require("conform").setup({ 30 | format_on_save = function(bufnr) 31 | if vim.g.format_on_save then 32 | return { 33 | timeout_ms = 5000, 34 | quiet = true, 35 | async = false, 36 | lsp_fallback = true, 37 | } 38 | end 39 | end, 40 | formatters_by_ft = { 41 | lua = { "stylua" }, 42 | javascript = { "prettier" }, 43 | javascriptscript = { "prettier" }, 44 | typescript = { "prettier" }, 45 | typescriptreact = { "prettier" }, 46 | }, 47 | }) 48 | 49 | -- when LSP os connceted, this function is called. 50 | local on_attach = function(client, bufnr) 51 | local opts = { buffer = bufnr } 52 | 53 | local bind = vim.keymap.set 54 | 55 | bind("n", "gd", "lua vim.lsp.buf.definition()", opts) 56 | bind("n", "gr", "Telescope lsp_references", opts) 57 | bind("n", "gI", "Telescope lsp_implementations", opts) 58 | bind("n", "gt", "Telescope lsp_type_definitions", opts) 59 | bind("n", "K", vim.lsp.buf.hover, opts) 60 | end 61 | 62 | -- Add our on_attach for mason installed LSP. 63 | require("mason-lspconfig").setup_handlers({ 64 | function(server_name) 65 | lspconfig[server_name].setup({ 66 | on_attach = on_attach, 67 | capabilities = lsp_capabilities, 68 | }) 69 | end, 70 | }) 71 | 72 | vim.opt.completeopt = { "menu", "menuone", "noinsert", "noselect" } -- Dont select first item 73 | 74 | lspconfig.rubocop.setup({ 75 | cmd = { "bundle", "exec", "rubocop", "--lsp" }, 76 | }) 77 | 78 | lspconfig["solidity"].setup({ -- setup solidity (remove if you don't use) 79 | on_attach = on_attach, 80 | settings = { 81 | solidity = { 82 | includePath = "", 83 | remapping = { ["@OpenZeppelin/"] = "dependencies/OpenZeppelin/openzeppelin-contracts@4.6.0/" }, 84 | }, 85 | }, 86 | }) 87 | 88 | lspconfig["solargraph"].setup( -- setup solargraph (Don't install it with mason, it sucks) 89 | { 90 | on_attach = function(client, bufnr) 91 | on_attach(client, bufnr) 92 | 93 | client.server_capabilities.documentFormattingProvider = false -- we want to use rubocop 94 | end, 95 | settings = { 96 | solargraph = { 97 | formatting = false, 98 | useBundler = true, 99 | diagnostics = true, -- lsp diagnostics are slow 100 | }, 101 | }, 102 | } 103 | ) 104 | 105 | local sources = { 106 | { name = "path" }, -- cmp sources 107 | { keyword_length = 2, name = "nvim_lsp" }, 108 | { name = "buffer", option = { get_bufnrs = require("utils.valid_listed_buffers") } }, 109 | { name = "luasnip", keyword_length = 2 }, 110 | { name = "calc" }, 111 | } 112 | 113 | local autocomplete_mappings = { -- autocomplete mappings 114 | [""] = cmp.mapping.select_next_item({ select = true }, { "i", "s" }), 115 | [""] = cmp.mapping.select_prev_item({ select = true }, { "i", "s" }), 116 | [""] = cmp.mapping.confirm(), 117 | [""] = cmp.mapping.abort(), 118 | [""] = cmp.mapping(function(fallback) 119 | if luasnip.expand_or_locally_jumpable() then 120 | luasnip.expand_or_jump(1) 121 | end 122 | end, { "i", "s" }), 123 | [""] = cmp.mapping(function(fallback) 124 | if luasnip.locally_jumpable() then 125 | luasnip.jump(-1) 126 | end 127 | end, { "i", "s" }), 128 | [""] = cmp.mapping(function(fallback) 129 | vim.fn.feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "x") 130 | luasnip.jump(1) 131 | end, { "s" }), 132 | [""] = cmp.mapping.scroll_docs(-4), 133 | [""] = cmp.mapping.scroll_docs(4), 134 | } 135 | 136 | local border_opts = { 137 | border = { { "╭" }, { "─" }, { "╮" }, { "│" }, { "╯" }, { "─" }, { "╰" }, { "│" } }, 138 | scrollbar = false, 139 | } 140 | 141 | vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { 142 | border = border_opts.border, 143 | close_events = { "BufHidden", "InsertLeave" }, 144 | }) 145 | 146 | vim.diagnostic.config({ 147 | float = border_opts, 148 | }) 149 | 150 | vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, border_opts) 151 | 152 | local icons = require("mood-scripts.icons") 153 | 154 | cmp.setup({ 155 | mapping = autocomplete_mappings, 156 | snippet = { 157 | expand = function(args) 158 | luasnip.lsp_expand(args.body) 159 | end, 160 | }, 161 | window = { 162 | documentation = border_opts, 163 | completion = border_opts, 164 | }, 165 | sources = sources, 166 | formatting = { 167 | fields = { "abbr", "menu", "kind" }, 168 | format = function(entry, item) 169 | local icon = icons[item.kind] or icons[entry.source.name] 170 | 171 | item.menu = icon 172 | 173 | return item 174 | end, 175 | }, 176 | }) 177 | 178 | -- Fix C-n and C-p for cmdline 179 | local cmdline_mappings = cmp.mapping.preset.cmdline() 180 | 181 | cmdline_mappings[""] = nil 182 | cmdline_mappings[""] = nil 183 | 184 | cmp.setup.cmdline("/", { 185 | mapping = cmdline_mappings, 186 | sources = { 187 | { name = "buffer" }, 188 | }, 189 | }) 190 | 191 | cmp.setup.cmdline(":", { 192 | mapping = cmdline_mappings, 193 | sources = cmp.config.sources({ 194 | { name = "path" }, 195 | }, { 196 | { 197 | name = "cmdline", 198 | option = { 199 | ignore_cmds = { "Man", "!" }, 200 | }, 201 | }, 202 | }), 203 | }) 204 | -------------------------------------------------------------------------------- /lua/helpers/vim-functions.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.close_term() 4 | if vim.o.buftype == "terminal" then 5 | vim.cmd("close") 6 | end 7 | end 8 | 9 | function M.setup() 10 | -- TODO: Migrate this functions to lua 11 | 12 | vim.cmd([[ 13 | function OpenTestAlternateAndSplit() 14 | let win_count = luaeval('require("utils.buf_count")()') 15 | let test_path = eval('rails#buffer().alternate()') 16 | 17 | execute "normal! \o" 18 | 19 | execute "norm \v" 20 | 21 | execute "call OpenTestAlternate()" 22 | 23 | if test_path =~ 'app/' 24 | execute "norm \x" 25 | endif 26 | endfunction 27 | 28 | function OpenTestAlternate() 29 | let test_path = eval('rails#buffer().alternate()') 30 | 31 | execute "e " . test_path 32 | 33 | if !filereadable(test_path) && join(getline(1,'$'), "\n") == '' 34 | if test_path =~ "spec/" 35 | lua require("utils.insert_rspec")() 36 | endif 37 | endif 38 | endfunction 39 | 40 | function! RemoveQFItem() 41 | let curqfidx = line('.') - 1 42 | let qfall = getqflist() 43 | call remove(qfall, curqfidx) 44 | call setqflist(qfall, 'r') 45 | execute curqfidx + 1 . "cfirst" 46 | :copen 47 | endfunction 48 | 49 | command! RemoveQFItem :call RemoveQFItem() 50 | 51 | function SearchClassName() 52 | let class_name = GetClassName() 53 | 54 | if class_name != "" 55 | execute ":Telescope grep_string search=" . class_name 56 | endif 57 | endfunction 58 | 59 | function GetClassName() 60 | let filetype = getbufvar('', '&filetype', 'ERROR') 61 | 62 | if filetype == 'ruby' 63 | let modules = getline(1, '$')->filter({_,line -> line =~ 'module\|class \w'}) 64 | 65 | let class_name = '' 66 | let keep_while = 1 67 | let index = 0 68 | 69 | if modules == [] 70 | let keep_while = 0 71 | endif 72 | 73 | while keep_while == 1 74 | let kind = split(modules[index], ' ')[0] 75 | let name = split(modules[index], ' ')[1] 76 | 77 | let class_name = class_name . name 78 | 79 | if kind == 'class' || index >= (len(modules) - 1) 80 | let keep_while = 0 81 | else 82 | let index = index + 1 83 | let class_name = class_name . '::' 84 | endif 85 | endwhile 86 | 87 | call setreg('+', class_name) 88 | call setreg('*', class_name) 89 | 90 | if class_name != '' 91 | echo "Copied to clipboard: " . class_name 92 | 93 | return class_name 94 | else 95 | echo "No class or module found" 96 | 97 | return "" 98 | endif 99 | endif 100 | endfunction 101 | 102 | function BetterMove() 103 | let current_folder = expand('%:p:h') 104 | 105 | call feedkeys(":Move " . current_folder . "/", 'n') 106 | 107 | call timer_start(500, {-> execute("doautocmd BufNew") }) 108 | endfunction 109 | 110 | function BetterRename() 111 | let current_file = expand("%p") 112 | let current_file_name = expand("%:t") 113 | let new_name = input("New name for " . current_file_name . ": ", current_file_name) 114 | let current_folder = expand('%:p:h') 115 | 116 | if(new_name != '' && new_name != current_file_name) 117 | call feedkeys(":saveas " . current_folder . "/" . new_name . "\", "n") 118 | call delete(current_file) 119 | call feedkeys(":bd! #\") 120 | call feedkeys(":e\") 121 | 122 | lua require('notify')("File renamed from " .. vim.api.nvim_eval('current_file_name') .. " to " .. vim.api.nvim_eval('new_name'), 'info', { title='File Management' }) 123 | 124 | call timer_start(500, {-> execute("doautocmd BufNew") }) 125 | endif 126 | endfunction 127 | 128 | function BetterCopy() 129 | let current_folder = expand('%:p:h') 130 | 131 | call feedkeys(":saveas " . current_folder . "/", 'n') 132 | 133 | call timer_start(500, {-> execute("doautocmd BufNew") }) 134 | endfunction 135 | 136 | function BetterDelete() 137 | echo 'Really want to delete current file? y/n ' 138 | let l:answer = nr2char(getchar()) 139 | 140 | if l:answer ==? 'y' 141 | execute "normal! :Delete!\" 142 | lua require('notify')("File deleted.", 'info', { title='File Management' }) 143 | elseif l:answer ==? 'n' 144 | return 0 145 | else 146 | echo 'Please enter "y" or "n"' 147 | return BetterDelete() 148 | endif 149 | endfunction 150 | function Setreg(regname, regval) 151 | exe "let @".a:regname." = '".a:regval."'" 152 | endfunction 153 | 154 | function CopyRelativePath() 155 | let value = fnamemodify(expand("%"), ":~:.") 156 | call Setreg("*", value) 157 | call Setreg("+", value) 158 | echom "Yanked: " . value 159 | endfunction 160 | 161 | function CopyRelativePathWithLine() 162 | let file = fnamemodify(expand("%"), ":~:.") 163 | let line = line(".") 164 | 165 | let value = file . ":" . line 166 | 167 | call Setreg("*", value) 168 | call Setreg("+", value) 169 | echom "Yanked: " . value 170 | endfunction 171 | 172 | function CopyFullPath() 173 | let value = expand("%:p") 174 | call Setreg("*", value) 175 | call Setreg("+", value) 176 | echom "Yanked: " . value 177 | endfunction 178 | 179 | function! TermStrategy(cmd) 180 | if a:cmd =~ 'rspec' 181 | if filereadable("/tmp/quickfix.out") 182 | call delete("/tmp/quickfix.out") 183 | endif 184 | 185 | lua require("mood-scripts.rspec").clear_diagnostics() 186 | lua require("mood-scripts.rspec").wait_quickfix_to_insert_diagnostics() 187 | endif 188 | 189 | lua require("tmux-awesome-manager").execute_command({ cmd = vim.api.nvim_eval("a:cmd"), name = "Tests...", open_as = 'pane', size = '50%', focus_when_call = false }) 190 | endfunction 191 | 192 | function! StripTrailingWhitespaces() 193 | " save last search & cursor position 194 | let _s=@/ 195 | let l = line(".") 196 | let c = col(".") 197 | %s/\s\+$//e 198 | let @/=_s 199 | call cursor(l, c) 200 | endfunction 201 | 202 | function AddDebugger() 203 | let buftype = getbufvar('', '&filetype', 'ERROR') 204 | 205 | if buftype == "ruby" 206 | execute "norm O" . g:ruby_debugger 207 | endif 208 | 209 | if buftype == "eruby" 210 | execute "norm O<% " . g:ruby_debugger . " %>" 211 | endif 212 | 213 | if buftype == "javascript" || buftype == "javascriptreact" || buftype == "typescript" || buftype == "typescriptreact" 214 | echo "j = down. k = up: " 215 | let direction = nr2char(getchar()) 216 | 217 | execute 'norm 0\"dY' 218 | 219 | call setreg("d", substitute(getreg("d"), "'", "\\\\'", "g")) 220 | 221 | if direction == "j" 222 | execute "norm! oconsole.log('DEBUGGER', '\\"dpa', );\h" 223 | execute "startinsert" 224 | elseif direction == "k" 225 | execute "norm! Oconsole.log('DEBUGGER', '\\"dpa', );\h" 226 | execute "startinsert" 227 | else 228 | lua require('vim-notify')('Wrong Direction!', 'error', { title = 'mooD' }) 229 | end 230 | else 231 | write 232 | execute "stopinsert" 233 | endif 234 | endfunction 235 | 236 | function ClearDebugger() 237 | let buftype = getbufvar('', '&filetype', 'ERROR') 238 | 239 | if buftype == "ruby" 240 | execute "%s/.*" . g:ruby_debugger . "\\n//gre" 241 | endif 242 | 243 | if buftype == "javascript" || buftype == "javascriptreact" || buftype == "typescript" || buftype == "typescriptreact" 244 | execute "%s/.*console.log(\\_.\\{-\\});\\n//gre" 245 | endif 246 | 247 | if buftype == "eruby" 248 | execute "%s/.*<% " . g:ruby_debugger . " %>\\n//gre" 249 | endif 250 | write 251 | endfunction 252 | 253 | function FindInFolder(folder, title) 254 | if isdirectory(a:folder) 255 | execute "lua require'telescope.builtin'.find_files({ cwd = '" . a:folder . "', prompt_title = '" . a:title . "', path_display = 'absolute' })" 256 | else 257 | echo "Directory: '" . a:folder . "' not found in this project..." 258 | endif 259 | endfunction 260 | 261 | function s:CleanConfigs() 262 | execute "!sh " .. fnamemodify(expand("$MYVIMRC"), ":h") .. "/bin/clean.sh" 263 | endfunction 264 | 265 | function s:CleanBasicConfigs() 266 | execute "!sh " .. fnamemodify(expand("$MYVIMRC"), ":h") .. "/bin/basic_clean.sh" 267 | endfunction 268 | 269 | function s:CleanAllExceptConfig() 270 | execute "!sh " .. fnamemodify(expand("$MYVIMRC"), ":h") .. "/bin/clean_all_except_config.sh" 271 | endfunction 272 | 273 | function s:UpdateMood() 274 | execute "!cd " .. fnamemodify(expand("$MYVIMRC"), ":h") .. ";git checkout HEAD .;git pull origin main -f" 275 | execute "Lazy load all" 276 | execute "Lazy restore" 277 | execute "Lazy load all" 278 | execute "Lazy install" 279 | endfunction 280 | 281 | command! CleanConfigs :call s:CleanConfigs() 282 | command! CleanConfigsExceptUsers :call s:CleanBasicConfigs() 283 | command! CleanConfigsExceptBaseConfig :call s:CleanAllExceptConfig() 284 | command! UpdateMood :call s:UpdateMood() 285 | 286 | function! ExecuteMacroOverVisualRange() 287 | echo "@".getcmdline() 288 | execute ":'<,'>normal @".nr2char(getchar()) 289 | endfunction 290 | ]]) 291 | end 292 | 293 | return M 294 | -------------------------------------------------------------------------------- /lazy-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, 3 | "aerial.nvim": { "branch": "master", "commit": "140f48fb068d21c02e753c63f7443649e55576f0" }, 4 | "agitator.nvim": { "branch": "main", "commit": "b948e16bba75dc4a114d3416c8e836a8e5e4d006" }, 5 | "arrow.nvim": { "branch": "master", "commit": "fb8e2cf548f625f6e36cb44d3e65600656924234" }, 6 | "bufferize.vim": { "branch": "main", "commit": "ec7c4445a97f19e5784a6fb6ad3c3d4a8ff505ac" }, 7 | "catppuccin": { "branch": "main", "commit": "63685e1562ef53873c9764b483d7ac5c7a608922" }, 8 | "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, 9 | "cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" }, 10 | "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, 11 | "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, 12 | "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, 13 | "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, 14 | "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, 15 | "codeium.vim": { "branch": "main", "commit": "fa65fa942aaf1aef73b6dbe3cc0faa713b738fbe" }, 16 | "conform.nvim": { "branch": "master", "commit": "00f9d91391b04b1935e2f15948bd96cc111e7d3a" }, 17 | "ctrlsf.vim": { "branch": "master", "commit": "32236a8b376d9311dec9b5fe795ca99d32060b13" }, 18 | "dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" }, 19 | "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, 20 | "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, 21 | "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, 22 | "gitsigns.nvim": { "branch": "main", "commit": "1ef74b546732f185d0f806860fa5404df7614f28" }, 23 | "indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" }, 24 | "lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" }, 25 | "lazygit.nvim": { "branch": "main", "commit": "2432b447483f42ff2e18b2d392cb2bb27e495c08" }, 26 | "lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" }, 27 | "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, 28 | "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, 29 | "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, 30 | "mini.ai": { "branch": "main", "commit": "40e380a589d07ec2c856940c6422aafe5d949a0d" }, 31 | "mini.bufremove": { "branch": "main", "commit": "1ee294a97e091d3cf967974df622c0d887890dc2" }, 32 | "new-file-template.nvim": { "branch": "master", "commit": "6ac66669dbf2dc5cdee184a4fe76d22465ca67e8" }, 33 | "none-ls.nvim": { "branch": "main", "commit": "9b98991e15dce8fc502993e23caac2528b8b667f" }, 34 | "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, 35 | "nvim-autopairs": { "branch": "master", "commit": "f158dcb865c36f72c92358f87787dab2c272eaf3" }, 36 | "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, 37 | "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, 38 | "nvim-lspconfig": { "branch": "master", "commit": "b064131428f6bbbbc905f4451ba6779fda334a3a" }, 39 | "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, 40 | "nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" }, 41 | "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, 42 | "nvim-tree.lua": { "branch": "master", "commit": "45a93d99794fff3064141d5b3a50db98ce352697" }, 43 | "nvim-treesitter": { "branch": "master", "commit": "b8ad0473f4d5d7b59e17a67ad0b68711b0232486" }, 44 | "nvim-treesitter-context": { "branch": "master", "commit": "7f7eeaa99e5a9beab518f502292871ae5f20de6f" }, 45 | "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, 46 | "nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" }, 47 | "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, 48 | "nvim-web-devicons": { "branch": "master", "commit": "26220156aafb198b2de6a4cf80c1b120a3768da0" }, 49 | "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, 50 | "nyancat.vim": { "branch": "master", "commit": "2574819b582ad11f9c18c35930c3880d35657699" }, 51 | "oil.nvim": { "branch": "master", "commit": "1360be5fda9c67338331abfcd80de2afbb395bcd" }, 52 | "other.nvim": { "branch": "main", "commit": "252cc279eb3d76685ef48aaeced1c3cf9793581f" }, 53 | "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, 54 | "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, 55 | "rainbow-delimiters.nvim": { "branch": "master", "commit": "5f73b24aeb94f5274c218955573153c69ce4d1ee" }, 56 | "ruby-toolkit.nvim": { "branch": "main", "commit": "3ef2582cfb6e6d97fd4a71af2faf0b2001c429a5" }, 57 | "search-replace.nvim": { "branch": "main", "commit": "d92290a02d97f4e9b8cd60d28b56b403432158d5" }, 58 | "sideways.vim": { "branch": "main", "commit": "5eb971a030a1b5fac7c976582e6cfbe378181f6e" }, 59 | "smart-splits.nvim": { "branch": "master", "commit": "3737faa521d12a0c77d0d28bb15ad903a9e8cfe0" }, 60 | "splitjoin.vim": { "branch": "main", "commit": "f72d59c9f5d4c8b865e0abfeee98f85b47fe5a3a" }, 61 | "sqlite.lua": { "branch": "master", "commit": "d0ffd703b56d090d213b497ed4eb840495f14a11" }, 62 | "switch.vim": { "branch": "main", "commit": "21defb202ebb8406b8ed63183a43ea026f2645b3" }, 63 | "telescope-all-recent.nvim": { "branch": "main", "commit": "267e9e5fd13a6e9a4cc6ffe00452d446d040401d" }, 64 | "telescope-alternate.nvim": { "branch": "master", "commit": "2efa87d99122ee1abe8ada1a50304180a1802c34" }, 65 | "telescope-cmdline-word.nvim": { "branch": "master", "commit": "635dad888b21518da8c6b7f5f126299953492240" }, 66 | "telescope-egrepify.nvim": { "branch": "master", "commit": "36df79554456f47bb3bc6cef8aed55e39a982087" }, 67 | "telescope-file-browser.nvim": { "branch": "master", "commit": "dd9de68c08b6d678198a99f5ea13e0384a1f04cf" }, 68 | "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, 69 | "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, 70 | "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, 71 | "template-string.nvim": { "branch": "main", "commit": "419bfb2e4d5f0e6ddd0d4435f85b69da0d88d524" }, 72 | "tmux-awesome-manager.nvim": { "branch": "master", "commit": "f266ba588249965a16df77bca3f8e9a241156d37" }, 73 | "tokyonight.nvim": { "branch": "main", "commit": "817bb6ffff1b9ce72cdd45d9fcfa8c9cd1ad3839" }, 74 | "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, 75 | "typescript.nvim": { "branch": "main", "commit": "4de85ef699d7e6010528dcfbddc2ed4c2c421467" }, 76 | "undoquit.vim": { "branch": "main", "commit": "96935cae0c04ab9c7384afe1d2537ce883672e8c" }, 77 | "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, 78 | "vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" }, 79 | "vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" }, 80 | "vim-camelsnek": { "branch": "master", "commit": "84b363aa42b5bc3a2314a56d242df20e7bbfcbf3" }, 81 | "vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" }, 82 | "vim-commentary": { "branch": "master", "commit": "c4b8f52cbb7142ec239494e5a2c4a512f92c4d07" }, 83 | "vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" }, 84 | "vim-enmasse": { "branch": "master", "commit": "c2286f1d7bd735287a661cd223cd94e2a1f74deb" }, 85 | "vim-eunuch": { "branch": "master", "commit": "8fb3904be27b6b60d086f87c2570085902414069" }, 86 | "vim-exchange": { "branch": "master", "commit": "d6c1e9790bcb8df27c483a37167459bbebe0112e" }, 87 | "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, 88 | "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, 89 | "vim-indent-object": { "branch": "master", "commit": "8ab36d5ec2a3a60468437a95e142ce994df598c6" }, 90 | "vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" }, 91 | "vim-rails": { "branch": "master", "commit": "d3954dfe3946c9330dc91b4fbf79ccacb2c626c0" }, 92 | "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, 93 | "vim-ruby": { "branch": "master", "commit": "f06f069ce67bdda6f2cd408f8859cdf031e5b6b4" }, 94 | "vim-solidity": { "branch": "master", "commit": "569bbbedc3898236d5912fed0caf114936112ae4" }, 95 | "vim-subversive": { "branch": "master", "commit": "cea98a62ded4028118ad71c3e81b26eff2e0b8a0" }, 96 | "vim-table-mode": { "branch": "master", "commit": "e4365bde024f73e205eefa2fb78e3029ddb92ea9" }, 97 | "vim-test": { "branch": "master", "commit": "c090bfd93919888bb0b86e1ab707bc6a3095097f" }, 98 | "vim-textobj-quotes": { "branch": "master", "commit": "cca9686acf7b21d930ced1801120ecf23fb2f995" }, 99 | "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" }, 100 | "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, 101 | "vim-yoink": { "branch": "master", "commit": "89ed6934679fdbc3c20f552b50b1f869f624cd22" }, 102 | "which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" }, 103 | "yanky.nvim": { "branch": "main", "commit": "73215b77d22ebb179cef98e7e1235825431d10e4" } 104 | } 105 | -------------------------------------------------------------------------------- /extra/tutorial.rb: -------------------------------------------------------------------------------- 1 | ######################################## 2 | ### Welcome to mooD Editing Tutorial ### 3 | ######################################## 4 | 5 | # Here you will learn how to: 6 | # - Do better navigation 7 | # - Do better search/replace 8 | # - Learn how to use the awesome text objects 9 | 10 | # This tutorial is recommended only after vimtutor. 11 | # To access vimtutor, type vimtutor on terminal. 12 | 13 | # Commands to navigate use in this tutorial: 14 | # Ctrl + j or zj = Next exercise 15 | # C-k or zk = Previous exercise 16 | # zj = jump to specific exercise by number 17 | # zr = Reset exercise code (you will use this a lot) 18 | 19 | # I recommended to do each exercise at least 10 times before move to the next. Use zr to keep reseting. 20 | 21 | # Your goal is to make the marked with << Start equal to the code of bottom. All the commands are available. 22 | 23 | # The most important thing on VIM is: Dont use the ARROW KEYS. Insert mode is just for type, not navigate! 24 | 25 | # Press Ctrl + j or zj to start 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | # Exercise 1 - Find character in line 54 | # Commands we will learn: 55 | # f = go to character (next that you input) 56 | # M = start multiple cursors 57 | 58 | # Command to run: f, l daa j yy p l c email 59 | def my_method(name, last_name, email) # << Start 60 | @name = name 61 | end 62 | 63 | 64 | # Code Goal: 65 | def my_method(name, email) 66 | @name = name 67 | @email = email 68 | end 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | # Exercise 2 - 90 | # Lets talk about text objects, one of the most cool things on vim. 91 | # text objects are anything on your code that makes sense, a string with "", an array, an argument, etc 92 | # 93 | # You can edit text objects in two ways. with a = around and with i = inside. 94 | # You can pass the action + a or i + text object. 95 | # 96 | # Example: di" = delete inside double quotes. 97 | # 98 | # New commands we gonna learn in this lesson: 99 | # ca' or caq = Change around quotes (text object) 100 | # ds[ = Delete surround [ 101 | # di{ = Delete inside keys (text object) 102 | # df = Delete until and 103 | 104 | # Commands to run: df_ f' ca' first_name f[ ds[ di} 105 | 106 | my_array = [{ name: 'otavio schwanck' }, [{ name: 'ewerton brabo' }]] # << Start 107 | 108 | # Code Goal: 109 | array = [{ name: first_name }, {}] 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | # Exercise 3 - Until 145 | # One awesome command is t = until. Its like f, but go to one character before. 146 | 147 | # ct = change until (needs 1 more key) 148 | # df = delete until and (needs 1 more key) 149 | # vf, = select until and(needs 1 more key), keep pressing f to keep searching 150 | # yit = yank inside parenthesis (text object) 151 | # x = Delete character at cursor 152 | # vi( = Visual select inside parenthesis 153 | # p while in visual mode (selecting something) = Will substitute selected text with last yank 154 | # (after paste) = Navigate in yank history, you can also use to go back 155 | 156 | # Commands to run: ct. Mood f, yi( l vf, f d j vi( p 157 | 158 | value = Charge::Name.new(name, last_name, email, document_number) # << Start 159 | old_args(invalid_args) 160 | 161 | # Code Goal: 162 | Mood.new(name, document_number) 163 | old_args(name, last_name, email, document_number) 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | # Exercise 4 - Change delimiters 199 | # Explanation: 200 | # 201 | # cs received two arguments: the old delimiter and the new delimiter 202 | # 203 | # Example: cs"] will change "otavio" to [otavio] 204 | # about brackets, keys and parenthesis, if you use they opening, it will 205 | # add spaces, like [ otavio ]. If you use closing, it will be [otavio] 206 | # The same rule is used for S (add delimiter to selected text) 207 | # 208 | # Commands: 209 | # cs]{ = will change [] to { } (with spaces) 210 | # S{ 211 | # ds] = delete delimiter [] 212 | # dt, = delete until comma 213 | # . = repeat last command 214 | # gs = cycle possible stuff (strings to symbols, hash : to =>, always cycling) 215 | # r = change character at cursor to something else 216 | # W = Jump all words until next space, going to first character 217 | # 218 | # Commands ot execute: 219 | # f[ cs[{ w l rO h v E h S{ aname: f[ cs[{ aname: f, dt, .. f: gsW gs gs 220 | 221 | my_hash = ["otavio", ["tulio"], "wrong 1", "wrong 2", "wrong 3", { :name => "thiagovsk" }] # << Start 222 | # Code Goal: 223 | my_hash = { { name: "otavio" }, { name: "tulio" }, { name: :thiagovsk } } 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | # Exercise 5 - Moving arguments around 259 | 260 | # you can move arguments left and right with gh and gl. 261 | # 262 | # Commands we will learn: 263 | # gh = swap argument to argument at left 264 | # gl = swap arugment to argument at right 265 | # daa = delete around argument (text object a = argument) 266 | # cia = change inside argument (text object a = arguemnt) 267 | # F = same as f, but backwards (T and S works as well) 268 | 269 | # Commands: ft gl gl F[ l gl gl gl F' fg h cia two f' daa 270 | 271 | args = [three, four, one, 'wrong argument', '!!DELETE ME!!'] # << Start 272 | 273 | # Code Goal 274 | args = [one, two, three, four] 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | # Exercise 6 - The indentation text object (i just love it) 298 | # dii = delete inside identation (text object) (you can use viic too) 299 | # dai = delete around identation (you can use vaic too) 300 | # cii = change inside identation 301 | # K (while in visual mode) = move selection up (can use J to move down) 302 | # [m = go to previous method definition 303 | # Commands: [m3jciitruevaiKjjcaifor_the_win(true 304 | def my_code 305 | if sometuing 306 | mood do 307 | # do 2 308 | # do 3 309 | end 310 | # do 2 311 | # do 3 312 | end # << Start 313 | end 314 | 315 | # Code Goal: 316 | def my_code 317 | mood do 318 | true 319 | end 320 | 321 | for_the_win(true) 322 | end 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | # Exercise 7 - Split / Join 342 | # Commands: 343 | # This basically joins or split anything, can be tags, blocks, ternay 344 | # gS = Split 345 | # gJ 346 | 347 | # Tip: go see the goal with j, then press zr to come to the top again 348 | # commands gS/ block gJ j - gJ j 0 f[ gS 349 | 350 | mood? ? 'awesome, best editor' : 'please, install mood nvim!' # << STart 351 | block_to_be_joined.each do |b| 352 | b.save 353 | end 354 | must_be_joined = { 355 | one: 'one', 356 | two: 'two' 357 | } 358 | must_be_splitted = ["one", "two"] 359 | 360 | # Goal: 361 | if mood? 362 | 'awesome, best editor' 363 | else 364 | 'please, install mood nvim!' 365 | end 366 | block_to_be_joined.each(&:save) 367 | must_be_joined = { one: 'one', two: 'two' } 368 | must_be_splitted = [ 369 | "one", 370 | "two" 371 | ] 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | # Exercise 8 - Just a warning 415 | # This exercise is just to remember you: DONT USE ARROWS ON INSERT MODE (or any more) (this is for you Thiago!), 416 | # use w, e, b, f, t, s, etc.. 417 | # to select stuff, use v, or V and the text objects 418 | # 419 | # # << Start 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | # Exercise 9 - Search and Replace on block 467 | # Commands: vij = select block 468 | # s/old_text/new_text/gr = changes texts from the block. If you type \0 on old, it will get the current text 469 | # Commands to execute: vij:s/john/new_\0_is_awesome/gr 470 | { 471 | name: john, last_name: john, # << Start 472 | email: john, cpf: john, 473 | cnpj: john 474 | } 475 | 476 | # Code Goal: 477 | { 478 | name: new_john_is_awesome, last_name: new_john_is_awesome, 479 | email: new_john_is_awesome, cpf: new_john_is_awesome, 480 | cnpj: new_john_is_awesome 481 | } 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | # Exercise 10: Macros (Boss Fight) 531 | # 532 | # Commands: 533 | 534 | # q + key = Start recording macro 535 | # q = stop macro (when macro running) 536 | # @ + key = Execute macro saved on key 537 | # SPC m n = turn selection (or word) to snake case 538 | # %s/old_new/gre = The letter `e` at the end is very important, it prevent catch errors on substitute (not all lines need in this code) 539 | # This is very useful to when you copy some CSVs, tables, etc from a website to your code and need to parse! 540 | # Commands to execute: jqqxxv-:s/ /_/grensI:A,j0q@q@q@q 541 | # IMPORTANT: Is good practice to end macros in the place that needs to be executed later! 542 | # << Start 543 | # Rio Grande do Sul 544 | # Rio GrandeDo Norte 545 | # Bahia 546 | # Brasilia 547 | 548 | # Goal: 549 | :rio_grande_do_sul, 550 | :rio_grandedo_norte, 551 | :bahia 552 | :brasil 553 | -------------------------------------------------------------------------------- /extra/Gruvbox Dark.itermcolors: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ansi 0 Color 6 | 7 | Alpha Component 8 | 1 9 | Blue Component 10 | 0.11759774386882782 11 | Color Space 12 | Calibrated 13 | Green Component 14 | 0.11759573966264725 15 | Red Component 16 | 0.11759927868843079 17 | 18 | Ansi 1 Color 19 | 20 | Alpha Component 21 | 1 22 | Blue Component 23 | 0.090684391558170319 24 | Color Space 25 | Calibrated 26 | Green Component 27 | 0.05879192054271698 28 | Red Component 29 | 0.74529051780700684 30 | 31 | Ansi 10 Color 32 | 33 | Alpha Component 34 | 1 35 | Blue Component 36 | 0.11661489307880402 37 | Color Space 38 | Calibrated 39 | Green Component 40 | 0.69061970710754395 41 | Red Component 42 | 0.66574931144714355 43 | 44 | Ansi 11 Color 45 | 46 | Alpha Component 47 | 1 48 | Blue Component 49 | 0.1444794088602066 50 | Color Space 51 | Calibrated 52 | Green Component 53 | 0.6926688551902771 54 | Red Component 55 | 0.96949708461761475 56 | 57 | Ansi 12 Color 58 | 59 | Alpha Component 60 | 1 61 | Blue Component 62 | 0.52537077665328979 63 | Color Space 64 | Calibrated 65 | Green Component 66 | 0.58534377813339233 67 | Red Component 68 | 0.44289660453796387 69 | 70 | Ansi 13 Color 71 | 72 | Alpha Component 73 | 1 74 | Blue Component 75 | 0.53848373889923096 76 | Color Space 77 | Calibrated 78 | Green Component 79 | 0.43883562088012695 80 | Red Component 81 | 0.78096956014633179 82 | 83 | Ansi 14 Color 84 | 85 | Alpha Component 86 | 1 87 | Blue Component 88 | 0.41142863035202026 89 | Color Space 90 | Calibrated 91 | Green Component 92 | 0.71257460117340088 93 | Red Component 94 | 0.49072420597076416 95 | 96 | Ansi 15 Color 97 | 98 | Alpha Component 99 | 1 100 | Blue Component 101 | 0.63873869180679321 102 | Color Space 103 | Calibrated 104 | Green Component 105 | 0.82989895343780518 106 | Red Component 107 | 0.90061241388320923 108 | 109 | Ansi 2 Color 110 | 111 | Alpha Component 112 | 1 113 | Blue Component 114 | 0.082894742488861084 115 | Color Space 116 | Calibrated 117 | Green Component 118 | 0.53061914443969727 119 | Red Component 120 | 0.52591603994369507 121 | 122 | Ansi 3 Color 123 | 124 | Alpha Component 125 | 1 126 | Blue Component 127 | 0.10328958928585052 128 | Color Space 129 | Calibrated 130 | Green Component 131 | 0.53254079818725586 132 | Red Component 133 | 0.80126690864562988 134 | 135 | Ansi 4 Color 136 | 137 | Alpha Component 138 | 1 139 | Blue Component 140 | 0.4586675763130188 141 | Color Space 142 | Calibrated 143 | Green Component 144 | 0.45008346438407898 145 | Red Component 146 | 0.21694663166999817 147 | 148 | Ansi 5 Color 149 | 150 | Alpha Component 151 | 1 152 | Blue Component 153 | 0.45103743672370911 154 | Color Space 155 | Calibrated 156 | Green Component 157 | 0.29604318737983704 158 | Red Component 159 | 0.62685638666152954 160 | 161 | Ansi 6 Color 162 | 163 | Alpha Component 164 | 1 165 | Blue Component 166 | 0.34128850698471069 167 | Color Space 168 | Calibrated 169 | Green Component 170 | 0.55607825517654419 171 | Red Component 172 | 0.34054014086723328 173 | 174 | Ansi 7 Color 175 | 176 | Alpha Component 177 | 1 178 | Blue Component 179 | 0.44320183992385864 180 | Color Space 181 | Calibrated 182 | Green Component 183 | 0.5310559868812561 184 | Red Component 185 | 0.5926094651222229 186 | 187 | Ansi 8 Color 188 | 189 | Alpha Component 190 | 1 191 | Blue Component 192 | 0.37962067127227783 193 | Color Space 194 | Calibrated 195 | Green Component 196 | 0.43934443593025208 197 | Red Component 198 | 0.49889594316482544 199 | 200 | Ansi 9 Color 201 | 202 | Alpha Component 203 | 1 204 | Blue Component 205 | 0.15763583779335022 206 | Color Space 207 | Calibrated 208 | Green Component 209 | 0.18880486488342285 210 | Red Component 211 | 0.96744710206985474 212 | 213 | Background Color 214 | 215 | Alpha Component 216 | 1 217 | Blue Component 218 | 0.11759774386882782 219 | Color Space 220 | Calibrated 221 | Green Component 222 | 0.11759573966264725 223 | Red Component 224 | 0.11759927868843079 225 | 226 | Badge Color 227 | 228 | Alpha Component 229 | 0.5 230 | Blue Component 231 | 0.056549370288848877 232 | Color Space 233 | Calibrated 234 | Green Component 235 | 0.28100395202636719 236 | Red Component 237 | 0.7928692102432251 238 | 239 | Bold Color 240 | 241 | Alpha Component 242 | 1 243 | Blue Component 244 | 1 245 | Color Space 246 | Calibrated 247 | Green Component 248 | 1 249 | Red Component 250 | 1 251 | 252 | Cursor Color 253 | 254 | Alpha Component 255 | 1 256 | Blue Component 257 | 0.63873869180679321 258 | Color Space 259 | Calibrated 260 | Green Component 261 | 0.82989895343780518 262 | Red Component 263 | 0.90061241388320923 264 | 265 | Cursor Guide Color 266 | 267 | Alpha Component 268 | 1 269 | Blue Component 270 | 0.15993706881999969 271 | Color Space 272 | Calibrated 273 | Green Component 274 | 0.16613791882991791 275 | Red Component 276 | 0.17867125570774078 277 | 278 | Cursor Text Color 279 | 280 | Alpha Component 281 | 1 282 | Blue Component 283 | 0.11759774386882782 284 | Color Space 285 | Calibrated 286 | Green Component 287 | 0.11759573966264725 288 | Red Component 289 | 0.11759927868843079 290 | 291 | Foreground Color 292 | 293 | Alpha Component 294 | 1 295 | Blue Component 296 | 0.63873869180679321 297 | Color Space 298 | Calibrated 299 | Green Component 300 | 0.82989895343780518 301 | Red Component 302 | 0.90061241388320923 303 | 304 | Link Color 305 | 306 | Alpha Component 307 | 1 308 | Blue Component 309 | 0.056549370288848877 310 | Color Space 311 | Calibrated 312 | Green Component 313 | 0.28100395202636719 314 | Red Component 315 | 0.7928692102432251 316 | 317 | Selected Text Color 318 | 319 | Alpha Component 320 | 1 321 | Blue Component 322 | 0.26041668653488159 323 | Color Space 324 | Calibrated 325 | Green Component 326 | 0.2891082763671875 327 | Red Component 328 | 0.32501408457756042 329 | 330 | Selection Color 331 | 332 | Alpha Component 333 | 1 334 | Blue Component 335 | 0.63873869180679321 336 | Color Space 337 | Calibrated 338 | Green Component 339 | 0.82989895343780518 340 | Red Component 341 | 0.90061241388320923 342 | 343 | 344 | 345 | -------------------------------------------------------------------------------- /lua/mood-scripts/rspec.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local pickers = require("telescope.pickers") 4 | local finders = require("telescope.finders") 5 | local conf = require("telescope.config").values 6 | local actions = require("telescope.actions") 7 | local action_state = require("telescope.actions.state") 8 | local previewers = require("telescope.previewers") 9 | 10 | M.search_id = nil 11 | 12 | M.quickfix_ns = vim.api.nvim_create_namespace("quickfix") 13 | 14 | local function is_diagnostic_float(win_id) 15 | return vim.api.nvim_win_get_config(win_id).relative ~= "" 16 | end 17 | 18 | -- Function to close all diagnostic float windows 19 | local function close_diagnostic_floats() 20 | local windows = vim.api.nvim_list_wins() 21 | 22 | for _, win_id in ipairs(windows) do 23 | if is_diagnostic_float(win_id) then 24 | vim.api.nvim_win_close(win_id, true) 25 | end 26 | end 27 | end 28 | 29 | local function custom_previewer(opts) 30 | opts = opts or {} 31 | return previewers.new_buffer_previewer({ 32 | title = "File Preview", 33 | define_preview = function(self, entry, status) 34 | local filepath = entry.entry.filepath 35 | local linenr = tonumber(entry.entry.linenr) 36 | 37 | if filepath and vim.fn.filereadable(filepath) == 1 then 38 | vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, vim.fn.readfile(filepath)) 39 | local line_count = vim.api.nvim_buf_line_count(self.state.bufnr) 40 | 41 | local ft = vim.filetype.match({ filename = filepath }) 42 | 43 | if ft then 44 | vim.bo[self.state.bufnr].filetype = ft 45 | 46 | if pcall(require, "nvim-treesitter") then 47 | require("nvim-treesitter.highlight").attach(self.state.bufnr, ft) 48 | else 49 | vim.cmd("syntax enable") 50 | end 51 | end 52 | 53 | if linenr and linenr > 0 and linenr <= line_count then 54 | vim.schedule(function() 55 | vim.api.nvim_buf_add_highlight(self.state.bufnr, -1, "Visual", linenr - 1, 0, -1) 56 | vim.api.nvim_win_set_cursor(status.preview_win, { linenr, 0 }) 57 | -- center cursor on preview_win 58 | vim.cmd("normal! zz") 59 | end) 60 | end 61 | else 62 | print("File not found or not readable:", filepath) 63 | vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, { "File not found: " .. filepath }) 64 | end 65 | end, 66 | }) 67 | end 68 | 69 | function M.go_to_backtrace() 70 | -- get the diagnostic on the line of type quickfix, get the message 71 | local diagnostic = vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR, namespace = M.quickfix_ns })[1] 72 | 73 | if diagnostic then 74 | local message = diagnostic.message 75 | 76 | -- verify if diagnostic contains backtrace 77 | if string.match(message, "Backtrace:") then 78 | -- join message with \\n 79 | local lines = vim.split(message, "\n") 80 | local backtrace_line = nil 81 | 82 | local i = 1 83 | 84 | local backtraces = {} 85 | 86 | for _, line in ipairs(lines) do 87 | if string.match(line, "Backtrace:") and not backtrace_line then 88 | backtrace_line = i 89 | end 90 | 91 | if backtrace_line and i > backtrace_line then 92 | local path = vim.split(line, ":")[1] 93 | local linenr = vim.split(line, ":")[2] 94 | local error = vim.split(line, ":")[3] 95 | 96 | -- path is full system path. Remove the /Users/username/etc with fnamemodify 97 | local display_path = vim.fn.fnamemodify(path, ":~:.") 98 | local display = display_path .. ":" .. linenr .. ":" .. error 99 | 100 | local item = { 101 | path = path .. ":" .. linenr, 102 | display = display, 103 | filepath = path, 104 | linenr = linenr, 105 | } 106 | 107 | local exists = false 108 | 109 | for _, backtrace in ipairs(backtraces) do 110 | if backtrace.filepath == item.filepath and backtrace.linenr == item.linenr then 111 | exists = true 112 | end 113 | end 114 | 115 | if not exists then 116 | table.insert(backtraces, item) 117 | end 118 | end 119 | 120 | i = i + 1 121 | end 122 | 123 | pickers 124 | .new({}, { 125 | prompt_title = "User Files", 126 | finder = finders.new_table({ 127 | results = backtraces, 128 | entry_maker = function(entry) 129 | return { 130 | value = entry.path, 131 | display = entry.display or entry.path, 132 | ordinal = (entry.order or "") .. (entry.display or "") .. entry.path, 133 | entry = entry, 134 | } 135 | end, 136 | }), 137 | sorter = conf.generic_sorter({}), 138 | previewer = custom_previewer({}), 139 | attach_mappings = function(prompt_bufnr, _) 140 | actions.select_default:replace(function() 141 | actions.close(prompt_bufnr) 142 | local local_of_backtrace = action_state.get_selected_entry().value 143 | 144 | local parsed_file = vim.split(local_of_backtrace, ":")[1] 145 | local parsed_line = vim.split(local_of_backtrace, ":")[2] 146 | 147 | if not vim.fn.filereadable(parsed_file) then 148 | print("File not found: " .. parsed_file) 149 | return 150 | end 151 | 152 | local win_exists = false 153 | 154 | local absolute_parsed_file = vim.fn.fnamemodify(parsed_file, ":p") 155 | 156 | for _, win in ipairs(vim.api.nvim_list_wins()) do 157 | local buf = vim.api.nvim_win_get_buf(win) 158 | local buf_file = vim.api.nvim_buf_get_name(buf) 159 | local absolute_buf_file = vim.fn.fnamemodify(buf_file, ":p") 160 | 161 | if absolute_buf_file == absolute_parsed_file then 162 | vim.api.nvim_set_current_win(win) 163 | 164 | vim.cmd("normal! " .. parsed_line .. "G") 165 | win_exists = true 166 | break 167 | end 168 | end 169 | 170 | if not win_exists then 171 | vim.cmd("vsplit " .. parsed_file) 172 | vim.cmd("normal! " .. parsed_line .. "G") 173 | end 174 | end) 175 | return true 176 | end, 177 | }) 178 | :find() 179 | end 180 | else 181 | print("No diagnostics found here") 182 | end 183 | end 184 | 185 | function M.insert_diagnostics(lines) 186 | local diagnostics_by_bufnr = {} 187 | 188 | local error_count = 0 189 | 190 | local line_of_error = {} 191 | 192 | -- Ler o arquivo de quickfix 193 | for line in lines do 194 | if line ~= "finished" then 195 | -- Extrair as partes da linha 196 | local filename, lineno, message = line:match("([^:]+):(%d+): (.+)") 197 | 198 | error_count = error_count + 1 199 | 200 | -- verify if exists a buffer with filename open 201 | local bufnr = vim.fn.bufnr(filename) 202 | 203 | local already_inserted = false 204 | 205 | if diagnostics_by_bufnr[bufnr] then 206 | for _, diagnostic in ipairs(diagnostics_by_bufnr[bufnr]) do 207 | if diagnostic.real_message == message and diagnostic.lnum == lineno - 1 then 208 | already_inserted = true 209 | end 210 | end 211 | end 212 | 213 | if filename and lineno and message and not already_inserted and bufnr ~= -1 then 214 | lineno = tonumber(lineno) 215 | 216 | if not diagnostics_by_bufnr[bufnr] then 217 | diagnostics_by_bufnr[bufnr] = {} 218 | end 219 | 220 | local expanded_cur = vim.fn.fnamemodify(vim.fn.expand("%"), "%") 221 | local expanded_line = vim.fn.fnamemodify(filename, "%") 222 | 223 | if string.sub(expanded_cur, 1, 2) == "./" then 224 | expanded_cur = string.sub(expanded_cur, 3) 225 | end 226 | 227 | if string.sub(expanded_line, 1, 2) == "./" then 228 | expanded_line = string.sub(expanded_line, 3) 229 | end 230 | 231 | if expanded_cur == expanded_line then 232 | table.insert(line_of_error, lineno) 233 | end 234 | 235 | table.insert(diagnostics_by_bufnr[bufnr], { 236 | lnum = lineno - 1, -- Linhas no Neovim são indexadas a partir de 0 237 | col = 0, 238 | severity = vim.diagnostic.severity.ERROR, 239 | source = "quickfix", 240 | message = message:gsub("\\n", "\n"), 241 | real_message = message, 242 | }) 243 | end 244 | end 245 | end 246 | 247 | for bufnr, diagnostics in pairs(diagnostics_by_bufnr) do 248 | vim.diagnostic.set(M.quickfix_ns, bufnr, diagnostics) 249 | end 250 | 251 | if #line_of_error > 0 then 252 | -- create a mark to go back with C-o 253 | vim.cmd("normal! m'") 254 | 255 | local cursor_line_number = vim.fn.line(".") 256 | 257 | local closest_of_the_cursor_line_number = nil 258 | 259 | for _, line in ipairs(line_of_error) do 260 | if not closest_of_the_cursor_line_number then 261 | closest_of_the_cursor_line_number = line 262 | elseif 263 | math.abs(cursor_line_number - line) < math.abs(cursor_line_number - closest_of_the_cursor_line_number) 264 | then 265 | closest_of_the_cursor_line_number = line 266 | end 267 | end 268 | 269 | if closest_of_the_cursor_line_number ~= cursor_line_number then 270 | vim.api.nvim_win_set_cursor(0, { closest_of_the_cursor_line_number, 0 }) 271 | end 272 | 273 | close_diagnostic_floats() 274 | 275 | vim.defer_fn(function() 276 | vim.diagnostic.open_float() 277 | end, 30) 278 | end 279 | 280 | if error_count == 0 then 281 | print("All Tests Passed!") 282 | elseif error_count == 1 then 283 | print(error_count .. " Test Failed!") 284 | else 285 | print(error_count .. " Tests Failed!") 286 | end 287 | end 288 | 289 | function M.generate_random_search_id() 290 | M.search_id = os.time() .. math.random() 291 | 292 | return M.search_id 293 | end 294 | 295 | function M.clear_diagnostics() 296 | vim.diagnostic.reset(M.quickfix_ns) 297 | end 298 | 299 | local function file_exists() 300 | local f = io.open("/tmp/quickfix.out", "r") 301 | return f ~= nil and io.close(f) 302 | end 303 | 304 | function M.wait_quickfix_to_insert_diagnostics(retry_count, search_id) 305 | retry_count = retry_count or 0 306 | 307 | if search_id and search_id ~= M.search_id then 308 | return 309 | end 310 | 311 | search_id = search_id or M.generate_random_search_id() 312 | 313 | if retry_count > 1100 then 314 | return 315 | end 316 | 317 | local lines 318 | local file_size 319 | 320 | if file_exists() then 321 | lines = io.lines("/tmp/quickfix.out") 322 | 323 | file_size = vim.fn.getfsize("/tmp/quickfix.out") 324 | end 325 | 326 | vim.defer_fn(function() 327 | if lines and file_size > 0 then 328 | M.insert_diagnostics(lines) 329 | else 330 | M.wait_quickfix_to_insert_diagnostics(retry_count + 1, search_id) 331 | end 332 | end, 300) 333 | end 334 | 335 | return M 336 | -------------------------------------------------------------------------------- /lua/plugins/init.lua: -------------------------------------------------------------------------------- 1 | local plugins = { 2 | { "junegunn/vim-easy-align", event = "VeryLazy" }, 3 | { 4 | "otavioschwanck/arrow.nvim", 5 | event = "VeryLazy", 6 | opts = { 7 | always_show_path = false, 8 | show_icons = true, 9 | mappings = { 10 | edit = "e", 11 | delete_mode = "d", 12 | clear_all_items = "C", 13 | toggle = "s", 14 | open_vertical = "v", 15 | open_horizontal = "-", 16 | quit = "q", 17 | }, 18 | leader_key = ";", 19 | buffer_leader_key = "m", 20 | after_9_keys = "zxcbnmZXVBNM,afghjklAFGHJKLwrtyuiopWRTYUIOP", -- Please, don't pin more then 9 XD, 21 | save_key = function() 22 | return vim.loop.cwd() -- we use the cwd as the context from the bookmarks. You can change it for anything you want. 23 | end, 24 | full_path_list = { "update_stuff" }, -- filenames on this list will ALWAYS show the file path too. 25 | }, 26 | keys = { 27 | { 28 | "", 29 | "Arrow next_buffer_bookmark", 30 | desc = "Save Current Line", 31 | }, 32 | { 33 | "", 34 | "Arrow prev_buffer_bookmark", 35 | desc = "Save Current Line", 36 | }, 37 | }, 38 | }, 39 | { "otavioschwanck/new-file-template.nvim", opts = {}, event = "VeryLazy" }, 40 | { 41 | "stevearc/oil.nvim", 42 | event = "VeryLazy", 43 | opts = {}, 44 | }, 45 | { 46 | "s1n7ax/nvim-window-picker", 47 | event = "VeryLazy", 48 | config = function() 49 | require("window-picker").setup() 50 | end, 51 | }, 52 | { 53 | "folke/tokyonight.nvim", 54 | lazy = false, 55 | config = function() 56 | vim.opt.termguicolors = true 57 | 58 | require("tokyonight").setup({ 59 | on_highlights = function(hl, c) 60 | local prompt = "#2d3149" 61 | hl.TelescopeBorder = { 62 | bg = c.bg_dark, 63 | fg = c.fg_dark, 64 | } 65 | end, 66 | }) 67 | end, 68 | }, 69 | { 70 | "mrjones2014/smart-splits.nvim", 71 | event = "VeryLazy", 72 | config = function() 73 | require("smart-splits").setup({ 74 | multiplexer_integration = true, 75 | }) 76 | end, 77 | }, 78 | { "AndrewRadev/bufferize.vim", cmd = "Bufferize", event = "VeryLazy" }, 79 | { "otavioschwanck/tmux-awesome-manager.nvim", event = "VeryLazy" }, 80 | { 81 | "catppuccin/nvim", 82 | name = "catppuccin", 83 | lazy = false, 84 | opts = { 85 | integrations = { 86 | cmp = true, 87 | gitsigns = true, 88 | nvimtree = true, 89 | treesitter = true, 90 | notify = true, 91 | telescope = { 92 | enabled = true, 93 | style = "nvchad", 94 | }, 95 | }, 96 | }, 97 | }, 98 | { 99 | "stevearc/aerial.nvim", 100 | config = function() 101 | require("aerial").setup({}) 102 | end, 103 | event = "VeryLazy", 104 | }, 105 | { "tomlion/vim-solidity", event = "VeryLazy" }, 106 | { "rgroli/other.nvim", event = "VeryLazy" }, 107 | { 108 | "nvim-tree/nvim-tree.lua", 109 | event = "VeryLazy", 110 | config = function() 111 | local function on_attach(bufnr) 112 | local api = require("nvim-tree.api") 113 | 114 | local function opts(desc) 115 | return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } 116 | end 117 | 118 | -- default mappings 119 | api.config.mappings.default_on_attach(bufnr) 120 | 121 | vim.keymap.set("n", "]g", api.node.navigate.git.next, opts("Next Git")) 122 | vim.keymap.set("n", "[g", api.node.navigate.git.prev, opts("Prev Git")) 123 | 124 | -- custom mappings 125 | vim.keymap.del("n", "]c", { buffer = bufnr }) 126 | vim.keymap.del("n", "[c", { buffer = bufnr }) 127 | end 128 | 129 | require("nvim-tree").setup({ 130 | on_attach = on_attach, 131 | sort_by = "case_sensitive", 132 | view = { 133 | width = { 134 | min = 30, 135 | max = 60, 136 | }, 137 | }, 138 | renderer = { 139 | group_empty = true, 140 | root_folder_label = false, 141 | }, 142 | filters = { 143 | dotfiles = true, 144 | }, 145 | }) 146 | end, 147 | }, 148 | { 149 | "jose-elias-alvarez/typescript.nvim", 150 | event = "VeryLazy", 151 | }, 152 | { "tpope/vim-repeat", event = "VeryLazy" }, 153 | { 154 | "folke/flash.nvim", 155 | event = "VeryLazy", 156 | opts = { 157 | modes = { 158 | search = { 159 | enabled = false, 160 | }, 161 | char = { 162 | keys = { "f", "F", "t", "T" }, 163 | }, 164 | }, 165 | }, 166 | keys = { 167 | { 168 | "s", 169 | mode = { "n", "x", "o" }, 170 | function() 171 | require("flash").jump() 172 | end, 173 | desc = "Flash", 174 | }, 175 | }, 176 | }, 177 | { 178 | "norcalli/nvim-colorizer.lua", 179 | config = function() 180 | require("colorizer").setup() 181 | end, 182 | }, 183 | { "emmanueltouzery/agitator.nvim", event = "VeryLazy" }, 184 | { "dhruvasagar/vim-table-mode", event = "VeryLazy" }, 185 | { "tpope/vim-commentary", event = "VeryLazy" }, 186 | "axelvc/template-string.nvim", 187 | { 188 | "kylechui/nvim-surround", 189 | version = "*", -- Use for stability; omit to use `main` branch for the latest features 190 | event = "VeryLazy", 191 | config = function() 192 | require("nvim-surround").setup({ 193 | -- Configuration here, or leave empty to use defaults 194 | }) 195 | end, 196 | }, 197 | { 198 | "vim-test/vim-test", 199 | init = function() 200 | vim.g["test#runner_commands"] = { "RSpec" } 201 | end, 202 | event = "VeryLazy", 203 | }, 204 | { "tpope/vim-eunuch", event = "VeryLazy" }, 205 | { "alvan/vim-closetag", event = "VeryLazy" }, 206 | { "tpope/vim-rails", event = "VeryLazy" }, 207 | { "vim-ruby/vim-ruby", event = "VeryLazy" }, 208 | { "farmergreg/vim-lastplace", event = "VeryLazy" }, 209 | { "svermeulen/vim-yoink", event = "VeryLazy" }, 210 | { "tpope/vim-fugitive", event = "VeryLazy" }, 211 | { "AndrewRadev/undoquit.vim", event = "VeryLazy" }, 212 | { "michaeljsmith/vim-indent-object", event = "VeryLazy" }, 213 | { "mbbill/undotree", cmd = "UndotreeToggle", event = "VeryLazy" }, 214 | { "sindrets/diffview.nvim", dependencies = "nvim-lua/plenary.nvim", event = "VeryLazy" }, 215 | { "Olical/vim-enmasse", event = "VeryLazy" }, 216 | { "rcarriga/nvim-notify", event = "VeryLazy" }, 217 | { "rafamadriz/friendly-snippets", event = "VeryLazy" }, 218 | { "ray-x/lsp_signature.nvim", event = "VeryLazy" }, 219 | 220 | { "windwp/nvim-ts-autotag", event = "VeryLazy" }, 221 | { "svermeulen/vim-subversive", event = "VeryLazy" }, 222 | { "beloglazov/vim-textobj-quotes", dependencies = { "kana/vim-textobj-user" }, event = "VeryLazy" }, 223 | { "kdheepak/lazygit.nvim", cmd = "LazyGit", event = "VeryLazy" }, 224 | { "nicwest/vim-camelsnek", event = "VeryLazy" }, 225 | { "AndrewRadev/sideways.vim", event = "VeryLazy" }, 226 | { "AndrewRadev/splitjoin.vim", event = "VeryLazy" }, 227 | { "AndrewRadev/switch.vim", event = "VeryLazy" }, 228 | { "folke/which-key.nvim", event = "VeryLazy", opts = { icons = { mappings = false } } }, 229 | { "tpope/vim-abolish", event = "VeryLazy" }, 230 | { "tommcdo/vim-exchange", event = "VeryLazy" }, 231 | { 232 | "ray-x/lsp_signature.nvim", 233 | opts = { 234 | bind = true, 235 | handler_opts = { 236 | border = "rounded", 237 | }, 238 | }, 239 | event = "VeryLazy", 240 | }, 241 | { "MunifTanjim/nui.nvim", lazy = true, event = "VeryLazy" }, 242 | { 243 | "nvim-tree/nvim-web-devicons", 244 | config = function() 245 | require("nvim-web-devicons").setup({ 246 | override = { 247 | rb = { 248 | icon = "", 249 | color = "#ff8587", 250 | name = "DevIconRb", 251 | }, 252 | }, 253 | }) 254 | end, 255 | event = "VeryLazy", 256 | }, 257 | { "moll/vim-bbye", event = "VeryLazy" }, 258 | { "otavioschwanck/ruby-toolkit.nvim", event = "VeryLazy" }, 259 | { 260 | "lukas-reineke/indent-blankline.nvim", 261 | main = "ibl", 262 | event = "VeryLazy", 263 | config = function() 264 | local highlight = { 265 | "RainbowRed", 266 | "RainbowYellow", 267 | "RainbowBlue", 268 | "RainbowOrange", 269 | "RainbowGreen", 270 | "RainbowViolet", 271 | "RainbowCyan", 272 | } 273 | local hooks = require("ibl.hooks") 274 | -- create the highlight groups in the highlight setup hook, so they are reset 275 | -- every time the colorscheme changes 276 | hooks.register(hooks.type.HIGHLIGHT_SETUP, function() 277 | vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) 278 | vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) 279 | vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) 280 | vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) 281 | vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) 282 | vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) 283 | vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) 284 | end) 285 | 286 | vim.g.rainbow_delimiters = { highlight = highlight } 287 | require("ibl").setup({ 288 | indent = { tab_char = { "▎" } }, 289 | exclude = { filetypes = { "dashboard" } }, 290 | scope = { 291 | highlight = highlight, 292 | show_start = false, 293 | show_end = false, 294 | include = { node_type = { ruby = { "if", "assignment", "pair", "call", "array" } } }, 295 | }, 296 | }) 297 | 298 | hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) 299 | end, 300 | }, 301 | { "HiPhish/rainbow-delimiters.nvim", event = "VeryLazy" }, 302 | { 303 | "lewis6991/gitsigns.nvim", 304 | event = "VeryLazy", 305 | config = function() 306 | require("gitsigns").setup() 307 | end, 308 | dependencies = { "nvim-lua/plenary.nvim" }, 309 | }, 310 | { 311 | "stevearc/conform.nvim", 312 | event = "VeryLazy", 313 | }, 314 | { 315 | "prochri/telescope-all-recent.nvim", 316 | dependencies = { "kkharji/sqlite.lua" }, 317 | event = "VeryLazy", 318 | config = function() 319 | require("telescope-all-recent").setup({ 320 | pickers = { 321 | find_files = { 322 | disable = false, 323 | use_cwd = true, 324 | sorting = "recent", 325 | }, 326 | }, 327 | }) 328 | end, 329 | }, 330 | } 331 | 332 | local user_plugins = require("user.plugins") 333 | 334 | for p = 1, table.getn(user_plugins) do 335 | table.insert(plugins, user_plugins[p]) 336 | end 337 | 338 | vim.opt.number = true 339 | 340 | return plugins 341 | -------------------------------------------------------------------------------- /bin/mood-installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -i 2 | APT_PACKAGES=(sqlite3 libsqlite3-dev xclip python3-pip tmux build-essentials) 3 | NPM_PACKAGES=(neovim diagnostic-languageserver) 4 | GEMS=(solargraph neovim bundler) 5 | MOOD_GIT=(https://github.com/otavioschwanck/mood-nvim.git) 6 | NVIM_DIR=".config/nvim" 7 | NPM_DIR="/npm" 8 | export LAZY_VER="0.35" # LAZYGIT VERSION 9 | TODAY=(date +"%m-%d-%y") 10 | #CHECKS 11 | 12 | cd ~/ 13 | 14 | get_bash_profile () { 15 | if test -f ~/.zshrc; then 16 | BASH_PROFILE=(.zshrc) 17 | else 18 | BASH_PROFILE=(.bashrc) 19 | fi 20 | } 21 | 22 | get_machine_type () { 23 | unameOut="$(uname -s)" 24 | case "${unameOut}" in 25 | Linux*) machine=Linux;; 26 | Darwin*) machine=Mac;; 27 | CYGWIN*) machine=Cygwin;; 28 | MINGW*) machine=MinGw;; 29 | *) machine="UNKNOWN:${unameOut}" 30 | esac 31 | MACHINE=${machine} 32 | } 33 | 34 | ask_question () { 35 | echo "Do you wish to install $1?" 36 | select yn in "Yes" "No"; do 37 | case $yn in 38 | Yes ) echo "Installing $1";$2;break;; 39 | No ) echo "Not installing $1";break;; 40 | esac 41 | done 42 | } 43 | 44 | # Install tmux stuff 45 | install_tmux_package_manager() { 46 | echo "================= INSTALLING TMUX STUFF ===============" 47 | if [ -d ~/.tmux/plugins/tpm ]; then 48 | echo "~/.tmux/plugins/tpm folder already exists, skipping installation of tpm." 49 | else 50 | git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm 51 | fi 52 | } 53 | 54 | # Install base packages 55 | install_packages_linux () { 56 | echo "================= INSTALLING PACKAGES =================" 57 | sudo apt-get -qq update 58 | sudo apt-get -qq install ${APT_PACKAGES[*]} -y 59 | sudo npm install -s -g ${NPM_PACKAGES[*]} -y 60 | install_tmux_package_manager 61 | } 62 | 63 | install_packages_mac () { 64 | echo "================= INSTALLING PACKAGES =================" 65 | brew install git-delta readline openssl zlib postgresql sqlite libffi ripgrep tmux tmuxinator alacritty bash fd 66 | brew link libpq --force 67 | install_tmux_package_manager 68 | } 69 | 70 | install_nvm () { 71 | echo "================= INSTALLING NVM =================" 72 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash 73 | source ~/$BASH_PROFILE 74 | nvm install --lts 75 | NVM_CHECK=true 76 | NPM_CHECK=true 77 | } 78 | 79 | install_nvim_ppa () { 80 | echo "================= INSTALLING NVIM with ppa:neovim-ppa/unstable =================" 81 | sudo apt remove neovim 82 | sudo add-apt-repository ppa:neovim-ppa/unstable -y 83 | sudo apt update -qq -y 84 | sudo apt install neovim -qq -y 85 | source ~/$BASH_PROFILE 86 | NVIM_CHECK=true 87 | NVIM_VERSION_CHECK=true 88 | } 89 | prompt_ruby_versions () { 90 | echo "Which ruby versions would you like to install? Use spaces to install more than one" 91 | echo "Example: 2.7.1 3.0.1 3.1.1" 92 | echo "Leave blank to not install any" 93 | IFS= read -rp 'Ruby Verions: ' USER_RUBY_INPUT 94 | IFS=' ' 95 | read -a RUBY_VERSIONS <<< "$USER_RUBY_INPUT" 96 | } 97 | 98 | install_ruby_linux () { 99 | echo "================= INSTALLING RUBY =================" 100 | curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash 101 | git clone https://github.com/rbenv/ruby-build.git 102 | cat ruby-build/install.sh 103 | PREFIX=/usr/local sudo ./ruby-build/install.sh 104 | echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/$BASH_PROFILE 105 | echo 'eval "$(rbenv init -)"' >> ~/$BASH_PROFILE 106 | source ~/$BASH_PROFILE 107 | echo "gem: --no-document" > ~/.gemrc 108 | prompt_ruby_versions 109 | for i in "${RUBY_VERSIONS[@]}"; do rbenv install $i -s; echo "Installed ruby version $i"; done 110 | } 111 | 112 | install_ruby_mac () { 113 | echo "================= INSTALLING RUBY ON MAC =================" 114 | brew install rbenv ruby-build 115 | echo "gem: --no-document" > ~/.gemrc 116 | prompt_ruby_versions 117 | for i in "${RUBY_VERSIONS[@]}"; do rbenv install $i -s; echo "Installed ruby version $i"; done 118 | } 119 | 120 | install_fonts () { 121 | echo "================= INSTALLING FONTS =================" 122 | if [ -d ~/$FONTS_LIBRARY ]; then 123 | echo "Fonts folder located, proceeding installing fonts" 124 | else 125 | mkdir ~/$FONTS_LIBRARY 126 | fi 127 | cd; wget -q https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/Meslo.zip 128 | unzip -q -o Meslo.zip -d ~/$FONTS_LIBRARY 129 | cd; rm Meslo.zip 130 | } 131 | 132 | # Checks if everything is alright before installing 133 | run_pre_check () { 134 | echo "================= Checking install environment =================" 135 | [ -d ~/.nvm ] && NVM_CHECK=true || NVM_CHECK=false 136 | [ -d ~/.npm ] && NPM_CHECK=true || NPM_CHECK=false 137 | GIT_SSH_COMMAND= git ls-remote -q $MOOD_GIT &> /dev/null 138 | [[ $? = 0 ]] && GIT_CHECK=true || GIT_CHECK=false 139 | type python3 >/dev/null 2>&1 && PYTHON3_CHECK=true || PYTHON3_CHECK=false 140 | type rvm >/dev/null 2>&1 && RVM_CHECK=true || RVM_CHECK=false 141 | type rbenv >/dev/null 2>&1 && RBENV_CHECK=true || RBENV_CHECK=false 142 | command -v nvim >/dev/null 143 | 144 | if [[ $? -ne 0 ]]; then 145 | NVIM_CHECK=false 146 | else 147 | NVIM_CHECK=true 148 | nvim_version=$(nvim --version | head -1 | grep -o '[0-9]\.[0-9]') 149 | 150 | if (( $(echo "$nvim_version < 0.8 " |bc -l) )); then 151 | NVIM_VERSION_CHECK=false 152 | else 153 | NVIM_VERSION_CHECK=true 154 | fi 155 | fi 156 | echo "Your system is running: $MACHINE" 157 | echo "Your bash profile is: $BASH_PROFILE" 158 | printf "%20s %6s\n" "CHECK" "STATUS" 159 | check_color "NVIM is installed" "$NVIM_CHECK" 160 | check_color "NVIM ver. >= 0.8" "$NVIM_VERSION_CHECK" 161 | check_color "Access to Mood Repo" "$GIT_CHECK" 162 | check_color "NVM is installed" "$NVM_CHECK" 163 | check_color "NPM is installed" "$NPM_CHECK" 164 | check_color "Python3 is installed" "$PYTHON3_CHECK" 165 | check_color "RVM is installed" "$RVM_CHECK" 166 | check_color "Rbenv is installed" "$RBENV_CHECK" 167 | } 168 | 169 | # Checks if everything is alright before installing 170 | run_post_check () { 171 | echo "================= Checking post installation environment =================" 172 | [ -d~/.config/nvim .. ] && MOOD_CHECK=true || MOOD_CHECK=false 173 | [ -f ~/"$FONTS_LIBRARY/Meslo LG L Bold Nerd Font Complete.ttf" ] && FONTS_CHECK=true || FONTS_CHECK=false 174 | printf "%20s %6s\n" "CHECK" "STATUS" 175 | check_color "Mood was installed" "$MOOD_CHECK" 176 | check_color "Fonts were installed" "$FONTS_CHECK" 177 | } 178 | 179 | # prints the values for the check routine table 180 | check_color () { 181 | GREEN=$(tput setaf 2) 182 | RED=$(tput setaf 1) 183 | NC=$(tput sgr0) 184 | if [ $2 = true ]; then 185 | CHECK="${GREEN}YES${NC}" 186 | else 187 | CHECK="${RED}NO${NC}" 188 | fi 189 | printf "%20s %6s\n" "$1" "${CHECK}" 190 | } 191 | 192 | install_pip_with_python () { 193 | if [ "$(which python3)" = "" ] 194 | then 195 | echo "Python3 not found, will look for Python" 196 | python -m pip install neovim-remote pynvim --quiet 197 | else 198 | echo "Python3 found, began installing pip" 199 | python3 -m pip install neovim-remote pynvim --quiet 200 | fi 201 | } 202 | 203 | check_for_previous_nvim () { 204 | if [ -d "$NVIM_DIR" ]; then 205 | echo "We found an already installed nvim on your computer!" 206 | mv~/.config/nvim .. ~/.config/nvim-mood-backup-"$TODAY" 207 | echo "The files were moved to .config/nvim-mood-backup" 208 | echo "Now installing mood nvim from main branch." 209 | fi 210 | } 211 | 212 | clone_nvim_repositories () { 213 | git clone --quiet $MOOD_GIT~ .. /.config/nvim 214 | git config --global push.default current 215 | } 216 | 217 | install_nvim () { 218 | echo "================= INSTALLING NVIM =================" 219 | install_pip_with_python 220 | check_for_previous_nvim 221 | clone_nvim_repositories 222 | nvim --headless "+Lazy! sync" +qa 223 | } 224 | 225 | install_gems () { 226 | echo "================= INSTALLING GEMS =================" 227 | if [ "$(which rbenv)" = "" ] 228 | then 229 | echo "Rbenv not found" 230 | else 231 | cd ~/.rbenv/versions/; RUBY_VERSION=(*);rbenv local "$RUBY_VERSION"; rbenv global "$RUBY_VERSION"; cd 232 | echo "Ruby version $RUBY_VERSION was set as global" 233 | echo 'eval "$(rbenv init -)"' >> ~/$BASH_PROFILE 234 | eval "$(rbenv init -)" 235 | rbenv local $RUBY_VERSION 236 | fi 237 | for i in $GEMS; do gem install $i; done 238 | } 239 | 240 | install_lazygit_linux () { 241 | echo "================= INSTALLING LAZY GIT =================" 242 | wget -q -O lazygit.tgz https://github.com/jesseduffield/lazygit/releases/download/v${LAZY_VER}/lazygit_${LAZY_VER}_Linux_x86_64.tar.gz 243 | tar xf lazygit.tgz 244 | sudo mv lazygit /usr/local/bin/ 245 | } 246 | 247 | install_lazygit_mac () { 248 | echo "================= INSTALLING LAZY GIT =================" 249 | brew install jesseduffield/lazygit/lazygit 250 | brew install lazygit git-delta 251 | } 252 | 253 | check_mandatory_parameters() { 254 | if [ "$NVIM_CHECK" = false ];then 255 | echo "It seems that Neovim is not installed, please install it with version >= 0.8 and run this script again." 256 | ask_question "Nvim PPA > 0.8" install_nvim_ppa 257 | fi 258 | 259 | if [ "$NVIM_VERSION_CHECK" = false ];then 260 | echo "It seems that your Neovim version is not compatible with this configuration, please make sure it's version is >= 0.8" 261 | ask_question "Nvim PPA > 0.8" install_nvim_ppa 262 | fi 263 | if [ "$GIT_CHECK" = false ]; then 264 | echo "Could not connect to MooD repo on Github, please make sure you have Git credentials to clone the repo: ${MOOD_GIT}" 265 | fi 266 | if [ "$NVM_CHECK" = false ]; then 267 | echo "NVM was not found on your system, please install it and run this script again." 268 | ask_question "NVM" install_nvm 269 | fi 270 | if [ "$NPM_CHECK" = false ]; then 271 | echo "NPM was not found on your system, please install it and run this script again." 272 | fi 273 | if [ "$PYTHON3_CHECK" = false ]; then 274 | echo "Python3 was not found on your system, please install it and run this script again." 275 | fi 276 | if [ "$NVIM_CHECK" = false ] || [ "$NVM_CHECK" = false ] || [ "$NVIM_VERSION_CHECK" = false ] || [ "$GIT_CHECK" = false ] || [ "$PYTHON3_CHECK" = false ]; then 277 | exit 1 278 | fi 279 | } 280 | 281 | get_machine_type 282 | get_bash_profile 283 | run_pre_check 284 | check_mandatory_parameters 285 | 286 | 287 | linux_workflow () { 288 | FONTS_LIBRARY=".fonts" 289 | ask_question "base packages for neovim" install_packages_linux 290 | ask_question "Ruby on Rails with Rbenv" install_ruby_linux 291 | ask_question "LazyGit" install_lazygit_linux 292 | } 293 | 294 | mac_workflow () { 295 | FONTS_LIBRARY="/Library/Fonts" 296 | ask_question "base packages for neovim" install_packages_mac 297 | ask_question "Ruby on Rails with Rbenv" install_ruby_mac 298 | ask_question "LazyGit" install_lazygit_mac 299 | echo "ulimit -S -n 200048 # Fix Lazy (Package Manager) for neovim" >> ~/$BASH_PROFILE 300 | ulimit -S -n 200048 301 | } 302 | 303 | install_fzf () { 304 | if [ "$(which fzf)" = "" ];then 305 | echo "================= INSTALLING FZF =================" 306 | git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf 307 | ~/.fzf/install 308 | rm -rf ~/.fzf 309 | fi 310 | } 311 | 312 | # SCRIPT QUESTIONAIRE 313 | case "${machine}" in 314 | Linux) linux_workflow;; 315 | Mac) mac_workflow;; 316 | *) echo "OS not recognized" 317 | esac 318 | 319 | 320 | install_fonts 321 | install_gems 322 | install_fzf 323 | install_nvim 324 | run_post_check 325 | 326 | echo "Script finished! After you start tmux, press C-x I to install missing plugins." 327 | -------------------------------------------------------------------------------- /extra/alacritty.yml: -------------------------------------------------------------------------------- 1 | font: 2 | size: 14.0 3 | normal: 4 | family: MesloLGL NF 5 | use_thin_stroke: true 6 | 7 | # window: 8 | # opacity: 0.8 9 | # dynamic_title: true 10 | # decorations_theme_variant: None 11 | 12 | colors: 13 | # Default colors 14 | primary: 15 | background: "#24273A" # base 16 | foreground: "#CAD3F5" # text 17 | # Bright and dim foreground colors 18 | dim_foreground: "#CAD3F5" # text 19 | bright_foreground: "#CAD3F5" # text 20 | 21 | # Cursor colors 22 | cursor: 23 | text: "#24273A" # base 24 | cursor: "#F4DBD6" # rosewater 25 | vi_mode_cursor: 26 | text: "#24273A" # base 27 | cursor: "#B7BDF8" # lavender 28 | 29 | # Search colors 30 | search: 31 | matches: 32 | foreground: "#24273A" # base 33 | background: "#A5ADCB" # subtext0 34 | focused_match: 35 | foreground: "#24273A" # base 36 | background: "#A6DA95" # green 37 | footer_bar: 38 | foreground: "#24273A" # base 39 | background: "#A5ADCB" # subtext0 40 | 41 | # Keyboard regex hints 42 | hints: 43 | start: 44 | foreground: "#24273A" # base 45 | background: "#EED49F" # yellow 46 | end: 47 | foreground: "#24273A" # base 48 | background: "#A5ADCB" # subtext0 49 | 50 | # Selection colors 51 | selection: 52 | text: "#24273A" # base 53 | background: "#F4DBD6" # rosewater 54 | 55 | # Normal colors 56 | normal: 57 | black: "#494D64" # surface1 58 | red: "#ED8796" # red 59 | green: "#A6DA95" # green 60 | yellow: "#EED49F" # yellow 61 | blue: "#494D64" # blue 62 | magenta: "#b884aa" # pink 63 | cyan: "#5b8a83" # teal 64 | white: "#B8C0E0" # subtext1 65 | 66 | # Bright colors 67 | bright: 68 | black: "#5B6078" # surface2 69 | red: "#ED8796" # red 70 | green: "#A6DA95" # green 71 | yellow: "#EED49F" # yellow 72 | blue: "#8AADF4" # blue 73 | magenta: "#F5BDE6" # pink 74 | cyan: "#8BD5CA" # teal 75 | white: "#A5ADCB" # subtext0 76 | 77 | # Dim colors 78 | dim: 79 | black: "#494D64" # surface1 80 | red: "#ED8796" # red 81 | green: "#A6DA95" # green 82 | yellow: "#EED49F" # yellow 83 | blue: "#8AADF4" # blue 84 | magenta: "#F5BDE6" # pink 85 | cyan: "#8BD5CA" # teal 86 | white: "#B8C0E0" # subtext1 87 | 88 | indexed_colors: 89 | - { index: 16, color: "#9c715a" } 90 | - { index: 17, color: "#F4DBD6" } 91 | 92 | # To get keybinding, just run: xxd -psd 93 | key_bindings: 94 | - { key: Home, chars: "\x1bOH", mode: AppCursor } 95 | - { key: Home, chars: "\x1b[H", mode: ~AppCursor } 96 | - { key: End, chars: "\x1bOF", mode: AppCursor } 97 | - { key: End, chars: "\x1b[F", mode: ~AppCursor } 98 | - { key: PageUp, mods: Shift, chars: "\x1b[5;2~" } 99 | - { key: PageUp, mods: Control, chars: "\x1b[5;5~" } 100 | - { key: PageUp, chars: "\x1b[5~" } 101 | - { key: PageDown, mods: Shift, chars: "\x1b[6;2~" } 102 | - { key: Space, mods: Alt, chars: " " } 103 | - { key: Back, mods: Alt, chars: "\x1b\x7f" } # Delete word 104 | - { key: Left, mods: Alt, chars: "\x1bb" } # one word left 105 | - { key: Right, mods: Alt, chars: "\x1bf" } # one word right 106 | - { key: Left, mods: Control, chars: "\x1bb" } # one word left 107 | - { key: Right, mods: Control, chars: "\x1bf" } # one word right 108 | - { key: Delete, mods: Shift, chars: "\x7f" } 109 | 110 | - { key: Back, mods: Shift, chars: "\x1b\x7f" } 111 | - { key: R, mods: Alt, chars: "\x18\x2c" } 112 | - { key: Return, mods: Shift, chars: "\x00" } 113 | - { key: Space, mods: Control, chars: "\x00" } 114 | - { key: Space, mods: Alt, chars: "\x00" } 115 | - { key: Space, mods: Command, chars: "\x00" } 116 | - { key: N, mods: Shift|Command, chars: "\x18\x29" } 117 | - { key: N, mods: Shift|Alt, chars: "\x18\x29" } 118 | - { key: P, mods: Shift|Command, chars: "\x18\x28" } 119 | - { key: P, mods: Shift|Alt, chars: "\x18\x28" } 120 | - { key: T, mods: Shift|Command, chars: "\x18\x43" } 121 | - { key: T, mods: Shift|Alt, chars: "\x18\x43" } 122 | - { key: R, mods: Shift|Command, chars: "\x18\x24" } 123 | - { key: R, mods: Shift|Alt, chars: "\x18\x24" } 124 | - { key: Comma, mods: Shift|Alt, chars: "\x18<" } 125 | - { key: Period, mods: Shift|Alt, chars: "\x18>" } 126 | - { key: Comma, mods: Alt, chars: "\x1b," } 127 | 128 | # Mac 129 | - { key: V, mods: Command, action: Paste } 130 | - { key: B, mods: Command, chars: "\x1b\x62" } 131 | - { key: D, mods: Command, chars: "\x1b\x64" } 132 | - { key: J, mods: Command, chars: "\x18\x6d" } 133 | - { key: K, mods: Command, chars: "\x18\x62" } 134 | - { key: C, mods: Command, action: Copy } 135 | - { key: Q, mods: Command, action: Quit } 136 | - { key: W, mods: Command, action: Quit } 137 | - { key: Key0, mods: Command, action: ResetFontSize } 138 | - { key: Equals, mods: Command, action: IncreaseFontSize } 139 | - { key: Minus, mods: Command, action: DecreaseFontSize } 140 | - { key: Back, mods: Command, chars: "\x15" } # delete word/line 141 | - { key: D, mods: Shift|Command, chars: "\x18\x64" } 142 | - { key: V, mods: Shift|Command, chars: "\x18\x76" } 143 | - { key: A, mods: Shift|Command, chars: "\x18\x73" } 144 | - { key: S, mods: Shift|Command, chars: "\x18\x56" } 145 | - { key: H, mods: Shift|Command, chars: "\x18\x08" } 146 | - { key: J, mods: Shift|Command, chars: "\x18\x0a" } 147 | - { key: K, mods: Shift|Command, chars: "\x18\x0b" } 148 | - { key: L, mods: Shift|Command, chars: "\x18\x0c" } 149 | - { key: Key1, mods: Command, chars: "\x18\x31" } 150 | - { key: Key2, mods: Command, chars: "\x18\x32" } 151 | - { key: Key3, mods: Command, chars: "\x18\x33" } 152 | - { key: Key4, mods: Command, chars: "\x18\x34" } 153 | - { key: Key5, mods: Command, chars: "\x18\x35" } 154 | - { key: Key6, mods: Command, chars: "\x18\x36" } 155 | - { key: Key7, mods: Command, chars: "\x18\x37" } 156 | - { key: Key8, mods: Command, chars: "\x18\x38" } 157 | - { key: Key9, mods: Command, chars: "\x18\x39" } 158 | - { key: T, mods: Command, chars: "\x18\x63" } 159 | - { key: X, mods: Command, chars: "\x18\x78" } 160 | - { key: S, mods: Command, chars: "\x18\x77" } 161 | - { key: Slash, mods: Control|Command, chars: "\x18\x2f" } 162 | - { key: R, mods: Command, chars: "\x18\x2c" } 163 | - { key: LBracket, mods: Command, chars: "\x18\x5b" } 164 | - { key: A, mods: Command, chars: "\x18\x3d" } 165 | - { key: O, mods: Command, chars: "\x18\x6f" } 166 | - { key: O, mods: Shift|Command, chars: "\x18\x7a" } 167 | - { key: Return, mods: Command, chars: "\x18\x7a" } 168 | - { key: Escape, mods: Command, chars: "\x18\x01" } 169 | - { key: Comma, mods: Command, chars: "\x18\x10" } 170 | - { key: Semicolon, mods: Command, chars: "\x18\x0e" } 171 | - { key: F, mods: Shift|Command, chars: "\x18\x09" } 172 | - { key: E, mods: Command, chars: "\x18\x09" } 173 | - { key: N, mods: Command, chars: "\x18\x6e" } 174 | - { key: P, mods: Command, chars: "\x18\x70" } 175 | - { key: Slash, mods: Command, chars: "\x18\x2f" } 176 | - { key: F, mods: Command, chars: "\x1b\x66" } 177 | - { key: I, mods: Command, chars: "\x18\x21" } 178 | - { key: I, mods: Shift|Command, chars: "\x18\x24" } 179 | 180 | # Linux 181 | - { key: V, mods: Alt, action: Paste } 182 | - { key: D, mods: Alt, chars: "\x1b\x64" } 183 | - { key: B, mods: Alt, chars: "\x1b\x62" } 184 | - { key: J, mods: Alt, chars: "\x18\x6d" } 185 | - { key: K, mods: Alt, chars: "\x18\x62" } 186 | - { key: C, mods: Alt, action: Copy } 187 | - { key: Q, mods: Alt, action: Quit } 188 | - { key: W, mods: Alt, action: Quit } 189 | - { key: Key0, mods: Alt, action: ResetFontSize } 190 | - { key: Equals, mods: Alt, action: IncreaseFontSize } 191 | - { key: Minus, mods: Alt, action: DecreaseFontSize } 192 | - { key: Back, mods: Alt, chars: "\x15" } # delete word/line 193 | - { key: D, mods: Shift|Alt, chars: "\x18\x64" } 194 | - { key: V, mods: Shift|Alt, chars: "\x18\x76" } 195 | - { key: A, mods: Shift|Alt, chars: "\x18\x73" } 196 | - { key: S, mods: Shift|Alt, chars: "\x18\x56" } 197 | - { key: H, mods: Shift|Alt, chars: "\x18\x08" } 198 | - { key: J, mods: Shift|Alt, chars: "\x18\x0a" } 199 | - { key: K, mods: Shift|Alt, chars: "\x18\x0b" } 200 | - { key: L, mods: Shift|Alt, chars: "\x18\x0c" } 201 | - { key: Key1, mods: Alt, chars: "\x18\x31" } 202 | - { key: Key2, mods: Alt, chars: "\x18\x32" } 203 | - { key: Key3, mods: Alt, chars: "\x18\x33" } 204 | - { key: Key4, mods: Alt, chars: "\x18\x34" } 205 | - { key: Key5, mods: Alt, chars: "\x18\x35" } 206 | - { key: Key6, mods: Alt, chars: "\x18\x36" } 207 | - { key: Key7, mods: Alt, chars: "\x18\x37" } 208 | - { key: Key8, mods: Alt, chars: "\x18\x38" } 209 | - { key: Key9, mods: Alt, chars: "\x18\x39" } 210 | - { key: T, mods: Alt, chars: "\x18\x63" } 211 | - { key: X, mods: Alt, chars: "\x18\x78" } 212 | - { key: S, mods: Alt, chars: "\x18\x77" } 213 | - { key: Slash, mods: Control|Alt, chars: "\x18\x2f" } 214 | - { key: R, mods: Alt, chars: "\x18\x2c" } 215 | - { key: LBracket, mods: Alt, chars: "\x18\x5b" } 216 | - { key: A, mods: Alt, chars: "\x18\x3d" } 217 | - { key: O, mods: Alt, chars: "\x18\x6f" } 218 | - { key: O, mods: Shift|Alt, chars: "\x18\x7a" } 219 | - { key: Return, mods: Alt, chars: "\x18\x7a" } 220 | - { key: Escape, mods: Alt, chars: "\x18\x01" } 221 | - { key: Comma, mods: Shift|Command, chars: "\x18<" } 222 | - { key: Period, mods: Shift|Command, chars: "\x18>" } 223 | - { key: Comma, mods: Alt, chars: "\x18\x10" } 224 | - { key: Semicolon, mods: Alt, chars: "\x18\x0e" } 225 | - { key: F, mods: Shift|Alt, chars: "\x18\x09" } 226 | - { key: E, mods: Alt, chars: "\x18\x09" } 227 | - { key: N, mods: Alt, chars: "\x18\x6e" } 228 | - { key: P, mods: Alt, chars: "\x18\x70" } 229 | - { key: Slash, mods: Alt, chars: "\x18\x2f" } 230 | - { key: F, mods: Alt, chars: "\x1b\x66" } 231 | - { key: I, mods: Alt, chars: "\x18\x21" } 232 | - { key: I, mods: Shift|Alt, chars: "\x18\x24" } 233 | -------------------------------------------------------------------------------- /extra/alacritty.toml: -------------------------------------------------------------------------------- 1 | [[colors.indexed_colors]] 2 | color = "#9c715a" 3 | index = 16 4 | 5 | [[colors.indexed_colors]] 6 | color = "#F4DBD6" 7 | index = 17 8 | 9 | [colors.bright] 10 | black = "#5B6078" 11 | blue = "#8AADF4" 12 | cyan = "#8BD5CA" 13 | green = "#A6DA95" 14 | magenta = "#F5BDE6" 15 | red = "#ED8796" 16 | white = "#A5ADCB" 17 | yellow = "#EED49F" 18 | 19 | [colors.cursor] 20 | cursor = "#F4DBD6" 21 | text = "#24273A" 22 | 23 | [colors.dim] 24 | black = "#494D64" 25 | blue = "#8AADF4" 26 | cyan = "#8BD5CA" 27 | green = "#A6DA95" 28 | magenta = "#F5BDE6" 29 | red = "#ED8796" 30 | white = "#B8C0E0" 31 | yellow = "#EED49F" 32 | 33 | [colors.hints.end] 34 | background = "#A5ADCB" 35 | foreground = "#24273A" 36 | 37 | [colors.hints.start] 38 | background = "#EED49F" 39 | foreground = "#24273A" 40 | 41 | [colors.normal] 42 | black = "#494D64" 43 | blue = "#494D64" 44 | cyan = "#5b8a83" 45 | green = "#A6DA95" 46 | magenta = "#b884aa" 47 | red = "#ED8796" 48 | white = "#B8C0E0" 49 | yellow = "#EED49F" 50 | 51 | [colors.primary] 52 | background = "#24273A" 53 | bright_foreground = "#CAD3F5" 54 | dim_foreground = "#CAD3F5" 55 | foreground = "#CAD3F5" 56 | 57 | [colors.search.focused_match] 58 | background = "#A6DA95" 59 | foreground = "#24273A" 60 | 61 | [colors.search.matches] 62 | background = "#A5ADCB" 63 | foreground = "#24273A" 64 | 65 | [colors.selection] 66 | background = "#F4DBD6" 67 | text = "#24273A" 68 | 69 | [colors.vi_mode_cursor] 70 | cursor = "#B7BDF8" 71 | text = "#24273A" 72 | 73 | [font] 74 | size = 14.0 75 | 76 | [font.normal] 77 | family = "MesloLGL NF" 78 | 79 | [[keyboard.bindings]] 80 | chars = "\u001BOH" 81 | key = "Home" 82 | mode = "AppCursor" 83 | 84 | [[keyboard.bindings]] 85 | chars = "\u001B[H" 86 | key = "Home" 87 | mode = "~AppCursor" 88 | 89 | [[keyboard.bindings]] 90 | chars = "\u001BOF" 91 | key = "End" 92 | mode = "AppCursor" 93 | 94 | [[keyboard.bindings]] 95 | chars = "\u001B[F" 96 | key = "End" 97 | mode = "~AppCursor" 98 | 99 | [[keyboard.bindings]] 100 | chars = "\u001B[5;2~" 101 | key = "PageUp" 102 | mods = "Shift" 103 | 104 | [[keyboard.bindings]] 105 | chars = "\u001B[5;5~" 106 | key = "PageUp" 107 | mods = "Control" 108 | 109 | [[keyboard.bindings]] 110 | chars = "\u001B[5~" 111 | key = "PageUp" 112 | 113 | [[keyboard.bindings]] 114 | chars = "\u001B[6;2~" 115 | key = "PageDown" 116 | mods = "Shift" 117 | 118 | [[keyboard.bindings]] 119 | chars = " " 120 | key = "Space" 121 | mods = "Alt" 122 | 123 | [[keyboard.bindings]] 124 | chars = "\u001B\u007F" 125 | key = "Back" 126 | mods = "Alt" 127 | 128 | [[keyboard.bindings]] 129 | chars = "\u001Bb" 130 | key = "Left" 131 | mods = "Alt" 132 | 133 | [[keyboard.bindings]] 134 | chars = "\u001Bf" 135 | key = "Right" 136 | mods = "Alt" 137 | 138 | [[keyboard.bindings]] 139 | chars = "\u001Bb" 140 | key = "Left" 141 | mods = "Control" 142 | 143 | [[keyboard.bindings]] 144 | chars = "\u001Bf" 145 | key = "Right" 146 | mods = "Control" 147 | 148 | [[keyboard.bindings]] 149 | chars = "\u007F" 150 | key = "Delete" 151 | mods = "Shift" 152 | 153 | [[keyboard.bindings]] 154 | chars = "\u001B\u007F" 155 | key = "Back" 156 | mods = "Shift" 157 | 158 | [[keyboard.bindings]] 159 | chars = "\u0018," 160 | key = "R" 161 | mods = "Alt" 162 | 163 | [[keyboard.bindings]] 164 | chars = "\u0000" 165 | key = "Return" 166 | mods = "Shift" 167 | 168 | [[keyboard.bindings]] 169 | chars = "\u0000" 170 | key = "Space" 171 | mods = "Control" 172 | 173 | [[keyboard.bindings]] 174 | chars = "\u0000" 175 | key = "Space" 176 | mods = "Alt" 177 | 178 | [[keyboard.bindings]] 179 | chars = "\u0000" 180 | key = "Space" 181 | mods = "Command" 182 | 183 | [[keyboard.bindings]] 184 | chars = "\u0018)" 185 | key = "N" 186 | mods = "Shift|Command" 187 | 188 | [[keyboard.bindings]] 189 | chars = "\u0018)" 190 | key = "N" 191 | mods = "Shift|Alt" 192 | 193 | [[keyboard.bindings]] 194 | chars = "\u0018(" 195 | key = "P" 196 | mods = "Shift|Command" 197 | 198 | [[keyboard.bindings]] 199 | chars = "\u0018(" 200 | key = "P" 201 | mods = "Shift|Alt" 202 | 203 | [[keyboard.bindings]] 204 | chars = "\u0018C" 205 | key = "T" 206 | mods = "Shift|Command" 207 | 208 | [[keyboard.bindings]] 209 | chars = "\u0018C" 210 | key = "T" 211 | mods = "Shift|Alt" 212 | 213 | [[keyboard.bindings]] 214 | chars = "\u0018$" 215 | key = "R" 216 | mods = "Shift|Command" 217 | 218 | [[keyboard.bindings]] 219 | chars = "\u0018$" 220 | key = "R" 221 | mods = "Shift|Alt" 222 | 223 | [[keyboard.bindings]] 224 | chars = "\u0018<" 225 | key = "Comma" 226 | mods = "Shift|Alt" 227 | 228 | [[keyboard.bindings]] 229 | chars = "\u0018>" 230 | key = "Period" 231 | mods = "Shift|Alt" 232 | 233 | [[keyboard.bindings]] 234 | chars = "\u001B," 235 | key = "Comma" 236 | mods = "Alt" 237 | 238 | [[keyboard.bindings]] 239 | action = "Paste" 240 | key = "V" 241 | mods = "Command" 242 | 243 | [[keyboard.bindings]] 244 | chars = "\u001Bb" 245 | key = "B" 246 | mods = "Command" 247 | 248 | [[keyboard.bindings]] 249 | chars = "\u001Bd" 250 | key = "D" 251 | mods = "Command" 252 | 253 | [[keyboard.bindings]] 254 | chars = "\u0018m" 255 | key = "J" 256 | mods = "Command" 257 | 258 | [[keyboard.bindings]] 259 | chars = "\u0018b" 260 | key = "K" 261 | mods = "Command" 262 | 263 | [[keyboard.bindings]] 264 | action = "Copy" 265 | key = "C" 266 | mods = "Command" 267 | 268 | [[keyboard.bindings]] 269 | action = "Quit" 270 | key = "Q" 271 | mods = "Command" 272 | 273 | [[keyboard.bindings]] 274 | action = "Quit" 275 | key = "W" 276 | mods = "Command" 277 | 278 | [[keyboard.bindings]] 279 | action = "ResetFontSize" 280 | key = "Key0" 281 | mods = "Command" 282 | 283 | [[keyboard.bindings]] 284 | action = "IncreaseFontSize" 285 | key = "Equals" 286 | mods = "Command" 287 | 288 | [[keyboard.bindings]] 289 | action = "DecreaseFontSize" 290 | key = "Minus" 291 | mods = "Command" 292 | 293 | [[keyboard.bindings]] 294 | chars = "\u0015" 295 | key = "Back" 296 | mods = "Command" 297 | 298 | [[keyboard.bindings]] 299 | chars = "\u0018d" 300 | key = "D" 301 | mods = "Shift|Command" 302 | 303 | [[keyboard.bindings]] 304 | chars = "\u0018v" 305 | key = "V" 306 | mods = "Shift|Command" 307 | 308 | [[keyboard.bindings]] 309 | chars = "\u0018s" 310 | key = "A" 311 | mods = "Shift|Command" 312 | 313 | [[keyboard.bindings]] 314 | chars = "\u0018V" 315 | key = "S" 316 | mods = "Shift|Command" 317 | 318 | [[keyboard.bindings]] 319 | chars = "\u0018\b" 320 | key = "H" 321 | mods = "Shift|Command" 322 | 323 | [[keyboard.bindings]] 324 | chars = """ 325 | \u0018 326 | """ 327 | key = "J" 328 | mods = "Shift|Command" 329 | 330 | [[keyboard.bindings]] 331 | chars = "\u0018\u000B" 332 | key = "K" 333 | mods = "Shift|Command" 334 | 335 | [[keyboard.bindings]] 336 | chars = "\u0018\f" 337 | key = "L" 338 | mods = "Shift|Command" 339 | 340 | [[keyboard.bindings]] 341 | chars = "\u00181" 342 | key = "Key1" 343 | mods = "Command" 344 | 345 | [[keyboard.bindings]] 346 | chars = "\u00182" 347 | key = "Key2" 348 | mods = "Command" 349 | 350 | [[keyboard.bindings]] 351 | chars = "\u00183" 352 | key = "Key3" 353 | mods = "Command" 354 | 355 | [[keyboard.bindings]] 356 | chars = "\u00184" 357 | key = "Key4" 358 | mods = "Command" 359 | 360 | [[keyboard.bindings]] 361 | chars = "\u00185" 362 | key = "Key5" 363 | mods = "Command" 364 | 365 | [[keyboard.bindings]] 366 | chars = "\u00186" 367 | key = "Key6" 368 | mods = "Command" 369 | 370 | [[keyboard.bindings]] 371 | chars = "\u00187" 372 | key = "Key7" 373 | mods = "Command" 374 | 375 | [[keyboard.bindings]] 376 | chars = "\u00188" 377 | key = "Key8" 378 | mods = "Command" 379 | 380 | [[keyboard.bindings]] 381 | chars = "\u00189" 382 | key = "Key9" 383 | mods = "Command" 384 | 385 | [[keyboard.bindings]] 386 | chars = "\u0018c" 387 | key = "T" 388 | mods = "Command" 389 | 390 | [[keyboard.bindings]] 391 | chars = "\u0018x" 392 | key = "X" 393 | mods = "Command" 394 | 395 | [[keyboard.bindings]] 396 | chars = "\u0018w" 397 | key = "S" 398 | mods = "Command" 399 | 400 | [[keyboard.bindings]] 401 | chars = "\u0018/" 402 | key = "Slash" 403 | mods = "Control|Command" 404 | 405 | [[keyboard.bindings]] 406 | chars = "\u0018," 407 | key = "R" 408 | mods = "Command" 409 | 410 | [[keyboard.bindings]] 411 | chars = "\u0018[" 412 | key = "LBracket" 413 | mods = "Command" 414 | 415 | [[keyboard.bindings]] 416 | chars = "\u0018=" 417 | key = "A" 418 | mods = "Command" 419 | 420 | [[keyboard.bindings]] 421 | chars = "\u0018o" 422 | key = "O" 423 | mods = "Command" 424 | 425 | [[keyboard.bindings]] 426 | chars = "\u0018z" 427 | key = "O" 428 | mods = "Shift|Command" 429 | 430 | [[keyboard.bindings]] 431 | chars = "\u0018z" 432 | key = "Return" 433 | mods = "Command" 434 | 435 | [[keyboard.bindings]] 436 | chars = "\u0018\u0001" 437 | key = "Escape" 438 | mods = "Command" 439 | 440 | [[keyboard.bindings]] 441 | chars = "\u0018\u0010" 442 | key = "Comma" 443 | mods = "Command" 444 | 445 | [[keyboard.bindings]] 446 | chars = "\u0018\u000E" 447 | key = "Semicolon" 448 | mods = "Command" 449 | 450 | [[keyboard.bindings]] 451 | chars = "\u0018\t" 452 | key = "F" 453 | mods = "Shift|Command" 454 | 455 | [[keyboard.bindings]] 456 | chars = "\u0018\t" 457 | key = "E" 458 | mods = "Command" 459 | 460 | [[keyboard.bindings]] 461 | chars = "\u0018n" 462 | key = "N" 463 | mods = "Command" 464 | 465 | [[keyboard.bindings]] 466 | chars = "\u0018p" 467 | key = "P" 468 | mods = "Command" 469 | 470 | [[keyboard.bindings]] 471 | chars = "\u0018/" 472 | key = "Slash" 473 | mods = "Command" 474 | 475 | [[keyboard.bindings]] 476 | chars = "\u001Bf" 477 | key = "F" 478 | mods = "Command" 479 | 480 | [[keyboard.bindings]] 481 | chars = "\u0018!" 482 | key = "I" 483 | mods = "Command" 484 | 485 | [[keyboard.bindings]] 486 | chars = "\u0018$" 487 | key = "I" 488 | mods = "Shift|Command" 489 | 490 | [[keyboard.bindings]] 491 | action = "Paste" 492 | key = "V" 493 | mods = "Alt" 494 | 495 | [[keyboard.bindings]] 496 | chars = "\u001Bd" 497 | key = "D" 498 | mods = "Alt" 499 | 500 | [[keyboard.bindings]] 501 | chars = "\u001Bb" 502 | key = "B" 503 | mods = "Alt" 504 | 505 | [[keyboard.bindings]] 506 | chars = "\u0018m" 507 | key = "J" 508 | mods = "Alt" 509 | 510 | [[keyboard.bindings]] 511 | chars = "\u0018b" 512 | key = "K" 513 | mods = "Alt" 514 | 515 | [[keyboard.bindings]] 516 | action = "Copy" 517 | key = "C" 518 | mods = "Alt" 519 | 520 | [[keyboard.bindings]] 521 | action = "Quit" 522 | key = "Q" 523 | mods = "Alt" 524 | 525 | [[keyboard.bindings]] 526 | action = "Quit" 527 | key = "W" 528 | mods = "Alt" 529 | 530 | [[keyboard.bindings]] 531 | action = "ResetFontSize" 532 | key = "Key0" 533 | mods = "Alt" 534 | 535 | [[keyboard.bindings]] 536 | action = "IncreaseFontSize" 537 | key = "Equals" 538 | mods = "Alt" 539 | 540 | [[keyboard.bindings]] 541 | action = "DecreaseFontSize" 542 | key = "Minus" 543 | mods = "Alt" 544 | 545 | [[keyboard.bindings]] 546 | chars = "\u0015" 547 | key = "Back" 548 | mods = "Alt" 549 | 550 | [[keyboard.bindings]] 551 | chars = "\u0018d" 552 | key = "D" 553 | mods = "Shift|Alt" 554 | 555 | [[keyboard.bindings]] 556 | chars = "\u0018v" 557 | key = "V" 558 | mods = "Shift|Alt" 559 | 560 | [[keyboard.bindings]] 561 | chars = "\u0018s" 562 | key = "A" 563 | mods = "Shift|Alt" 564 | 565 | [[keyboard.bindings]] 566 | chars = "\u0018V" 567 | key = "S" 568 | mods = "Shift|Alt" 569 | 570 | [[keyboard.bindings]] 571 | chars = "\u0018\b" 572 | key = "H" 573 | mods = "Shift|Alt" 574 | 575 | [[keyboard.bindings]] 576 | chars = """ 577 | \u0018 578 | """ 579 | key = "J" 580 | mods = "Shift|Alt" 581 | 582 | [[keyboard.bindings]] 583 | chars = "\u0018\u000B" 584 | key = "K" 585 | mods = "Shift|Alt" 586 | 587 | [[keyboard.bindings]] 588 | chars = "\u0018\f" 589 | key = "L" 590 | mods = "Shift|Alt" 591 | 592 | [[keyboard.bindings]] 593 | chars = "\u00181" 594 | key = "Key1" 595 | mods = "Alt" 596 | 597 | [[keyboard.bindings]] 598 | chars = "\u00182" 599 | key = "Key2" 600 | mods = "Alt" 601 | 602 | [[keyboard.bindings]] 603 | chars = "\u00183" 604 | key = "Key3" 605 | mods = "Alt" 606 | 607 | [[keyboard.bindings]] 608 | chars = "\u00184" 609 | key = "Key4" 610 | mods = "Alt" 611 | 612 | [[keyboard.bindings]] 613 | chars = "\u00185" 614 | key = "Key5" 615 | mods = "Alt" 616 | 617 | [[keyboard.bindings]] 618 | chars = "\u00186" 619 | key = "Key6" 620 | mods = "Alt" 621 | 622 | [[keyboard.bindings]] 623 | chars = "\u00187" 624 | key = "Key7" 625 | mods = "Alt" 626 | 627 | [[keyboard.bindings]] 628 | chars = "\u00188" 629 | key = "Key8" 630 | mods = "Alt" 631 | 632 | [[keyboard.bindings]] 633 | chars = "\u00189" 634 | key = "Key9" 635 | mods = "Alt" 636 | 637 | [[keyboard.bindings]] 638 | chars = "\u0018c" 639 | key = "T" 640 | mods = "Alt" 641 | 642 | [[keyboard.bindings]] 643 | chars = "\u0018x" 644 | key = "X" 645 | mods = "Alt" 646 | 647 | [[keyboard.bindings]] 648 | chars = "\u0018w" 649 | key = "S" 650 | mods = "Alt" 651 | 652 | [[keyboard.bindings]] 653 | chars = "\u0018/" 654 | key = "Slash" 655 | mods = "Control|Alt" 656 | 657 | [[keyboard.bindings]] 658 | chars = "\u0018," 659 | key = "R" 660 | mods = "Alt" 661 | 662 | [[keyboard.bindings]] 663 | chars = "\u0018[" 664 | key = "LBracket" 665 | mods = "Alt" 666 | 667 | [[keyboard.bindings]] 668 | chars = "\u0018=" 669 | key = "A" 670 | mods = "Alt" 671 | 672 | [[keyboard.bindings]] 673 | chars = "\u0018o" 674 | key = "O" 675 | mods = "Alt" 676 | 677 | [[keyboard.bindings]] 678 | chars = "\u0018z" 679 | key = "O" 680 | mods = "Shift|Alt" 681 | 682 | [[keyboard.bindings]] 683 | chars = "\u0018z" 684 | key = "Return" 685 | mods = "Alt" 686 | 687 | [[keyboard.bindings]] 688 | chars = "\u0018\u0001" 689 | key = "Escape" 690 | mods = "Alt" 691 | 692 | [[keyboard.bindings]] 693 | chars = "\u0018<" 694 | key = "Comma" 695 | mods = "Shift|Command" 696 | 697 | [[keyboard.bindings]] 698 | chars = "\u0018>" 699 | key = "Period" 700 | mods = "Shift|Command" 701 | 702 | [[keyboard.bindings]] 703 | chars = "\u0018\u0010" 704 | key = "Comma" 705 | mods = "Alt" 706 | 707 | [[keyboard.bindings]] 708 | chars = "\u0018\u000E" 709 | key = "Semicolon" 710 | mods = "Alt" 711 | 712 | [[keyboard.bindings]] 713 | chars = "\u0018\t" 714 | key = "F" 715 | mods = "Shift|Alt" 716 | 717 | [[keyboard.bindings]] 718 | chars = "\u0018\t" 719 | key = "E" 720 | mods = "Alt" 721 | 722 | [[keyboard.bindings]] 723 | chars = "\u0018n" 724 | key = "N" 725 | mods = "Alt" 726 | 727 | [[keyboard.bindings]] 728 | chars = "\u0018p" 729 | key = "P" 730 | mods = "Alt" 731 | 732 | [[keyboard.bindings]] 733 | chars = "\u0018/" 734 | key = "Slash" 735 | mods = "Alt" 736 | 737 | [[keyboard.bindings]] 738 | chars = "\u001Bf" 739 | key = "F" 740 | mods = "Alt" 741 | 742 | [[keyboard.bindings]] 743 | chars = "\u0018!" 744 | key = "I" 745 | mods = "Alt" 746 | 747 | [[keyboard.bindings]] 748 | chars = "\u0018$" 749 | key = "I" 750 | mods = "Shift|Alt" 751 | 752 | --------------------------------------------------------------------------------