···11-vim.api.nvim_create_user_command("RaiseTmuxPane", function()
22- -- run shell command
33-44- local out = vim.fn.system "tmux list-panes -a -F '#I #{pane_tty}'"
55- local tty = vim.env.TTY
66- if tty == nil then return end
77- local _, _, window_id = string.find(out, "(%d+) " .. tty)
88- if window_id == nil then return end
99- vim.fn.system("tmux select-window -t '" .. window_id .. "'")
1010-end, {})
1111-1212-vim.api.nvim_create_user_command("Nurl", function()
1313- local url = vim.fn.input("Enter a URL: ")
1414- local rev = vim.fn.input("Enter the revision (e.g., v0.2.0 or empty string): ")
1515-1616- local cmd = string.format('nurl %s %s 2>/dev/null', url, rev)
1717-1818- local output = vim.fn.systemlist(cmd)
1919- if vim.v.shell_error == 0 and #output > 0 then
2020- vim.api.nvim_put(output, "l", true, true)
2121- else
2222- print("Error executing command or command returned empty result.")
2323- end
2424-end, {})
2525-2626-return {
2727- -- Configure AstroNvim updates
2828- updater = {
2929- remote = "origin", -- remote to use
3030- channel = "stable", -- "stable" or "nightly"
3131- version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY)
3232- branch = "nightly", -- branch name (NIGHTLY ONLY)
3333- commit = nil, -- commit hash (NIGHTLY ONLY)
3434- pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
3535- skip_prompts = false, -- skip prompts about breaking changes
3636- show_changelog = true, -- show the changelog after performing an update
3737- auto_quit = false, -- automatically quit the current session after a successful update
3838- remotes = { -- easily add new remotes to track
3939- -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url
4040- -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut,
4141- -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork
4242- },
4343- },
4444- -- Set colorscheme to use
4545- colorscheme = "gruvbox",
4646- -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
4747- diagnostics = {
4848- virtual_text = true,
4949- underline = true,
5050- },
5151- lsp = {
5252- config = {
5353- clangd = {
5454- cmd = { "clangd", "--offset-encoding=utf-16" },
5555- },
5656- vale = {
5757- cmd = { "vale", "--lsp" },
5858- filetypes = { "markdown", "text" },
5959- },
6060- },
6161- -- customize lsp formatting options
6262- formatting = {
6363- -- control auto formatting on save
6464- format_on_save = {
6565- enabled = true, -- enable or disable format on save globally
6666- allow_filetypes = { -- enable format on save for specified filetypes only
6767- "go",
6868- },
6969- ignore_filetypes = { -- disable format on save for specified filetypes
7070- -- "python",
7171- },
7272- },
7373- disabled = { -- disable formatting capabilities for the listed language servers
7474- -- disable lua_ls formatting capability if you want to use StyLua to format your lua code
7575- -- "lua_ls",
7676- },
7777- timeout_ms = 1000, -- default format timeout
7878- -- filter = function(client) -- fully override the default formatting function
7979- -- return true
8080- -- end
8181- },
8282- -- enable servers that you already have installed without mason
8383- servers = {
8484- "clangd",
8585- "bashls",
8686- "gopls",
8787- "taplo",
8888- "marksman",
8989- "pyright",
9090- "nil_ls",
9191- "terraformls",
9292- "lua_ls",
9393- "vale",
9494- "rust_analyzer",
9595- "gopls",
9696- "yamlls",
9797- "denols",
9898- },
9999- },
100100- -- Configure require("lazy").setup() options
101101- lazy = {
102102- defaults = { lazy = true },
103103- -- Disable change detection because it caused nvim to constantly need 3-5% CPU, which is bad for battery life
104104- change_detection = { enabled = false, },
105105- performance = {
106106- rtp = {
107107- -- customize default disabled vim plugins
108108- disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" },
109109- },
110110- },
111111- },
112112- -- This function is run last and is a good place to configuring
113113- -- augroups/autocommands and custom filetypes also this just pure lua so
114114- -- anything that doesn't fit in the normal config locations above can go here
115115- polish = function()
116116- -- Set up custom filetypes
117117- -- vim.filetype.add {
118118- -- extension = {
119119- -- foo = "fooscript",
120120- -- },
121121- -- filename = {
122122- -- ["Foofile"] = "fooscript",
123123- -- },
124124- -- pattern = {
125125- -- ["~/%.config/foo/.*"] = "fooscript",
126126- -- },
127127- -- }
128128- end,
129129-}
-60
tools/astronvim/user/mappings.lua
···11-function open_or_create_file(tfilename)
22- -- complete filepath from the file where this is called
33- local parent = vim.fn.expand('%:p:h')
44- local newfilepath = parent .. '/' .. vim.fn.expand(tfilename)
55-66- if vim.fn.filereadable(newfilepath) ~= 1 then
77- -- create parent directory
88- vim.fn.system('mkdir -p ' .. vim.fn.shellescape(parent))
99- vim.fn.system('touch ' .. vim.fn.shellescape(newfilepath))
1010- end
1111- vim.cmd(':e ' .. newfilepath)
1212-end
1313-1414-1515--- Mapping data with "desc" stored directly by vim.keymap.set().
1616---
1717--- Please use this mappings table to set keyboard mapping since this is the
1818--- lower level configuration and more robust one. (which-key will
1919--- automatically pick-up stored data by this setting.)
2020-return {
2121- -- first key is the mode
2222- n = {
2323- -- second key is the lefthand side of the map
2424-2525- -- navigate buffer tabs with `H` and `L`
2626- -- L = {
2727- -- function() require("astronvim.utils.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end,
2828- -- desc = "Next buffer",
2929- -- },
3030- -- H = {
3131- -- function() require("astronvim.utils.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end,
3232- -- desc = "Previous buffer",
3333- -- },
3434- -- mappings seen under group name "Buffer"
3535- ["<leader>bD"] = {
3636- function()
3737- require("astronvim.utils.status").heirline.buffer_picker(function(bufnr) require("astronvim.utils.buffer").close(bufnr) end)
3838- end,
3939- desc = "Pick to close",
4040- },
4141- -- tables with the `name` key will be registered with which-key if it's installed
4242- -- this is useful for naming menus
4343- ["<leader>b"] = { name = "Buffers" },
4444- -- quick save
4545- -- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
4646-4747- -- Don't error if file doesn't exist
4848- ["gf"] = { function() open_or_create_file(vim.fn.expand("<cfile>")) end, desc = "Create file" },
4949- ["<leader>*"] = { function() require("telescope.builtin").grep_string() end, desc = "Find for word under cursor", },
5050- ["<leader><leader>"] = { function() require("telescope.builtin").find_files() end, desc = "Find files" },
5151- },
5252- t = {
5353- -- setting a mapping to false will disable it
5454- -- ["<esc>"] = false,
5555- },
5656- c = {
5757- -- setting a mapping to false will disable it
5858- ["w!!"] = { "w !sudo tee > /dev/null %", desc = "Write as sudo" },
5959- }
6060-}
-38
tools/astronvim/user/options.lua
···11--- set vim options here (vim.<first_key>.<second_key> = value)
22-return {
33- opt = {
44- -- set to true or false etc.
55- relativenumber = true, -- sets vim.opt.relativenumber
66- number = true, -- sets vim.opt.number
77- spell = false, -- sets vim.opt.spell
88- signcolumn = "auto", -- sets vim.opt.signcolumn to auto
99- wrap = false, -- sets vim.opt.wrap
1010- list = true, -- show tabs etc
1111- listchars = {
1212- tab = '⇥ ',
1313- extends = '❯',
1414- precedes = '❮',
1515- nbsp = '␣',
1616- trail = '·',
1717- },
1818- },
1919- g = {
2020- mapleader = " ", -- sets vim.g.mapleader
2121- autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
2222- cmp_enabled = true, -- enable completion at start
2323- autopairs_enabled = true, -- enable autopairs at start
2424- diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on)
2525- icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing)
2626- ui_notifications_enabled = true, -- disable notifications when toggling UI elements
2727- resession_enabled = false, -- enable experimental resession.nvim session management (will be default in AstroNvim v4)
2828- },
2929-}
3030--- If you need more control, you can use the function()...end notation
3131--- return function(local_vim)
3232--- local_vim.opt.relativenumber = true
3333--- local_vim.g.mapleader = " "
3434--- local_vim.opt.whichwrap = vim.opt.whichwrap - { 'b', 's' } -- removing option from list
3535--- local_vim.opt.shortmess = vim.opt.shortmess + { I = true } -- add to option list
3636---
3737--- return local_vim
3838--- end
-36
tools/astronvim/user/.github/README.md
···11-# AstroNvim User Configuration Example
22-33-A user configuration template for [AstroNvim](https://github.com/AstroNvim/AstroNvim)
44-55-## 🛠️ Installation
66-77-#### Make a backup of your current nvim and shared folder
88-99-```shell
1010-mv ~/.config/nvim ~/.config/nvim.bak
1111-mv ~/.local/share/nvim ~/.local/share/nvim.bak
1212-```
1313-1414-#### Clone AstroNvim
1515-1616-```shell
1717-git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
1818-```
1919-2020-#### Create a new user repository from this template
2121-2222-Press the "Use this template" button above to create a new repository to store your user configuration.
2323-2424-You can also just clone this repository directly if you do not want to track your user configuration in GitHub.
2525-2626-#### Clone the repository
2727-2828-```shell
2929-git clone https://github.com/<your_user>/<your_repository> ~/.config/nvim/lua/user
3030-```
3131-3232-#### Start Neovim
3333-3434-```shell
3535-nvim
3636-```
-3
tools/astronvim/user/highlights/init.lua
···11-return { -- this table overrides highlights in all themes
22- -- Normal = { bg = "#000000" },
33-}
-29
tools/astronvim/user/plugins/community.lua
···11-return {
22- -- Add the community repository of plugin specifications
33- "AstroNvim/astrocommunity",
44- -- example of imporing a plugin, comment out to use it or add your own
55- -- available plugins can be found at https://github.com/AstroNvim/astrocommunity
66- { import = "astrocommunity.colorscheme.gruvbox-nvim" },
77- { import = "astrocommunity.completion.copilot-lua" },
88- { import = "astrocommunity.completion.copilot-lua-cmp" },
99- { import = "astrocommunity.project.project-nvim" },
1010- { import = "astrocommunity.pack.go" },
1111- { import = "astrocommunity.pack.bash" },
1212- { import = "astrocommunity.pack.python" },
1313- { import = "astrocommunity.pack.lua" },
1414- { import = "astrocommunity.pack.toml" },
1515- { import = "astrocommunity.pack.markdown" },
1616- { import = "astrocommunity.pack.rust" },
1717- { import = "astrocommunity.pack.yaml" },
1818- { import = "astrocommunity.pack.nix" },
1919- { import = "astrocommunity.terminal-integration.vim-tpipeline" },
2020- { import = "astrocommunity.editing-support.rainbow-delimiters-nvim" },
2121- { import = "astrocommunity.editing-support.auto-save-nvim" },
2222- { import = "astrocommunity.editing-support.chatgpt-nvim" },
2323- {
2424- "jackMort/ChatGPT.nvim",
2525- opts = {
2626- api_key_cmd = "pass show www/openai.com/api_key",
2727- },
2828- },
2929-}
-95
tools/astronvim/user/plugins/core.lua
···11-return {
22- -- customize alpha options
33- {
44- "goolord/alpha-nvim",
55- opts = function(_, opts)
66- -- customize the dashboard header
77- opts.section.header.val = {
88- " █████ ███████ ████████ ██████ ██████",
99- "██ ██ ██ ██ ██ ██ ██ ██",
1010- "███████ ███████ ██ ██████ ██ ██",
1111- "██ ██ ██ ██ ██ ██ ██ ██",
1212- "██ ██ ███████ ██ ██ ██ ██████",
1313- " ",
1414- " ███ ██ ██ ██ ██ ███ ███",
1515- " ████ ██ ██ ██ ██ ████ ████",
1616- " ██ ██ ██ ██ ██ ██ ██ ████ ██",
1717- " ██ ██ ██ ██ ██ ██ ██ ██ ██",
1818- " ██ ████ ████ ██ ██ ██",
1919- }
2020- return opts
2121- end,
2222- },
2323- {
2424- "gitsigns.nvim",
2525- opts = function(_, opts)
2626- opts.current_line_blame = true
2727- return opts
2828- end,
2929- },
3030- {
3131- "nvim-neo-tree/neo-tree.nvim",
3232- opts = {
3333- follow_current_file = true,
3434- },
3535- },
3636- -- override make command build since we provide the shared library with home-manager already
3737- { "nvim-telescope/telescope-fzf-native.nvim", build = "true", },
3838- -- disable building since it's optional
3939- { "L3MON4D3/LuaSnip", build = "true", },
4040-4141- -- You can disable default plugins as follows:
4242- -- { "max397574/better-escape.nvim", enabled = false },
4343- --
4444- -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call
4545- -- {
4646- -- "L3MON4D3/LuaSnip",
4747- -- config = function(plugin, opts)
4848- -- require "plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call
4949- -- -- add more custom luasnip configuration such as filetype extend or custom snippets
5050- -- local luasnip = require "luasnip"
5151- -- luasnip.filetype_extend("javascript", { "javascriptreact" })
5252- -- end,
5353- -- },
5454- -- {
5555- -- "windwp/nvim-autopairs",
5656- -- config = function(plugin, opts)
5757- -- require "plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call
5858- -- -- add more custom autopairs configuration such as custom rules
5959- -- local npairs = require "nvim-autopairs"
6060- -- local Rule = require "nvim-autopairs.rule"
6161- -- local cond = require "nvim-autopairs.conds"
6262- -- npairs.add_rules(
6363- -- {
6464- -- Rule("$", "$", { "tex", "latex" })
6565- -- -- don't add a pair if the next character is %
6666- -- :with_pair(cond.not_after_regex "%%")
6767- -- -- don't add a pair if the previous character is xxx
6868- -- :with_pair(
6969- -- cond.not_before_regex("xxx", 3)
7070- -- )
7171- -- -- don't move right when repeat character
7272- -- :with_move(cond.none())
7373- -- -- don't delete if the next character is xx
7474- -- :with_del(cond.not_after_regex "xx")
7575- -- -- disable adding a newline when you press <cr>
7676- -- :with_cr(cond.none()),
7777- -- },
7878- -- -- disable for .vim files, but it work for another filetypes
7979- -- Rule("a", "a", "-vim")
8080- -- )
8181- -- end,
8282- -- },
8383- -- By adding to the which-key config and using our helper function you can add more which-key registered bindings
8484- -- {
8585- -- "folke/which-key.nvim",
8686- -- config = function(plugin, opts)
8787- -- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call
8888- -- -- Add bindings which show up as group name
8989- -- local wk = require "which-key"
9090- -- wk.register({
9191- -- b = { name = "Buffer" },
9292- -- }, { mode = "n", prefix = "<leader>" })
9393- -- end,
9494- -- },
9595-}