diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b3dfee7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 diff --git a/nvim/.config/nvim/after/plugin/cloal.lua b/nvim/.config/nvim/after/plugin/cloal.lua deleted file mode 100644 index 995192e..0000000 --- a/nvim/.config/nvim/after/plugin/cloal.lua +++ /dev/null @@ -1,27 +0,0 @@ -require('cloak').setup({ - enabled = true, - cloak_character = '*', - -- The applied highlight group (colors) on the cloaking, see `:h highlight`. - highlight_group = 'Comment', - -- Applies the length of the replacement characters for all matched - -- patterns, defaults to the length of the matched pattern. - cloak_length = nil, -- Provide a number if you want to hide the true length of the value. - -- Whether it should try every pattern to find the best fit or stop after the first. - try_all_patterns = true, - patterns = { - { - -- Match any file starting with '.env'. - -- This can be a table to match multiple file patterns. - file_pattern = '.env*', - -- Match an equals sign and any character after it. - -- This can also be a table of patterns to cloak, - -- example: cloak_pattern = { ':.+', '-.+' } for yaml files. - cloak_pattern = '=.+', - -- A function, table or string to generate the replacement. - -- The actual replacement will contain the 'cloak_character' - -- where it doesn't cover the original text. - -- If left empty the legacy behavior of keeping the first character is retained. - replace = nil, - }, - }, -}) diff --git a/nvim/.config/nvim/after/plugin/colors.lua b/nvim/.config/nvim/after/plugin/colors.lua deleted file mode 100644 index 3e9e9cf..0000000 --- a/nvim/.config/nvim/after/plugin/colors.lua +++ /dev/null @@ -1,6 +0,0 @@ -function ColorMyPencils(color) - color = color or 'flexoki-light' - vim.cmd.colorscheme(color) -end - -ColorMyPencils() diff --git a/nvim/.config/nvim/after/plugin/lsp.lua b/nvim/.config/nvim/after/plugin/lsp.lua deleted file mode 100644 index b7ea60d..0000000 --- a/nvim/.config/nvim/after/plugin/lsp.lua +++ /dev/null @@ -1,49 +0,0 @@ -local lsp = require('lsp-zero') -local mason = require('mason') -local mason_lspconfig = require('mason-lspconfig') - -mason.setup({}) -mason_lspconfig.setup({ - ensure_installed = { - 'ruby_ls', - 'rubocop', - 'tsserver', - 'lua_ls', - }, - handlers = { - lsp.default_setup, - lua_ls = function() - require('lspconfig').lua_ls.setup({ - settings = { - Lua = { - diagnostics = { - globals = { - 'vim', - 'require', - } - } - } - } - }) - end, - }, -}) - -lsp.on_attach(function(_client, bufnr) - local opts = { buffer = bufnr, remap = false } - - lsp.default_keymaps(opts) - - vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end, opts) - vim.keymap.set('n', 'K', function() vim.lsp.buf.hover() end, opts) - vim.keymap.set('n', 'vws', function() vim.lsp.buf.workspace_symbol() end, opts) - vim.keymap.set('n', 'vd', function() vim.diagnostic.open_float() end, opts) - vim.keymap.set('n', '[d', function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts) - vim.keymap.set('n', 'vca', function() vim.lsp.buf.code_action() end, opts) - vim.keymap.set('n', 'vrr', function() vim.lsp.buf.references() end, opts) - vim.keymap.set('n', 'vrn', function() vim.lsp.buf.rename() end, opts) - vim.keymap.set('n', 'vrh', function() vim.lsp.buf.signature_help() end, opts) -end) - -lsp.setup() diff --git a/nvim/.config/nvim/after/plugin/ruby.lua b/nvim/.config/nvim/after/plugin/ruby.lua deleted file mode 100644 index b9e3ed9..0000000 --- a/nvim/.config/nvim/after/plugin/ruby.lua +++ /dev/null @@ -1,20 +0,0 @@ -require('rspec').setup({ - allowed_file_format = function(filename) - return vim.endswith(filename, '_spec.rb') - end, - - formatter = 'progress', - focus_on_last_spec_result_window = true, - open_quickfix_when_spec_failed = true, - last_result_path = vim.fn.stdpath('data') .. '/rspec_last_result', - last_failed_result_path = vim.fn.stdpath('data') .. '/rspec_last_failed_result', - jump_command = 'edit', - ignored_dirs_on_jump = {}, -}) - -local opts = { noremap = true, silent = true } -vim.keymap.set("n", "rn", ":RSpecNearest", opts) -vim.keymap.set("n", "rcf", ":RSpecCurrentFile", opts) -vim.keymap.set("n", "rr", ":RSpecRerun", opts) -vim.keymap.set("n", "rof", ":RSpecOnlyFailures", opts) -vim.keymap.set("n", "rslr", ":RSpecShowLastResult", opts) diff --git a/nvim/.config/nvim/after/plugin/surround.lua b/nvim/.config/nvim/after/plugin/surround.lua deleted file mode 100644 index 2f76c6a..0000000 --- a/nvim/.config/nvim/after/plugin/surround.lua +++ /dev/null @@ -1 +0,0 @@ -require('nvim-surround').setup({}) diff --git a/nvim/.config/nvim/after/plugin/telescope.lua b/nvim/.config/nvim/after/plugin/telescope.lua deleted file mode 100644 index 1925519..0000000 --- a/nvim/.config/nvim/after/plugin/telescope.lua +++ /dev/null @@ -1,53 +0,0 @@ -local telescope = require('telescope') -local builtin = require('telescope.builtin') - --- Borrowed from https://stackoverflow.com/a/76991432/513872 -telescope.setup{ - defaults = { - -- configure to use ripgrep - vimgrep_arguments = { - "rg", - "--follow", -- Follow symbolic links - "--hidden", -- Search for hidden files - "--no-heading", -- Don't group matches by each file - "--with-filename", -- Print the file path with the matched lines - "--line-number", -- Show line numbers - "--column", -- Show column numbers - "--smart-case", -- Smart case search - - -- Exclude some patterns from search - "--glob=!**/.git/*", - "--glob=!**/.idea/*", - "--glob=!**/.vscode/*", - "--glob=!**/build/*", - "--glob=!**/dist/*", - "--glob=!**/yarn.lock", - "--glob=!**/package-lock.json", - }, - }, - pickers = { - find_files = { - hidden = true, - -- needed to exclude some files & dirs from general search - -- when not included or specified in .gitignore - find_command = { - "rg", - "--files", - "--hidden", - "--glob=!**/.git/*", - "--glob=!**/.idea/*", - "--glob=!**/.vscode/*", - "--glob=!**/build/*", - "--glob=!**/dist/*", - "--glob=!**/yarn.lock", - "--glob=!**/package-lock.json", - }, - }, - }, -} - -vim.keymap.set('n', 'pf', builtin.find_files, {}) -vim.keymap.set('n', '', builtin.git_files, {}) -vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }); -end) diff --git a/nvim/.config/nvim/after/plugin/treesitter.lua b/nvim/.config/nvim/after/plugin/treesitter.lua deleted file mode 100644 index 583ecdc..0000000 --- a/nvim/.config/nvim/after/plugin/treesitter.lua +++ /dev/null @@ -1,21 +0,0 @@ -require'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" (the five listed parsers should always be installed) - ensure_installed = { "lua", "ruby", "javascript", "typescript" }, - - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, - - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, - - highlight = { - enable = true, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, -} diff --git a/nvim/.config/nvim/after/plugin/undotree.lua b/nvim/.config/nvim/after/plugin/undotree.lua deleted file mode 100644 index b6b9276..0000000 --- a/nvim/.config/nvim/after/plugin/undotree.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..fb25513 --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,18 @@ +{ + "auto-dark-mode.nvim": { "branch": "master", "commit": "e328dc463d238cb7d690fb4daf068eba732a5a14" }, + "cloak.nvim": { "branch": "main", "commit": "9abe4e986e924fc54a972c1b0ff52b65a0622624" }, + "flexoki": { "branch": "main", "commit": "975654bce67514114db89373539621cff42befb5" }, + "flexoki-neovim": { "branch": "main", "commit": "975654bce67514114db89373539621cff42befb5" }, + "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, + "git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" }, + "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, + "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, + "nvim-lspconfig": { "branch": "master", "commit": "16295b79410f131c4fa7870c663b4ace6a761fb2" }, + "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" }, + "nvim-treesitter": { "branch": "master", "commit": "7ff51f53b0efb6228df2e8539b51bb2e737b77f3" }, + "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" }, + "rspec.nvim": { "branch": "main", "commit": "304682100b152071c2186994690c9646a5d46e05" }, + "telescope.nvim": { "branch": "master", "commit": "7472420f8734c710bd7009081cef9b97f08a3821" }, + "undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" } +} \ No newline at end of file diff --git a/nvim/.config/nvim/lua/yock/init.lua b/nvim/.config/nvim/lua/yock/init.lua index f590372..4162e10 100644 --- a/nvim/.config/nvim/lua/yock/init.lua +++ b/nvim/.config/nvim/lua/yock/init.lua @@ -1,3 +1,3 @@ -require('yock.pckr') -require('yock.remap') +require('yock.lazy') require('yock.set') +require('yock.remap') diff --git a/nvim/.config/nvim/lua/yock/lazy.lua b/nvim/.config/nvim/lua/yock/lazy.lua new file mode 100644 index 0000000..d044407 --- /dev/null +++ b/nvim/.config/nvim/lua/yock/lazy.lua @@ -0,0 +1,18 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +vim.g.mapleader = '\\' +require('lazy').setup({ + spec = 'yock.plugins', + change_detection = { notify = false }, +}) diff --git a/nvim/.config/nvim/lua/yock/pckr.lua b/nvim/.config/nvim/lua/yock/pckr.lua deleted file mode 100644 index e6b9a37..0000000 --- a/nvim/.config/nvim/lua/yock/pckr.lua +++ /dev/null @@ -1,45 +0,0 @@ -local function bootstrap_pckr() - local pckr_path = vim.fn.stdpath('data') .. 'pckr/pckr.nvim' - - if not vim.loop.fs_stat(pckr_path) then - vim.fn.system({ - 'git', - 'clone', - '--filter=blob:none', - 'https://github.com/lewis6991/pckr.nvim', - pckr_path - }) - end - - vim.opt.rtp:prepend(pckr_path) -end - -bootstrap_pckr() - -require('pckr').add{ - { 'nvim-telescope/telescope.nvim', requires = { 'nvim-lua/plenary.nvim' } }, - 'kepano/flexoki-neovim', - { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }, - 'mbbill/undotree', - { - 'VonHeikemen/lsp-zero.nvim', - requires = { - { 'neovim/nvim-lspconfig' }, - { 'williamboman/mason.nvim' }, - { 'williamboman/mason-lspconfig.nvim' }, - { 'hrsh7th/nvim-cmp' }, - { 'hrsh7th/cmp-nvim-lsp' }, - { 'L3MON4D3/LuaSnip' }, - { 'hrsh7th/cmp-path' }, - { 'hrsh7th/cmp-nvim-lua' }, - { 'hrsh7th/cmp-buffer' }, - { 'rafamadriz/friendly-snippets' }, - { 'saadparwaiz1/cmp_luasnip' }, - }, - }, - 'f-person/git-blame.nvim', - 'github/copilot.vim', - 'laytan/cloak.nvim', - 'kylechui/nvim-surround', - 'mogulla3/rspec.nvim', -} diff --git a/nvim/.config/nvim/lua/yock/plugins/cloak.lua b/nvim/.config/nvim/lua/yock/plugins/cloak.lua new file mode 100644 index 0000000..f56076e --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/cloak.lua @@ -0,0 +1,30 @@ +return { + 'laytan/cloak.nvim', + opts = { + enabled = true, + cloak_character = '*', + -- The applied highlight group (colors) on the cloaking, see `:h highlight`. + highlight_group = 'Comment', + -- Applies the length of the replacement characters for all matched + -- patterns, defaults to the length of the matched pattern. + cloak_length = nil, -- Provide a number if you want to hide the true length of the value. + -- Whether it should try every pattern to find the best fit or stop after the first. + try_all_patterns = true, + patterns = { + { + -- Match any file starting with '.env'. + -- This can be a table to match multiple file patterns. + file_pattern = '.env*', + -- Match an equals sign and any character after it. + -- This can also be a table of patterns to cloak, + -- example: cloak_pattern = { ':.+', '-.+' } for yaml files. + cloak_pattern = '=.+', + -- A function, table or string to generate the replacement. + -- The actual replacement will contain the 'cloak_character' + -- where it doesn't cover the original text. + -- If left empty the legacy behavior of keeping the first character is retained. + replace = nil, + }, + }, + } +} diff --git a/nvim/.config/nvim/lua/yock/plugins/colors.lua b/nvim/.config/nvim/lua/yock/plugins/colors.lua new file mode 100644 index 0000000..69979d0 --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/colors.lua @@ -0,0 +1,18 @@ +return { + 'f-person/auto-dark-mode.nvim', + dependencies = { 'kepano/flexoki-neovim' }, + opts = { + update_interval = 1000, + set_dark_mode = function() + vim.api.nvim_set_option('background', 'dark') + vim.cmd('colorscheme flexoki-dark') + end, + set_light_mode = function() + vim.api.nvim_set_option('background', 'light') + vim.cmd('colorscheme flexoki-light') + end, + + }, + lazy = false, + priority = 100, +} diff --git a/nvim/.config/nvim/lua/yock/plugins/init.lua b/nvim/.config/nvim/lua/yock/plugins/init.lua new file mode 100644 index 0000000..c4ba9a9 --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/init.lua @@ -0,0 +1,7 @@ +return { + { 'kepano/flexoki-neovim', name = 'flexoki', lazy = false }, + 'mbbill/undotree', + 'f-person/git-blame.nvim', + 'kylechui/nvim-surround', + 'nvim-lua/plenary.nvim', +} diff --git a/nvim/.config/nvim/lua/yock/plugins/lsp.lua b/nvim/.config/nvim/lua/yock/plugins/lsp.lua new file mode 100644 index 0000000..3e5798f --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/lsp.lua @@ -0,0 +1,55 @@ +return { + 'neovim/nvim-lspconfig', + dependencies = { + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, + { 'rafamadriz/friendly-snippets' }, + }, + config = function() + require('mason').setup({}) + require('mason-lspconfig').setup({ + ensure_installed = { + 'ruby_ls', + 'rubocop', + 'tsserver', + 'lua_ls', + }, + handlers = { + lua_ls = function() + require('lspconfig').lua_ls.setup({ + settings = { + Lua = { + diagnostics = { + globals = { + 'vim', + 'require', + } + } + } + } + }) + end, + }, + }) + + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + local opts = { buffer = bufnr, remap = false } + vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end, opts) + vim.keymap.set('n', 'K', function() vim.lsp.buf.hover() end, opts) + vim.keymap.set('n', 'vws', function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set('n', 'vd', function() vim.diagnostic.open_float() end, opts) + vim.keymap.set('n', '[d', function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set('n', 'vca', function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set('n', 'vrr', function() vim.lsp.buf.references() end, opts) + vim.keymap.set('n', 'vrn', function() vim.lsp.buf.rename() end, opts) + vim.keymap.set('n', 'vrh', function() vim.lsp.buf.signature_help() end, opts) + end, + }) + end +} diff --git a/nvim/.config/nvim/lua/yock/plugins/rspec.lua b/nvim/.config/nvim/lua/yock/plugins/rspec.lua new file mode 100644 index 0000000..d86fee5 --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/rspec.lua @@ -0,0 +1,16 @@ +return { + 'mogulla3/rspec.nvim', + opts = { + allowed_file_format = function(filename) + return vim.endswith(filename, '_spec.rb') + end, + + formatter = 'progress', + focus_on_last_spec_result_window = true, + open_quickfix_when_spec_failed = true, + last_result_path = vim.fn.stdpath('data') .. '/rspec_last_result', + last_failed_result_path = vim.fn.stdpath('data') .. '/rspec_last_failed_result', + jump_command = 'edit', + ignored_dirs_on_jump = {}, + } +} diff --git a/nvim/.config/nvim/lua/yock/plugins/telescope.lua b/nvim/.config/nvim/lua/yock/plugins/telescope.lua new file mode 100644 index 0000000..14d6c1f --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/telescope.lua @@ -0,0 +1,46 @@ +return { + 'nvim-telescope/telescope.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + defaults = { + vimgrep_arguments = { + "rg", + "--follow", -- Follow symbolic links + "--hidden", -- Search for hidden files + "--no-heading", -- Don't group matches by each file + "--with-filename", -- Print the file path with the matched lines + "--line-number", -- Show line numbers + "--column", -- Show column numbers + "--smart-case", -- Smart case search + + -- Exclude some patterns from search + "--glob=!**/.git/*", + "--glob=!**/.idea/*", + "--glob=!**/.vscode/*", + "--glob=!**/build/*", + "--glob=!**/dist/*", + "--glob=!**/yarn.lock", + "--glob=!**/package-lock.json", + }, + }, + pickers = { + find_files = { + hidden = true, + -- needed to exclude some files & dirs from general search + -- when not included or specified in .gitignore + find_command = { + "rg", + "--files", + "--hidden", + "--glob=!**/.git/*", + "--glob=!**/.idea/*", + "--glob=!**/.vscode/*", + "--glob=!**/build/*", + "--glob=!**/dist/*", + "--glob=!**/yarn.lock", + "--glob=!**/package-lock.json", + }, + }, + } + }, +} diff --git a/nvim/.config/nvim/lua/yock/plugins/treesitter.lua b/nvim/.config/nvim/lua/yock/plugins/treesitter.lua new file mode 100644 index 0000000..d2800bc --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/treesitter.lua @@ -0,0 +1,25 @@ +return { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + opts = { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "lua", "ruby", "javascript", "typescript" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + } +} diff --git a/nvim/.config/nvim/lua/yock/remap.lua b/nvim/.config/nvim/lua/yock/remap.lua index 8f63e7f..9df9633 100644 --- a/nvim/.config/nvim/lua/yock/remap.lua +++ b/nvim/.config/nvim/lua/yock/remap.lua @@ -17,3 +17,12 @@ vim.keymap.set('n', '', 'h') vim.keymap.set('n', '', 'j') vim.keymap.set('n', '', 'k') vim.keymap.set('n', '', 'l') + + +vim.keymap.set('n', 'pf', function() require('telescope.builtin').find_files() end) +vim.keymap.set('n', '', require('telescope.builtin').git_files, {}) +vim.keymap.set('n', 'ps', function() + require('telescope.builtin').grep_string({ search = vim.fn.input("Grep > ") }); +end) + +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle)