formatting/linting added for lua/ts

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-05-02 12:33:00 -05:00
parent e54f6ee975
commit 61d3aec608
18 changed files with 338 additions and 710 deletions

View file

@ -1,17 +1,20 @@
# NVIM config # NVIM config
Goals: Goals:
- Works with or without nix - Works with or without nix
- LSP integration with the current project's settings if available - LSP integration with the current project's settings if available
## Running ## Running
### With Nix ### With Nix
```sh ```sh
nix run "." nix run "."
``` ```
### Without Nix ### Without Nix
- Must have all required programs installed and available on path - Must have all required programs installed and available on path
- neovim >= 0.5 - neovim >= 0.5
- Evertying listed in flake.nix `runtime dependencies` variable near the top of the file - Evertying listed in flake.nix `runtime dependencies` variable near the top of the file
@ -72,3 +75,4 @@ FUTURE
- check out - check out
- https://github.com/onsails/lspkind.nvim - https://github.com/onsails/lspkind.nvim
- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-align.md - https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-align.md
- https://github.com/tpope/vim-abolish

View file

@ -1 +0,0 @@
[{"buf": 1, "col": 0, "row": 0, "bufname": "/home/josh/projects/nvim/README.md", "win": 1000, "width": 68, "height": 48}, {"buf": 10, "col": 69, "row": 0, "bufname": "/home/josh/projects/nvim/lua/util.lua", "win": 1001, "width": 68, "height": 12}, {"buf": 19, "col": 69, "row": 13, "bufname": "/home/josh/projects/nvim/init.lua", "win": 1002, "width": 68, "height": 35}]

495
flake.lock generated
View file

@ -33,102 +33,6 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nvim_plugin-Almo7aya/openingh.nvim": {
"flake": false,
"locked": {
"lastModified": 1710100117,
"narHash": "sha256-xGQdEO8Fjh4Tmv5WnYJFqaitH0wZnLlbYstwqsO0Oeg=",
"owner": "Almo7aya",
"repo": "openingh.nvim",
"rev": "613c18967d42202f3e2a9ac788caf62a402e7c1a",
"type": "github"
},
"original": {
"owner": "Almo7aya",
"repo": "openingh.nvim",
"type": "github"
}
},
"nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": {
"flake": false,
"locked": {
"lastModified": 1713335068,
"narHash": "sha256-MnlhT17hR+tewbtLjaecxXxV1/ywzoqCL5MNtZsVYYk=",
"owner": "JoosepAlviste",
"repo": "nvim-ts-context-commentstring",
"rev": "a6382f744f584bbf71d0a563af789af7190aabda",
"type": "github"
},
"original": {
"owner": "JoosepAlviste",
"repo": "nvim-ts-context-commentstring",
"type": "github"
}
},
"nvim_plugin-MunifTanjim/nui.nvim": {
"flake": false,
"locked": {
"lastModified": 1710740032,
"narHash": "sha256-Zr5CNx6BIM6naCXW8YBc/Oj1qOtWV/3tuMoaaZjoSZA=",
"owner": "MunifTanjim",
"repo": "nui.nvim",
"rev": "cbd2668414331c10039278f558630ed19b93e69b",
"type": "github"
},
"original": {
"owner": "MunifTanjim",
"repo": "nui.nvim",
"type": "github"
}
},
"nvim_plugin-Pocco81/auto-save.nvim": {
"flake": false,
"locked": {
"lastModified": 1667329943,
"narHash": "sha256-bWGil73YiCKZEaY7IuUOIU4Q7k7qCMjSeQ4I+cAVe44=",
"owner": "Pocco81",
"repo": "auto-save.nvim",
"rev": "979b6c82f60cfa80f4cf437d77446d0ded0addf0",
"type": "github"
},
"original": {
"owner": "Pocco81",
"repo": "auto-save.nvim",
"type": "github"
}
},
"nvim_plugin-RRethy/vim-illuminate": {
"flake": false,
"locked": {
"lastModified": 1713467568,
"narHash": "sha256-o0D1edrsHkaljrzBFZXjdxiK/5ziCGJxM/kYNJgBI1E=",
"owner": "RRethy",
"repo": "vim-illuminate",
"rev": "e522e0dd742a83506db0a72e1ced68c9c130f185",
"type": "github"
},
"original": {
"owner": "RRethy",
"repo": "vim-illuminate",
"type": "github"
}
},
"nvim_plugin-catppuccin/nvim": {
"flake": false,
"locked": {
"lastModified": 1711706907,
"narHash": "sha256-GQjxE8lQj52pheJtHCS+9v2lsJY7wMj2IXVCoNRmQSQ=",
"owner": "catppuccin",
"repo": "nvim",
"rev": "aebe43db9cb26e1c70fc5b2fd4158169c405e720",
"type": "github"
},
"original": {
"owner": "catppuccin",
"repo": "nvim",
"type": "github"
}
},
"nvim_plugin-chrisgrieser/nvim-early-retirement": { "nvim_plugin-chrisgrieser/nvim-early-retirement": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -161,409 +65,12 @@
"type": "github" "type": "github"
} }
}, },
"nvim_plugin-folke/lazy.nvim": {
"flake": false,
"locked": {
"lastModified": 1711740527,
"narHash": "sha256-MyJfQS80so7COsN87aGtd6DSrDKUme6SaFGWpaQ1ZHk=",
"owner": "folke",
"repo": "lazy.nvim",
"rev": "31ddbea7c10b6920c9077b66c97951ca8682d5c8",
"type": "github"
},
"original": {
"owner": "folke",
"repo": "lazy.nvim",
"type": "github"
}
},
"nvim_plugin-folke/noice.nvim": {
"flake": false,
"locked": {
"lastModified": 1711471279,
"narHash": "sha256-y6gHNkWVsIuwBf7MblCTKTZSqjGDxqeFeQZWexzwk94=",
"owner": "folke",
"repo": "noice.nvim",
"rev": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12",
"type": "github"
},
"original": {
"owner": "folke",
"repo": "noice.nvim",
"type": "github"
}
},
"nvim_plugin-folke/which-key.nvim": {
"flake": false,
"locked": {
"lastModified": 1697801635,
"narHash": "sha256-uvghPj/teWrRMm09Gh8iQ/LV2nYJw0lmoiZK6L4+1cY=",
"owner": "folke",
"repo": "which-key.nvim",
"rev": "4433e5ec9a507e5097571ed55c02ea9658fb268a",
"type": "github"
},
"original": {
"owner": "folke",
"repo": "which-key.nvim",
"type": "github"
}
},
"nvim_plugin-johmsalas/text-case.nvim": {
"flake": false,
"locked": {
"lastModified": 1708695777,
"narHash": "sha256-ROvmPMB3lMeehFtL7EsHGFkE+ZD9r/ines7yDmB+7Ag=",
"owner": "johmsalas",
"repo": "text-case.nvim",
"rev": "d62c63a4e9a996c7321885937ab89920fca2c1c8",
"type": "github"
},
"original": {
"owner": "johmsalas",
"repo": "text-case.nvim",
"type": "github"
}
},
"nvim_plugin-lewis6991/gitsigns.nvim": {
"flake": false,
"locked": {
"lastModified": 1714557033,
"narHash": "sha256-IpYpya8z6e8t9Lf/ZFx97HsnVwaYLZ44D5rCKvOyybA=",
"owner": "lewis6991",
"repo": "gitsigns.nvim",
"rev": "9cafac31a091267838e1e90fd6e083d37611f516",
"type": "github"
},
"original": {
"owner": "lewis6991",
"repo": "gitsigns.nvim",
"type": "github"
}
},
"nvim_plugin-lnc3l0t/glow.nvim": {
"flake": false,
"locked": {
"lastModified": 1693233815,
"narHash": "sha256-vdlwkIK2EkFviJmSiOqPWvc15xqJ9F2gHCC4ObJ5Qjk=",
"owner": "lnc3l0t",
"repo": "glow.nvim",
"rev": "5b38fb7b6e806cac62707a4aba8c10c5f14d5bb5",
"type": "github"
},
"original": {
"owner": "lnc3l0t",
"repo": "glow.nvim",
"type": "github"
}
},
"nvim_plugin-lukas-reineke/indent-blankline.nvim": {
"flake": false,
"locked": {
"lastModified": 1710388427,
"narHash": "sha256-Xp8ZQBz0in2MX3l0bnLUsSbH0lDPE+QvdmFpBFry5yY=",
"owner": "lukas-reineke",
"repo": "indent-blankline.nvim",
"rev": "3d08501caef2329aba5121b753e903904088f7e6",
"type": "github"
},
"original": {
"owner": "lukas-reineke",
"repo": "indent-blankline.nvim",
"type": "github"
}
},
"nvim_plugin-mbbill/undotree": {
"flake": false,
"locked": {
"lastModified": 1713305700,
"narHash": "sha256-UIroW89ALMRdxSkNGU2VPeuXJxR+25wJ+AakRcjwx/s=",
"owner": "mbbill",
"repo": "undotree",
"rev": "56c684a805fe948936cda0d1b19505b84ad7e065",
"type": "github"
},
"original": {
"owner": "mbbill",
"repo": "undotree",
"type": "github"
}
},
"nvim_plugin-nvim-lua/plenary.nvim": {
"flake": false,
"locked": {
"lastModified": 1714083960,
"narHash": "sha256-vy0MXEoSM4rvYpfwbc2PnilvMOA30Urv0FAxjXuvqQ8=",
"owner": "nvim-lua",
"repo": "plenary.nvim",
"rev": "08e301982b9a057110ede7a735dd1b5285eb341f",
"type": "github"
},
"original": {
"owner": "nvim-lua",
"repo": "plenary.nvim",
"type": "github"
}
},
"nvim_plugin-nvim-lualine/lualine.nvim": {
"flake": false,
"locked": {
"lastModified": 1712310396,
"narHash": "sha256-WcH2dWdRDgMkwBQhcgT+Z/ArMdm+VbRhmQftx4t2kNI=",
"owner": "nvim-lualine",
"repo": "lualine.nvim",
"rev": "0a5a66803c7407767b799067986b4dc3036e1983",
"type": "github"
},
"original": {
"owner": "nvim-lualine",
"repo": "lualine.nvim",
"type": "github"
}
},
"nvim_plugin-nvim-telescope/telescope-fzf-native.nvim": {
"flake": false,
"locked": {
"lastModified": 1709647247,
"narHash": "sha256-rycebls3g0JCHM2+aG7xlJnX7ZPowqviaLbQrFSdflM=",
"owner": "nvim-telescope",
"repo": "telescope-fzf-native.nvim",
"rev": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27",
"type": "github"
},
"original": {
"owner": "nvim-telescope",
"repo": "telescope-fzf-native.nvim",
"type": "github"
}
},
"nvim_plugin-nvim-telescope/telescope-ui-select.nvim": {
"flake": false,
"locked": {
"lastModified": 1701723223,
"narHash": "sha256-YRhNmmG4gx9Ht8JwjQfbTjJyTHEuZmtP6lqnhOsk8bE=",
"owner": "nvim-telescope",
"repo": "telescope-ui-select.nvim",
"rev": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2",
"type": "github"
},
"original": {
"owner": "nvim-telescope",
"repo": "telescope-ui-select.nvim",
"type": "github"
}
},
"nvim_plugin-nvim-telescope/telescope.nvim": {
"flake": false,
"locked": {
"lastModified": 1714530387,
"narHash": "sha256-lQl0UwUfHhPjJHWbNTR10NB+GATJUiD3lRESEdduX7w=",
"owner": "nvim-telescope",
"repo": "telescope.nvim",
"rev": "2d0d057791854decb2c9b6a0b52d43f3900dff40",
"type": "github"
},
"original": {
"owner": "nvim-telescope",
"repo": "telescope.nvim",
"type": "github"
}
},
"nvim_plugin-nvim-tree/nvim-tree.lua": {
"flake": false,
"locked": {
"lastModified": 1714440771,
"narHash": "sha256-yLWb3aKsab3Cqbp3RgP0maiLOQWtxbUdnkLy7sQygx0=",
"owner": "nvim-tree",
"repo": "nvim-tree.lua",
"rev": "347e1eb35264677f66a79466bb5e3d111968e12c",
"type": "github"
},
"original": {
"owner": "nvim-tree",
"repo": "nvim-tree.lua",
"type": "github"
}
},
"nvim_plugin-nvim-tree/nvim-web-devicons": {
"flake": false,
"locked": {
"lastModified": 1714371374,
"narHash": "sha256-gc+8GgFSM87dbcYUW8d9If3qY80xJMmy48vnVezNLPk=",
"owner": "nvim-tree",
"repo": "nvim-web-devicons",
"rev": "794bba734ec95eaff9bb82fbd112473be2087283",
"type": "github"
},
"original": {
"owner": "nvim-tree",
"repo": "nvim-web-devicons",
"type": "github"
}
},
"nvim_plugin-preservim/nerdcommenter": {
"flake": false,
"locked": {
"lastModified": 1702928950,
"narHash": "sha256-zQy5VN2w9Hqo0Is7Yp2fm1WvBV6QNJwhHm0eozh69TI=",
"owner": "preservim",
"repo": "nerdcommenter",
"rev": "e361a44230860d616f799a337bc58f5218ab6e9c",
"type": "github"
},
"original": {
"owner": "preservim",
"repo": "nerdcommenter",
"type": "github"
}
},
"nvim_plugin-rcarriga/nvim-notify": {
"flake": false,
"locked": {
"lastModified": 1708161547,
"narHash": "sha256-xJYPOX4YLcWojMCdP1RO22/7FMrbcBQxqxrcVCE2TrU=",
"owner": "rcarriga",
"repo": "nvim-notify",
"rev": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15",
"type": "github"
},
"original": {
"owner": "rcarriga",
"repo": "nvim-notify",
"type": "github"
}
},
"nvim_plugin-rmagatti/auto-session": {
"flake": false,
"locked": {
"lastModified": 1713075135,
"narHash": "sha256-wu/utBYr4o4BenybAumDxBTERBkRkcR1QzlfmnVbOTQ=",
"owner": "rmagatti",
"repo": "auto-session",
"rev": "9e0a169b6fce8791278abbd110717b921afe634d",
"type": "github"
},
"original": {
"owner": "rmagatti",
"repo": "auto-session",
"type": "github"
}
},
"nvim_plugin-sindrets/diffview.nvim": {
"flake": false,
"locked": {
"lastModified": 1700506468,
"narHash": "sha256-3EdnBUka9Rh5Brl6TWpN6GlD9z32mmY3Ip+wyiKob/8=",
"owner": "sindrets",
"repo": "diffview.nvim",
"rev": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f",
"type": "github"
},
"original": {
"owner": "sindrets",
"repo": "diffview.nvim",
"type": "github"
}
},
"nvim_plugin-tpope/vim-surround": {
"flake": false,
"locked": {
"lastModified": 1666730476,
"narHash": "sha256-DZE5tkmnT+lAvx/RQHaDEgEJXRKsy56KJY919xiH1lE=",
"owner": "tpope",
"repo": "vim-surround",
"rev": "3d188ed2113431cf8dac77be61b842acb64433d9",
"type": "github"
},
"original": {
"owner": "tpope",
"repo": "vim-surround",
"type": "github"
}
},
"nvim_plugin-uga-rosa/ccc.nvim": {
"flake": false,
"locked": {
"lastModified": 1714299582,
"narHash": "sha256-QRq9hQF5vLnOTzQGbOWC2ykMdMsQDlDlb6XC17dJG7Q=",
"owner": "uga-rosa",
"repo": "ccc.nvim",
"rev": "f388f1981d222967c741fe9927edf9ba5fa3bcbe",
"type": "github"
},
"original": {
"owner": "uga-rosa",
"repo": "ccc.nvim",
"type": "github"
}
},
"nvim_plugin-voldikss/vim-floaterm": {
"flake": false,
"locked": {
"lastModified": 1712535773,
"narHash": "sha256-wIgcBcdxJsT+qrsC5Boj6hp0xpp5gFeQFhK7yyC5a1o=",
"owner": "voldikss",
"repo": "vim-floaterm",
"rev": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160",
"type": "github"
},
"original": {
"owner": "voldikss",
"repo": "vim-floaterm",
"type": "github"
}
},
"nvim_plugin-windwp/nvim-ts-autotag": {
"flake": false,
"locked": {
"lastModified": 1707265789,
"narHash": "sha256-cPIEIjcYxX3ZkOyou2mYlHMdhBxCoVTpJVXZtiWe9Ks=",
"owner": "windwp",
"repo": "nvim-ts-autotag",
"rev": "531f48334c422222aebc888fd36e7d109cb354cd",
"type": "github"
},
"original": {
"owner": "windwp",
"repo": "nvim-ts-autotag",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nvim_plugin-Almo7aya/openingh.nvim": "nvim_plugin-Almo7aya/openingh.nvim",
"nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring",
"nvim_plugin-MunifTanjim/nui.nvim": "nvim_plugin-MunifTanjim/nui.nvim",
"nvim_plugin-Pocco81/auto-save.nvim": "nvim_plugin-Pocco81/auto-save.nvim",
"nvim_plugin-RRethy/vim-illuminate": "nvim_plugin-RRethy/vim-illuminate",
"nvim_plugin-catppuccin/nvim": "nvim_plugin-catppuccin/nvim",
"nvim_plugin-chrisgrieser/nvim-early-retirement": "nvim_plugin-chrisgrieser/nvim-early-retirement", "nvim_plugin-chrisgrieser/nvim-early-retirement": "nvim_plugin-chrisgrieser/nvim-early-retirement",
"nvim_plugin-declancm/cinnamon.nvim": "nvim_plugin-declancm/cinnamon.nvim", "nvim_plugin-declancm/cinnamon.nvim": "nvim_plugin-declancm/cinnamon.nvim"
"nvim_plugin-folke/lazy.nvim": "nvim_plugin-folke/lazy.nvim",
"nvim_plugin-folke/noice.nvim": "nvim_plugin-folke/noice.nvim",
"nvim_plugin-folke/which-key.nvim": "nvim_plugin-folke/which-key.nvim",
"nvim_plugin-johmsalas/text-case.nvim": "nvim_plugin-johmsalas/text-case.nvim",
"nvim_plugin-lewis6991/gitsigns.nvim": "nvim_plugin-lewis6991/gitsigns.nvim",
"nvim_plugin-lnc3l0t/glow.nvim": "nvim_plugin-lnc3l0t/glow.nvim",
"nvim_plugin-lukas-reineke/indent-blankline.nvim": "nvim_plugin-lukas-reineke/indent-blankline.nvim",
"nvim_plugin-mbbill/undotree": "nvim_plugin-mbbill/undotree",
"nvim_plugin-nvim-lua/plenary.nvim": "nvim_plugin-nvim-lua/plenary.nvim",
"nvim_plugin-nvim-lualine/lualine.nvim": "nvim_plugin-nvim-lualine/lualine.nvim",
"nvim_plugin-nvim-telescope/telescope-fzf-native.nvim": "nvim_plugin-nvim-telescope/telescope-fzf-native.nvim",
"nvim_plugin-nvim-telescope/telescope-ui-select.nvim": "nvim_plugin-nvim-telescope/telescope-ui-select.nvim",
"nvim_plugin-nvim-telescope/telescope.nvim": "nvim_plugin-nvim-telescope/telescope.nvim",
"nvim_plugin-nvim-tree/nvim-tree.lua": "nvim_plugin-nvim-tree/nvim-tree.lua",
"nvim_plugin-nvim-tree/nvim-web-devicons": "nvim_plugin-nvim-tree/nvim-web-devicons",
"nvim_plugin-preservim/nerdcommenter": "nvim_plugin-preservim/nerdcommenter",
"nvim_plugin-rcarriga/nvim-notify": "nvim_plugin-rcarriga/nvim-notify",
"nvim_plugin-rmagatti/auto-session": "nvim_plugin-rmagatti/auto-session",
"nvim_plugin-sindrets/diffview.nvim": "nvim_plugin-sindrets/diffview.nvim",
"nvim_plugin-tpope/vim-surround": "nvim_plugin-tpope/vim-surround",
"nvim_plugin-uga-rosa/ccc.nvim": "nvim_plugin-uga-rosa/ccc.nvim",
"nvim_plugin-voldikss/vim-floaterm": "nvim_plugin-voldikss/vim-floaterm",
"nvim_plugin-windwp/nvim-ts-autotag": "nvim_plugin-windwp/nvim-ts-autotag"
} }
}, },
"systems": { "systems": {

184
flake.nix
View file

@ -5,132 +5,18 @@
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
# Names should always be `nvim_plugin-[lazy plugin name]` # Names should always be `nvim_plugin-[lazy plugin name]`
"nvim_plugin-folke/lazy.nvim" = { # Only need to add plugins as flake inputs if they are:
url = "github:folke/lazy.nvim"; # - Missing in nixpkgs
flake = false; # - We want to pin a specific version diverging from nixpkgs channel
};
"nvim_plugin-nvim-lua/plenary.nvim" = {
url = "github:nvim-lua/plenary.nvim";
flake = false;
};
"nvim_plugin-catppuccin/nvim" = {
url = "github:catppuccin/nvim";
flake = false;
};
"nvim_plugin-Pocco81/auto-save.nvim" = {
url = "github:Pocco81/auto-save.nvim";
flake = false;
};
"nvim_plugin-chrisgrieser/nvim-early-retirement" = { "nvim_plugin-chrisgrieser/nvim-early-retirement" = {
url = "github:chrisgrieser/nvim-early-retirement"; url = "github:chrisgrieser/nvim-early-retirement";
flake = false; flake = false;
}; };
"nvim_plugin-MunifTanjim/nui.nvim" = {
url = "github:MunifTanjim/nui.nvim";
flake = false;
};
"nvim_plugin-rcarriga/nvim-notify" = {
url = "github:rcarriga/nvim-notify";
flake = false;
};
"nvim_plugin-folke/noice.nvim" = {
url = "github:folke/noice.nvim";
flake = false;
};
"nvim_plugin-declancm/cinnamon.nvim" = { "nvim_plugin-declancm/cinnamon.nvim" = {
url = "github:declancm/cinnamon.nvim"; url = "github:declancm/cinnamon.nvim";
flake = false; flake = false;
}; };
"nvim_plugin-nvim-lualine/lualine.nvim" = {
url = "github:nvim-lualine/lualine.nvim";
flake = false;
};
"nvim_plugin-folke/which-key.nvim" = {
url = "github:folke/which-key.nvim";
flake = false;
};
"nvim_plugin-nvim-telescope/telescope.nvim" = {
url = "github:nvim-telescope/telescope.nvim";
flake = false;
};
"nvim_plugin-nvim-telescope/telescope-fzf-native.nvim" = {
url = "github:nvim-telescope/telescope-fzf-native.nvim";
flake = false;
};
"nvim_plugin-nvim-telescope/telescope-ui-select.nvim" = {
url = "github:nvim-telescope/telescope-ui-select.nvim";
flake = false;
};
"nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring" = {
url = "github:JoosepAlviste/nvim-ts-context-commentstring";
flake = false;
};
"nvim_plugin-preservim/nerdcommenter" = {
url = "github:preservim/nerdcommenter";
flake = false;
};
"nvim_plugin-windwp/nvim-ts-autotag" = {
url = "github:windwp/nvim-ts-autotag";
flake = false;
};
"nvim_plugin-rmagatti/auto-session" = {
url = "github:rmagatti/auto-session";
flake = false;
};
"nvim_plugin-nvim-tree/nvim-web-devicons" = {
url = "github:nvim-tree/nvim-web-devicons";
flake = false;
};
"nvim_plugin-nvim-tree/nvim-tree.lua" = {
url = "github:nvim-tree/nvim-tree.lua";
flake = false;
};
"nvim_plugin-uga-rosa/ccc.nvim" = {
url = "github:uga-rosa/ccc.nvim";
flake = false;
};
"nvim_plugin-voldikss/vim-floaterm" = {
url = "github:voldikss/vim-floaterm";
flake = false;
};
"nvim_plugin-lewis6991/gitsigns.nvim" = {
url = "github:lewis6991/gitsigns.nvim";
flake = false;
};
"nvim_plugin-sindrets/diffview.nvim" = {
url = "github:sindrets/diffview.nvim";
flake = false;
};
"nvim_plugin-RRethy/vim-illuminate" = {
url = "github:RRethy/vim-illuminate";
flake = false;
};
"nvim_plugin-lukas-reineke/indent-blankline.nvim" = {
url = "github:lukas-reineke/indent-blankline.nvim";
flake = false;
};
"nvim_plugin-lnc3l0t/glow.nvim" = {
url = "github:lnc3l0t/glow.nvim";
flake = false;
};
"nvim_plugin-Almo7aya/openingh.nvim" = {
url = "github:Almo7aya/openingh.nvim";
flake = false;
};
"nvim_plugin-tpope/vim-surround" = {
url = "github:tpope/vim-surround";
flake = false;
};
"nvim_plugin-johmsalas/text-case.nvim" = {
url = "github:johmsalas/text-case.nvim";
flake = false;
};
"nvim_plugin-mbbill/undotree" = {
url = "github:mbbill/undotree";
flake = false;
};
}; };
outputs = { self, nixpkgs, flake-utils, ... } @ inputs: outputs = { self, nixpkgs, flake-utils, ... } @ inputs:
@ -140,8 +26,42 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.lib; lib = nixpkgs.lib;
nonFlakePluginPaths = { lazyPath = pkgs.vimPlugins.lazy-nvim; # inputs."nvim_plugin-folke/lazy.nvim"
"nvim_plugin-nvim-treesitter/nvim-treesitter" = pkgs.vimPlugins.nvim-treesitter.withAllGrammars; # Plugins provided in nixpkgs, match the naming scheme above for keys
nixPkgsPlugins = with pkgs.vimPlugins; {
"nvim_plugin-folke/lazy.nvim" = lazyPath;
"nvim_plugin-nvim-treesitter/nvim-treesitter" = nvim-treesitter.withAllGrammars;
"nvim_plugin-nvim-lua/plenary.nvim" = plenary-nvim;
"nvim_plugin-catppuccin/nvim" = catppuccin-nvim;
"nvim_plugin-Pocco81/auto-save.nvim" = auto-save-nvim;
"nvim_plugin-MunifTanjim/nui.nvim" = nui-nvim;
"nvim_plugin-rcarriga/nvim-notify" = nvim-notify;
"nvim_plugin-folke/noice.nvim" = noice-nvim;
"nvim_plugin-nvim-lualine/lualine.nvim" = lualine-nvim;
"nvim_plugin-folke/which-key.nvim" = which-key-nvim;
"nvim_plugin-nvim-telescope/telescope.nvim" = telescope-nvim;
"nvim_plugin-nvim-telescope/telescope-fzf-native.nvim" = telescope-fzf-native-nvim;
"nvim_plugin-nvim-telescope/telescope-ui-select.nvim" = telescope-ui-select-nvim;
"nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring" = nvim-ts-context-commentstring;
"nvim_plugin-preservim/nerdcommenter" = nerdcommenter;
"nvim_plugin-windwp/nvim-ts-autotag" = nvim-ts-autotag;
"nvim_plugin-rmagatti/auto-session" = auto-session;
"nvim_plugin-nvim-tree/nvim-web-devicons" = nvim-web-devicons;
"nvim_plugin-nvim-tree/nvim-tree.lua" = nvim-tree-lua;
"nvim_plugin-uga-rosa/ccc.nvim" = ccc-nvim;
"nvim_plugin-voldikss/vim-floaterm" = vim-floaterm;
"nvim_plugin-lewis6991/gitsigns.nvim" = gitsigns-nvim;
"nvim_plugin-sindrets/diffview.nvim" = diffview-nvim;
"nvim_plugin-RRethy/vim-illuminate" = vim-illuminate;
"nvim_plugin-lukas-reineke/indent-blankline.nvim" = indent-blankline-nvim;
"nvim_plugin-lnc3l0t/glow.nvim" = glow-nvim;
"nvim_plugin-Almo7aya/openingh.nvim" = openingh-nvim;
"nvim_plugin-tpope/vim-surround" = vim-surround;
"nvim_plugin-johmsalas/text-case.nvim" = text-case-nvim;
"nvim_plugin-mbbill/undotree" = undotree;
"nvim_plugin-tpope/vim-sleuth" = vim-sleuth;
"nvim_plugin-mfussenegger/nvim-lint" = nvim-lint;
"nvim_plugin-stevearc/conform.nvim" = conform-nvim;
}; };
# This will be how we put any nix related stuff into our lua config # This will be how we put any nix related stuff into our lua config
luaNixGlobal = "NIX=" + lib.generators.toLua { multiline = false; indent = false; } ({ luaNixGlobal = "NIX=" + lib.generators.toLua { multiline = false; indent = false; } ({
@ -152,20 +72,28 @@
{ {
"${name}" = inputs.${name}.outPath; "${name}" = inputs.${name}.outPath;
} // dirs) } // dirs)
nonFlakePluginPaths nixPkgsPlugins
(builtins.filter (builtins.filter
(n: builtins.substring 0 12 n == "nvim_plugin-") (n: builtins.substring 0 12 n == "nvim_plugin-")
(builtins.attrNames inputs)); (builtins.attrNames inputs));
}); });
runtimeDependencies = with pkgs; [ runtimeDependencies = with pkgs; [
# tools
ripgrep # search ripgrep # search
fd # search fd # search
fzf # search fuzzy fzf # search fuzzy
# curl # http requests
tree-sitter tree-sitter
glow # markdown renderer glow # markdown renderer
# nodePackages.cspell # linters
markdownlint-cli
luajitPackages.luacheck
biome # (t|s)j[x]
# formatters
stylua
nodePackages.prettier
# curl # http requests TODO
# nodePackages.cspell TODO
]; ];
in in
{ {
@ -193,26 +121,24 @@
# Set the LAZY env path to the nix store, see init.lua for how it is used # Set the LAZY env path to the nix store, see init.lua for how it is used
"--set" "--set"
"LAZY" "LAZY"
"${inputs."nvim_plugin-folke/lazy.nvim"}" "${lazyPath}"
# Don't use default directories to not collide with another neovim config # Don't use default directories to not collide with another neovim config
# All things at runtime should be deletable since we are using nix to handle downloads and bins. # All things at runtime should be deletable since we are using nix to handle downloads and bins.
"--set" "--set"
"XDG_CONFIG_HOME" "XDG_CONFIG_HOME"
"/tmp/nvim_flaked/config" "/tmp/nvim_flaked.USR_TODO/config" # TODO
"--set" "--set"
"XDG_DATA_HOME" "XDG_DATA_HOME"
"/tmp/nvim_flaked/share" "/tmp/nvim_flaked.USR_TODO/share"
"--set" "--set"
"XDG_RUNTIME_DIR" "XDG_RUNTIME_DIR"
"/tmp/nvim_flaked/run" "/tmp/nvim_flaked.USR_TODO/run"
"--set" "--set"
"XDG_STATE_HOME" "XDG_STATE_HOME"
"/tmp/nvim_flaked/state" "/tmp/nvim_flaked.USR_TODO/state"
]; ];
}); });
}; };
}); });
} }

129
init.lua
View file

@ -1,11 +1,14 @@
if NIX then if NIX then
-- Add my lua dir to the path. THIS IS NOT RECURSIVE! -- Add my lua dir to the path. THIS IS NOT RECURSIVE!
-- For recursive we can do something like this: https://github.com/RingOfStorms/nvim/blob/0b833d555c69e88b450a10eec4e39a782bad1037/init.lua#L1-L17 -- For recursive we can do something like this: https://github.com/RingOfStorms/nvim/blob/0b833d555c69e88b450a10eec4e39a782bad1037/init.lua#L1-L17
-- However this pollutes the path, it could be limited to just init files but this approach here one level deep is adequate for my own needs -- However this pollutes the path, it could be limited to just init files but this approach here one level deep is adequate for my own needs
package.path = package.path .. ";" .. NIX.storePath .. "/lua/?.lua" package.path = package.path .. ";" .. NIX.storePath .. "/lua/?.lua"
package.path = package.path .. ";" .. NIX.storePath .. "/lua/?/init.lua" package.path = package.path .. ";" .. NIX.storePath .. "/lua/?/init.lua"
end end
-- Compat stolen form LazyVim
vim.uv = vim.uv or vim.loop
U = require("util") -- NOTE global U[til] U = require("util") -- NOTE global U[til]
require("options") require("options")
require("keymaps") require("keymaps")
@ -13,75 +16,75 @@ require("keymaps")
-- When using nix, it will set lazy via LAZY env variable. -- When using nix, it will set lazy via LAZY env variable.
local lazypath = vim.env.LAZY or (vim.fn.stdpath("data") .. "/lazy/lazy.nvim") local lazypath = vim.env.LAZY or (vim.fn.stdpath("data") .. "/lazy/lazy.nvim")
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
if NIX then if NIX then
error("LAZY environment variable to nix store was not found: " .. vim.env.LAZY) error("LAZY environment variable to nix store was not found: " .. vim.env.LAZY)
return return
end end
-- For non nix systems, pull lazy stable to the normal XDG config path -- For non nix systems, pull lazy stable to the normal XDG config path
local output = vim.fn.system({ local output = vim.fn.system({
"git", "git",
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable", -- latest stable release
lazypath, lazypath,
}) })
if vim.api.nvim_get_vvar("shell_error") ~= 0 then if vim.api.nvim_get_vvar("shell_error") ~= 0 then
error("Error cloning lazy.nvim repository...\n\n" .. output) error("Error cloning lazy.nvim repository...\n\n" .. output)
end end
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
-- Setup lazy -- Setup lazy
local function ensure_table(object) local function ensure_table(object)
return type(object) == "table" and object or { object } return type(object) == "table" and object or { object }
end end
local function getSpec() local function getSpec()
if NIX then if NIX then
-- Convert plugins to use nix store, this auto sets the `dir` property for us on all plugins. -- Convert plugins to use nix store, this auto sets the `dir` property for us on all plugins.
function convertPluginToNixStore(plugin) function convertPluginToNixStore(plugin)
local p = ensure_table(plugin) local p = ensure_table(plugin)
local nixName = "nvim_plugin-" .. p[1] local nixName = "nvim_plugin-" .. p[1]
if not NIX.pluginPaths[nixName] then if not NIX.pluginPaths[nixName] then
error("Plugin is missing in the nix store, ensure it is in the nix flake inputs: " .. p[1]) error("Plugin is missing in the nix store, ensure it is in the nix flake inputs: " .. p[1])
end end
p.dir = NIX.pluginPaths[nixName] p.dir = NIX.pluginPaths[nixName]
p.name = p.name or p[1] p.name = p.name or p[1]
p.url = "not_used_in_nix" p.url = "not_used_in_nix"
p.pin = true p.pin = true
if p.dependencies then if p.dependencies then
p.dependencies = ensure_table(p.dependencies) p.dependencies = ensure_table(p.dependencies)
for i, dep in ipairs(p.dependencies) do for i, dep in ipairs(p.dependencies) do
p.dependencies[i] = convertPluginToNixStore(dep) p.dependencies[i] = convertPluginToNixStore(dep)
end end
end end
return p return p
end end
local plugins = {} local plugins = {}
local plugins_path = debug.getinfo(2, "S").source:sub(2):match("(.*/)") .. "lua/plugins" local plugins_path = debug.getinfo(2, "S").source:sub(2):match("(.*/)") .. "lua/plugins"
for _, file in ipairs(vim.fn.readdir(plugins_path, [[v:val =~ '\.lua$']])) do for _, file in ipairs(vim.fn.readdir(plugins_path, [[v:val =~ '\.lua$']])) do
local plugin = string.sub(file, 0, -5) local plugin = string.sub(file, 0, -5)
table.insert(plugins, convertPluginToNixStore(require("plugins." .. plugin))) table.insert(plugins, convertPluginToNixStore(require("plugins." .. plugin)))
end end
return plugins return plugins
else else
-- TODO I want this to work in the nixos versionhttps://github.com/RingOfStorms/nvim/blob/nix-flake/init.lua#L39-L55 -- TODO I want this to work in the nixos versionhttps://github.com/RingOfStorms/nvim/blob/nix-flake/init.lua#L39-L55
-- but it is not resolving properly to the nix store. -- but it is not resolving properly to the nix store.
-- Will revisit at some point, instead we manually pull them -- Will revisit at some point, instead we manually pull them
-- in above with a directory scan. -- in above with a directory scan.
return { { import = "plugins" } } return { { import = "plugins" } }
end end
end end
require("lazy").setup({ require("lazy").setup({
spec = getSpec(), spec = getSpec(),
change_detection = { change_detection = {
enabled = false, enabled = false,
}, },
defaults = { defaults = {
lazy = true, lazy = true,
}, },
}) })
vim.cmd("colorscheme catppuccin") vim.cmd("colorscheme catppuccin")

View file

@ -1,9 +1,10 @@
local group = vim.api.nvim_create_augroup("myconfig-autocommands-group", { clear = true });
-- Highlight when yanking (copying) text -- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode -- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()` -- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd("TextYankPost", { vim.api.nvim_create_autocmd("TextYankPost", {
group = group,
desc = "Highlight when yanking (copying) text", desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("config-highlight-yank", { clear = true }),
callback = function() callback = function()
vim.highlight.on_yank({ timeout = 300 }) vim.highlight.on_yank({ timeout = 300 })
end, end,
@ -11,24 +12,29 @@ vim.api.nvim_create_autocmd("TextYankPost", {
-- TODO is there a better way for these? -- TODO is there a better way for these?
vim.api.nvim_create_autocmd("BufRead", { vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = ".env*", pattern = ".env*",
command = "set filetype=sh", command = "set filetype=sh",
}) })
vim.api.nvim_create_autocmd("BufRead", { vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = ".*rc", pattern = ".*rc",
command = "set filetype=sh", command = "set filetype=sh",
}) })
vim.api.nvim_create_autocmd("BufRead", { vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = "Dockerfile.*", pattern = "Dockerfile.*",
command = "set filetype=dockerfile", command = "set filetype=dockerfile",
}) })
vim.api.nvim_create_autocmd("BufRead", { vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = "*.http", pattern = "*.http",
command = "set filetype=http", command = "set filetype=http",
}) })
-- Auto exit insert mode whenever we switch screens -- Auto exit insert mode whenever we switch screens
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
group = group,
callback = function() callback = function()
if vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then if vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then
vim.api.nvim_command("stopinsert") vim.api.nvim_command("stopinsert")
@ -37,12 +43,14 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
}) })
vim.api.nvim_create_autocmd("VimLeavePre", { vim.api.nvim_create_autocmd("VimLeavePre", {
group = group,
callback = function() callback = function()
vim.cmd("NvimTreeClose") vim.cmd("NvimTreeClose")
-- Close all buffers with the 'httpResult' type -- Close all buffers with the 'httpResult' type
local close_types = { "httpResult", "noice", "help" }
local buffers = vim.api.nvim_list_bufs() local buffers = vim.api.nvim_list_bufs()
for _, bufnr in ipairs(buffers) do for _, bufnr in ipairs(buffers) do
if vim.bo[bufnr].filetype == "httpResult" then if U.table_contains(close_types, vim.bo[bufnr].filetype) then
vim.api.nvim_buf_delete(bufnr, { force = true }) vim.api.nvim_buf_delete(bufnr, { force = true })
end end
end end

View file

@ -53,7 +53,7 @@ U.keymaps({
-- * if non empty buffer, we will simply open a new empty buffer unless -- * if non empty buffer, we will simply open a new empty buffer unless
-- it is in the close always list -- it is in the close always list
-- * if empty buffer, then we will quit this buffer -- * if empty buffer, then we will quit this buffer
local close_always = { "quickfix", "help", "nofile", "httpResult" } local close_always = { "quickfix", "help", "nofile", "noice", "httpResult" }
if if
U.table_contains(close_always, vim.bo.buftype) U.table_contains(close_always, vim.bo.buftype)
or (vim.api.nvim_buf_line_count(0) == 1 and vim.api.nvim_buf_get_lines(0, 0, 1, -1)[1] == "") or (vim.api.nvim_buf_line_count(0) == 1 and vim.api.nvim_buf_get_lines(0, 0, 1, -1)[1] == "")
@ -109,12 +109,6 @@ U.keymaps({
{ "L", "<cmd>tabnext<cr>", desc = "Move to next tab" }, { "L", "<cmd>tabnext<cr>", desc = "Move to next tab" },
-- LSP/IDE/etc TODO move to lsp config file -- LSP/IDE/etc TODO move to lsp config file
{
"<leader>l<leader>",
vim.lsp.buf.format,
desc = "Reformat file",
mode = nvx,
},
{ {
"<leader>ld", "<leader>ld",
vim.diagnostic.open_float, vim.diagnostic.open_float,

View file

@ -52,7 +52,7 @@ vim.opt.undofile = true
-- See `:help 'list'` -- See `:help 'list'`
-- and `:help 'listchars'` -- and `:help 'listchars'`
vim.opt.list = true vim.opt.list = true
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "", eol = "" } vim.opt.listchars = { tab = " ", trail = "·", nbsp = "", eol = "" }
-- TODO REVISIT IF I WANT THESE -- TODO REVISIT IF I WANT THESE
-- Search settings -- Search settings

View file

@ -5,6 +5,7 @@ return {
config = function(_, opts) config = function(_, opts)
require("ccc").setup(opts) require("ccc").setup(opts)
vim.api.nvim_create_autocmd("BufRead", { vim.api.nvim_create_autocmd("BufRead", {
group = vim.api.nvim_create_augroup("myconfig-color-picker-group", { clear = true }),
callback = function() callback = function()
vim.cmd.CccHighlighterEnable() vim.cmd.CccHighlighterEnable()
end, end,

View file

@ -47,7 +47,7 @@ local function gitblame()
if d then if d then
local ok, res = pcall(os.date, "%d %b %y", d.committer_time) local ok, res = pcall(os.date, "%d %b %y", d.committer_time)
return d.committer .. " - " .. (ok and res or d.committer_time) return d.committer:sub(1, 12) .. " - " .. (ok and res or d.committer_time)
end end
return "" return ""
end end
@ -121,11 +121,13 @@ return {
}) })
end end
local group = vim.api.nvim_create_augroup("myconfig-lua-line-group", { clear = true })
vim.api.nvim_create_autocmd("RecordingEnter", { vim.api.nvim_create_autocmd("RecordingEnter", {
group = group,
callback = ref, callback = ref,
}) })
vim.api.nvim_create_autocmd("RecordingLeave", { vim.api.nvim_create_autocmd("RecordingLeave", {
group = group,
callback = function() callback = function()
local timer = vim.loop.new_timer() local timer = vim.loop.new_timer()
timer:start(50, 0, vim.schedule_wrap(ref)) timer:start(50, 0, vim.schedule_wrap(ref))

View file

@ -0,0 +1,5 @@
return {
-- This plugin automatically adjusts 'shiftwidth' and 'expandtab' heuristically based on the current file, or, in the case the current file is new, blank, or otherwise insufficient, by looking at other files of the same type in the current and parent directories.
"tpope/vim-sleuth",
event = "VeryLazy",
}

30
lua/plugins/formatter.lua Normal file
View file

@ -0,0 +1,30 @@
return {
"stevearc/conform.nvim",
opts = {
-- https://github.com/stevearc/conform.nvim?tab=readme-ov-file#setup
notify_on_error = true,
formatters_by_ft = {
lua = { "stylua" },
typescript = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
javascript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
},
},
keys = {
{
"<leader>l<leader>",
function()
require("conform").format({ async = true, lsp_fallback = true }, function(err, edited)
if edited then
print("Formatted!")
else
print("Nothing to format!")
end
end)
end,
mode = { "n", "v", "x" },
desc = "Format buffer",
},
},
}

View file

@ -24,7 +24,6 @@ return {
}, },
current_line_blame = true, current_line_blame = true,
current_line_blame_opts = { current_line_blame_opts = {
delay = 0,
virt_text = false, virt_text = false,
}, },
} }

View file

@ -26,9 +26,10 @@ return {
}, },
}, },
}, },
config = function(_, opts) init = function()
U.highlight("NonText", { fg = "#303030", gui = "nocombine" }) U.highlight("NonText", { fg = "#303030", gui = "nocombine" })
end,
config = function(_, opts)
local hooks = require("ibl.hooks") local hooks = require("ibl.hooks")
hooks.register(hooks.type.HIGHLIGHT_SETUP, function() hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "IndentBlanklineIndent1", { fg = "#915053" }) vim.api.nvim_set_hl(0, "IndentBlanklineIndent1", { fg = "#915053" })

139
lua/plugins/lint.lua Normal file
View file

@ -0,0 +1,139 @@
-- Stolen from LazyVim https://github.com/LazyVim/LazyVim/tree/f086bcde253c29be9a2b9c90b413a516f5d5a3b2/lua/lazyvim/plugins
return {
"mfussenegger/nvim-lint",
event = { "VeryLazy", "BufWritePost", "BufReadPost", "InsertLeave" },
opts = {
-- Event to trigger linters
events = { "BufWritePost", "BufReadPost", "InsertLeave", "CursorHold", "CursorHoldI" },
linters_by_ft = {
-- Builtin: https://github.com/mfussenegger/nvim-lint/tree/master/lua/lint/linters
markdown = { "markdownlint" },
lua = { "luacheck" },
typescript = { "biomejs" },
typescriptreact = { "biomejs" },
javascript = { "biomejs" },
javascriptreact = { "biomejs" },
-- Use the "*" filetype to run linters on all filetypes.
-- ['*'] = { 'global linter' },
-- Use the "_" filetype to run linters on filetypes that don't have other linters configured.
-- ['_'] = { 'fallback linter' },
-- ["*"] = { "typos" },
},
-- LazyVim extension to easily override linter options
-- or add custom linters.
---@type table<string,table>
--
-- Options:
-- cmd = 'linter_cmd',
-- stdin = true, -- or false if it doesn't support content input via stdin. In that case the filename is automatically added to the arguments.
-- append_fname = true, -- Automatically append the file name to `args` if `stdin = false` (default: true)
-- args = {}, -- list of arguments. Can contain functions with zero arguments that will be evaluated once the linter is used.
-- stream = nil, -- ('stdout' | 'stderr' | 'both') configure the stream to which the linter outputs the linting result.
-- ignore_exitcode = false, -- set this to true if the linter exits with a code != 0 and that's considered normal.
-- env = nil, -- custom environment table to use with the external process. Note that this replaces the *entire* environment, it is not additive.
-- parser = your_parse_function
--
-- your_parse_function can be a function which takes three arguments:
-- output
-- bufnr
-- linter_cwd
-- The output is the output generated by the linter command. The function must return a list of diagnostics as specified in :help diagnostic-structure.
linters = {
luacheck = {
args = {
"--globals",
"vim",
"--globals",
"NIX",
"--globals",
"U",
"--max_line_length",
"240",
"--max_code_line_length",
"240",
"--max_string_line_length",
"240",
"--max_comment_line_length",
"240",
"--formatter",
"plain",
"--codes",
"--ranges",
"-",
},
},
-- -- Example of using selene only when a selene.toml file is present
-- selene = {
-- -- `condition` is another LazyVim extension that allows you to
-- -- dynamically enable/disable linters based on the context.
-- condition = function(ctx)
-- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1]
-- end,
-- },
},
},
config = function(_, opts)
local M = {}
local lint = require("lint")
for name, linter in pairs(opts.linters) do
if type(linter) == "table" and type(lint.linters[name]) == "table" then
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter)
else
lint.linters[name] = linter
end
end
lint.linters_by_ft = opts.linters_by_ft
function M.debounce(ms, fn)
local timer = vim.uv.new_timer()
return function(...)
local argv = { ... }
timer:start(ms, 0, function()
timer:stop()
vim.schedule_wrap(fn)(unpack(argv))
end)
end
end
function M.lint()
-- Use nvim-lint's logic first:
-- * checks if linters exist for the full filetype first
-- * otherwise will split filetype by "." and add all those linters
-- * this differs from conform.nvim which only uses the first filetype that has a formatter
local names = lint._resolve_linter_by_ft(vim.bo.filetype)
-- Create a copy of the names table to avoid modifying the original.
names = vim.list_extend({}, names)
-- Add fallback linters.
if #names == 0 then
vim.list_extend(names, lint.linters_by_ft["_"] or {})
end
-- Add global linters.
vim.list_extend(names, lint.linters_by_ft["*"] or {})
-- Filter out linters that don't exist or don't match the condition.
local ctx = { filename = vim.api.nvim_buf_get_name(0) }
ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h")
names = vim.tbl_filter(function(name)
local linter = lint.linters[name]
if not linter then
LazyVim.warn("Linter not found: " .. name, { title = "nvim-lint" })
end
return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx))
end, names)
-- Run linters.
if #names > 0 then
lint.try_lint(names)
end
end
vim.api.nvim_create_autocmd(opts.events, {
group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }),
callback = M.debounce(100, M.lint),
})
end,
}

View file

@ -81,12 +81,21 @@ return {
desc = "Resume last telescope", desc = "Resume last telescope",
}, },
{ {
"<leader>fj", "<leader>f/",
function() function()
require("telescope.builtin").current_buffer_fuzzy_find() require("telescope.builtin").current_buffer_fuzzy_find(
require("telescope.themes").get_dropdown({ winblend = 10, previewer = false })
)
end, end,
desc = "Fuzzy find/search in current buffer fuzzy.", desc = "Fuzzy find/search in current buffer fuzzy.",
}, },
{
"<leader>fh",
function()
require("telescope.builtin").help_tags()
end,
desc = "Find help",
},
{ {
"<leader>ff", "<leader>ff",
function() function()
@ -133,21 +142,21 @@ return {
function() function()
require("telescope.builtin").keymaps() require("telescope.builtin").keymaps()
end, end,
desc = "Find Commands", desc = "Find Keymap",
}, },
{ {
"<leader>fb", "<leader>fb",
function() function()
require("telescope.builtin").buffers() require("telescope.builtin").buffers()
end, end,
desc = "Find Commands", desc = "Find Buffer",
}, },
{ {
"<leader>lfr", "<leader>lfr",
function() function()
require("telescope.builtin").lsp_references() require("telescope.builtin").lsp_references()
end, end,
desc = "Find References", desc = "Find LSP References",
mode = { "n", "v", "x" }, mode = { "n", "v", "x" },
}, },
}, },

View file

@ -14,8 +14,9 @@ vim.api.nvim_create_user_command("RemoveQFItem", RemoveQFItem, {})
-- Auto command to map 'dd' in quickfix window -- Auto command to map 'dd' in quickfix window
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("myconfig-quick-fix-group", { clear = true }),
pattern = "qf", pattern = "qf",
callback = function() callback = function(event)
vim.keymap.set("n", "dd", RemoveQFItem, { buffer = true, silent = true }) vim.keymap.set("n", "dd", RemoveQFItem, { buffer = event.buffer, silent = true })
end, end,
}) })

View file

@ -48,7 +48,7 @@ function M.keymap(keymap)
local lhs = keymap[1] local lhs = keymap[1]
local rhs = keymap[2] local rhs = keymap[2]
local mode = keymap["mode"] or "n" local mode = keymap["mode"] or "n"
local opts = {} local opts = { silent = true }
for key, value in pairs(keymap) do for key, value in pairs(keymap) do
if type(key) ~= "number" and key ~= "mode" then if type(key) ~= "number" and key ~= "mode" then
opts[key] = value opts[key] = value