diff options
Diffstat (limited to 'nvim')
18 files changed, 282 insertions, 0 deletions
diff --git a/nvim/dot-config/nvim/init.lua b/nvim/dot-config/nvim/init.lua new file mode 100644 index 0000000..0115b5d --- /dev/null +++ b/nvim/dot-config/nvim/init.lua @@ -0,0 +1,28 @@ +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", + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +vim.opt.expandtab = true +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.number = true +vim.opt.swapfile = false +vim.opt.spell = true +vim.opt.autoindent = true +vim.opt.smartindent = true + +vim.g.mapleader = " " + +vim.keymap.set("n", "<C-Tab>", "<C-w>w") + +require("lazy").setup("plugins") diff --git a/nvim/dot-config/nvim/lazy-lock.json b/nvim/dot-config/nvim/lazy-lock.json new file mode 100644 index 0000000..51dfdad --- /dev/null +++ b/nvim/dot-config/nvim/lazy-lock.json @@ -0,0 +1,24 @@ +{ + "catppuccin": { "branch": "main", "commit": "4965db2d6155c25db4e8417465fc2703fdf4c2b7" }, + "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "editorconfig-vim": { "branch": "master", "commit": "91bd0b0a2c6a72a110ab9feae335e1224480c233" }, + "lazy.nvim": { "branch": "main", "commit": "7527af40ddd4a93a02911be570b32609b9d4ea53" }, + "lazygit.nvim": { "branch": "main", "commit": "adc37c5a6d7d6e8d0a039f08f3c7837971a1c77a" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "5d172e8315444dbc32867d1c7b04d8e7e68ec4e1" }, + "neogit": { "branch": "master", "commit": "63124cf520ff24d09deb3b850e053908ab0fc66a" }, + "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, + "nvim-lspconfig": { "branch": "master", "commit": "66bc018936c6ff76beb75f89d986af6442db4001" }, + "nvim-treesitter": { "branch": "master", "commit": "cced713b4993ddbfba8f82e9e60fcab7cbee8101" }, + "nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" }, + "oil.nvim": { "branch": "master", "commit": "add50252b5e9147c0a09d36480d418c7e2737472" }, + "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "vim-gitgutter": { "branch": "main", "commit": "7b0b5098e3e57be86bb96cfbf2b8902381eef57c" }, + "vim-glsl": { "branch": "master", "commit": "40dd0b143ef93f3930a8a409f60c1bb85e28b727" }, + "vim-rails": { "branch": "master", "commit": "d3954dfe3946c9330dc91b4fbf79ccacb2c626c0" }, + "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } +} diff --git a/nvim/dot-config/nvim/lua/asciidoc-preview/init.lua b/nvim/dot-config/nvim/lua/asciidoc-preview/init.lua new file mode 100644 index 0000000..9061888 --- /dev/null +++ b/nvim/dot-config/nvim/lua/asciidoc-preview/init.lua @@ -0,0 +1,84 @@ +local api = vim.api +local fn = vim.fn + +local augroup = api.nvim_create_augroup('AsciiDocPreview', { clear = true }) + +local config = { + convert_cmd = 'asciidoctor -o %html %adoc', + preview_cmd = 'xdg-open %html', + refresh_interval = 2000, +} + +local function get_html_path() + return fn.expand('%:p'):gsub('%.adoc$', '.html') +end + +local function convert_to_html() + local adoc_path = fn.expand('%:p') + local html_path = get_html_path() + + local cmd = config.convert_cmd + :gsub('%%adoc', adoc_path) + :gsub('%%html', html_path) + + fn.system(cmd) + + return html_path +end + +local function open_preview() + local html_path = get_html_path() + local cmd = string.format('%s %s', config.preview_cmd, html_path) + + fn.system(cmd) +end + +local refresh_timer = nil + +local function start_auto_refresh() + if refresh_timer then + refresh_timer:stop() + end + + refresh_timer = vim.loop.new_timer() + refresh_timer:start(0, config.refresh_interval, vim.schedule_wrap(function() + if api.nvim_buf_get_option(0, 'modified') then + api.nvim_command('write') + convert_to_html() + end + end)) +end + +local function stop_auto_refresh() + if refresh_timer then + refresh_timer:stop() + refresh_timer = nil + end +end + +api.nvim_create_user_command('AsciiDocPreviewStart', function() + convert_to_html() + open_preview() + start_auto_refresh() +end, {}) + +api.nvim_create_user_command('AsciiDocPreviewStop', function() + stop_auto_refresh() +end, {}) + +api.nvim_create_autocmd('VimLeave', { + group = augroup, + callback = function() + stop_auto_refresh() + end, +}) + +return { + start_preview = function() + convert_to_html() + open_preview() + start_auto_refresh() + end, + stop_preview = stop_auto_refresh, + config = config +} diff --git a/nvim/dot-config/nvim/lua/plugins/catppuccin.lua b/nvim/dot-config/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..504fa2f --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,9 @@ +return { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + config = function() + require("catppuccin").setup() + vim.cmd.colorscheme "catppuccin" + end +} diff --git a/nvim/dot-config/nvim/lua/plugins/copilot.lua b/nvim/dot-config/nvim/lua/plugins/copilot.lua new file mode 100644 index 0000000..1ffa970 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/copilot.lua @@ -0,0 +1,3 @@ +return { + "github/copilot.vim" +} diff --git a/nvim/dot-config/nvim/lua/plugins/editorconfig.lua b/nvim/dot-config/nvim/lua/plugins/editorconfig.lua new file mode 100644 index 0000000..772cea6 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/editorconfig.lua @@ -0,0 +1,3 @@ +return { + "editorconfig/editorconfig-vim" +} diff --git a/nvim/dot-config/nvim/lua/plugins/lazygit.lua b/nvim/dot-config/nvim/lua/plugins/lazygit.lua new file mode 100644 index 0000000..d91ed41 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/lazygit.lua @@ -0,0 +1,17 @@ +return { + "kdheepak/lazygit.nvim", + lazy = true, + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = { + { "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" } + } +} diff --git a/nvim/dot-config/nvim/lua/plugins/lspconfig.lua b/nvim/dot-config/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..474f777 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,35 @@ +return { + { + "williamboman/mason.nvim", + lazy = false, + config = function() + require("mason").setup() + end + }, + { + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup({ + ensure_installed = { "pyright", "ruby_lsp", "html", "lua_ls" } + }) + end + }, + { + "neovim/nvim-lspconfig", + config = function() + local lspconfig = require("lspconfig") + + lspconfig.pyright.setup({}) + lspconfig.ruby_lsp.setup({}) + lspconfig.html.setup({}) + lspconfig.lua_ls.setup({}) + + vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) + vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, {}) + vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, {}) + vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {}) + vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {}) + vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, {}) + end + } +} diff --git a/nvim/dot-config/nvim/lua/plugins/lualine.lua b/nvim/dot-config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..55693b9 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,11 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("lualine").setup({ + options = { + theme = "catppuccin" + } + }) + end +} diff --git a/nvim/dot-config/nvim/lua/plugins/neo-tree.lua b/nvim/dot-config/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..2210d18 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,15 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim" + }, + config = function() + vim.keymap.set("n", "<leader>df", ":Neotree toggle filesystem float<CR>") + vim.keymap.set("n", "<leader>db", ":Neotree toggle buffers float<CR>") + vim.keymap.set("n", "<leader>dg", ":Neotree toggle git_status float<CR>") + end +} + diff --git a/nvim/dot-config/nvim/lua/plugins/neogit.lua b/nvim/dot-config/nvim/lua/plugins/neogit.lua new file mode 100644 index 0000000..1323236 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/neogit.lua @@ -0,0 +1,8 @@ +return { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim" + } +} + diff --git a/nvim/dot-config/nvim/lua/plugins/oil.lua b/nvim/dot-config/nvim/lua/plugins/oil.lua new file mode 100644 index 0000000..ed8045f --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/oil.lua @@ -0,0 +1,8 @@ +return { + "stevearc/oil.nvim", + config = function() + require("oil").setup({ + default_file_explorer = true + }) + end, +} diff --git a/nvim/dot-config/nvim/lua/plugins/telescope.lua b/nvim/dot-config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..d25f8d3 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,10 @@ +return { + "nvim-telescope/telescope.nvim", + tag = "0.1.8", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local builtin = require("telescope.builtin") + vim.keymap.set("n", "<leader>ff", builtin.find_files, {}) + vim.keymap.set("n", "<leader>fg", builtin.live_grep, {}) -- requires ripgrep + end +} diff --git a/nvim/dot-config/nvim/lua/plugins/treesitter.lua b/nvim/dot-config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..e88fb1e --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,12 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local configs = require("nvim-treesitter.configs") + configs.setup({ + ensure_installed = {"lua", "c", "cpp", "python", "ruby", "java", "haskell"}, + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} diff --git a/nvim/dot-config/nvim/lua/plugins/vim-gitgutter.lua b/nvim/dot-config/nvim/lua/plugins/vim-gitgutter.lua new file mode 100644 index 0000000..c484a70 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/vim-gitgutter.lua @@ -0,0 +1,3 @@ +return { + "airblade/vim-gitgutter" +} diff --git a/nvim/dot-config/nvim/lua/plugins/vim-glsl.lua b/nvim/dot-config/nvim/lua/plugins/vim-glsl.lua new file mode 100644 index 0000000..ede8a34 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/vim-glsl.lua @@ -0,0 +1,3 @@ +return { + "tikhomirov/vim-glsl" +} diff --git a/nvim/dot-config/nvim/lua/plugins/vim-rails.lua b/nvim/dot-config/nvim/lua/plugins/vim-rails.lua new file mode 100644 index 0000000..50a7481 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/vim-rails.lua @@ -0,0 +1,3 @@ +return { + "tpope/vim-rails" +} diff --git a/nvim/dot-config/nvim/lua/plugins/zen-mode.lua b/nvim/dot-config/nvim/lua/plugins/zen-mode.lua new file mode 100644 index 0000000..0ab2cbf --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/zen-mode.lua @@ -0,0 +1,6 @@ +return { + "folke/zen-mode.nvim", + config = function() + vim.keymap.set("n", "<leader>zz", ":ZenMode<CR>") + end +} |
