diff --git a/config/basic.lua b/config/basic.lua index e248df6..e6e7725 100644 --- a/config/basic.lua +++ b/config/basic.lua @@ -1,202 +1,3 @@ -------------------------------------------------------------------------------- --- --- Basic Settings --- - -vim.cmd("filetype off") - -- Leaders vim.g.mapleader = "," vim.g.maplocalleader = "-" - --- Better Unix support -vim.opt.viewoptions = { "folds", "options", "cursor", "unix", "slash" } -vim.opt.encoding = "utf-8" - --- True color support -vim.opt.termguicolors = true - --- Other options -vim.cmd("syntax on") -vim.opt.backspace = { "indent", "eol", "start" } -vim.opt.laststatus = 2 -vim.opt.showmode = false - --- Tabs as spaces -vim.opt.expandtab = true -vim.opt.tabstop = 2 -vim.opt.softtabstop = 2 -vim.opt.shiftwidth = 2 - --- Fixes broken cursor on Linux -vim.opt.guicursor = "" - --- Disable mouse / touchpad -vim.opt.mouse = "" - --- Incremental substitutin -vim.opt.inccommand = "split" - -------------------------------------------------------------------------------- --- --- General editor options --- - --- Hide files when leaving them. -vim.opt.hidden = true --- Show line numbers. -vim.opt.number = true --- Minimum line number column width. -vim.opt.numberwidth = 1 --- Number of screen lines to use for the commandline. -vim.opt.cmdheight = 2 --- Lines length limit (0 if no limit). -vim.opt.textwidth = 0 --- Don't cut lines in the middle of a work. -vim.opt.linebreak = true --- Show matching parenthesis. -vim.opt.showmatch = true --- Time during which the matching parenthesis is shown. -vim.opt.matchtime = 2 --- Sensible default line auto cutting and formatting. -vim.opt.formatoptions = "jtcrq" --- Copy/Past to/from clipboard. -vim.opt.clipboard = "unnamedplus" --- Highlight line cursor is currently on. -vim.opt.cursorline = true --- Invisible characters representation when :set list -vim.opt.listchars = { - tab = "→ ", - trail = "~", - nbsp = "␣", - eol = "¬", -} - --- Search --- Incremental search. -vim.opt.incsearch = true --- Case insensitive. -vim.opt.ignorecase = true --- Case insensitive if no uppercase letter in pattern, case sensitive otherwise. -vim.opt.smartcase = true - --- Spell -vim.opt.spelllang = "en,ru" - --- Fold level -vim.opt.foldlevel = 99 -vim.opt.foldlevelstart = 99 -vim.opt.foldminlines = 3 -vim.opt.foldnestmax = 5 - -------------------------------------------------------------------------------- --- --- File type specified --- -local bufReadFile = { "BufNewFile", "BufRead" } - --- Set up a line limiter for each lang -local line_limiter_augroup = vim.api.nvim_create_augroup("line_limiter", {}) -local function set_line_limiter(limit, patterns) - vim.api.nvim_create_autocmd(bufReadFile, { - pattern = patterns, - group = line_limiter_augroup, - callback = function() - vim.wo.colorcolumn = tostring(limit) - end, - }) -end - -set_line_limiter(101, { - "*.nix", - "*.vim", - "*.lua", - "*.ts", - "*.tsx", - "*.js", - "*.jsx", - "*.rs", -}) -set_line_limiter(81, { - "*.json", - "*.yml", - "*.yaml", - "*.md", - "*.html", - "*.css", -}) - --- Spell check for markdown files -local spell_check_augroup = vim.api.nvim_create_augroup("spell_check", {}) -vim.api.nvim_create_autocmd(bufReadFile, { - pattern = { "*.md" }, - group = spell_check_augroup, - callback = function() - vim.wo.spell = true - end, -}) - --- Set up fold method for each lang -local folding_augroup = vim.api.nvim_create_augroup("folding", {}) -vim.api.nvim_create_autocmd(bufReadFile, { - group = folding_augroup, - pattern = { - "*.js", - "*.jsx", - "*.ts", - "*.tsx", - }, - callback = function() - vim.cmd("syntax on") - vim.wo.foldmethod = "syntax" - end, -}) - -------------------------------------------------------------------------------- --- --- Bindings --- -local function clear_search_hl() - vim.opt.hlsearch = false -end -vim.keymap.set("n", "", clear_search_hl, { desc = "Clear search highlighting" }) - --- Enable fast navigation between windows -vim.keymap.set("n", "", "h") -vim.keymap.set("n", "", "l") -vim.keymap.set("n", "", "j") -vim.keymap.set("n", "", "k") - --- Disable the annoying and useless ex-mode -vim.keymap.set("n", "Q", "") -vim.keymap.set("n", "gQ", "") - --- Disable arrow keys -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("v", "", "") -vim.keymap.set("v", "", "") -vim.keymap.set("v", "", "") -vim.keymap.set("v", "", "") --- ... instead of insert mode for rus lang and popups --- vim.keymap.set("i", "", "") --- vim.keymap.set("i", "", "") --- vim.keymap.set("i", "", "") --- vim.keymap.set("i", "", "") - --- Disable page up / down -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("v", "", "") -vim.keymap.set("v", "", "") -vim.keymap.set("i", "", "") -vim.keymap.set("i", "", "") - -------------------------------------------------------------------------------- --- --- Abbreviatures --- -vim.cmd("cabbrev bsp belowright split") -vim.cmd("cabbrev rvsp belowright vsplit") diff --git a/default.nix b/default.nix index df75627..72db483 100644 --- a/default.nix +++ b/default.nix @@ -20,19 +20,7 @@ let callPlugins = list: builtins.map callPlugin list; plugins = callPlugins [ - ./plugins/config - (import ./plugins/syntax { - inherit tree-sitter; - }) - ./plugins/git - ./plugins/explorer - (import ./plugins/theme { - inherit enableDevIcons enableTabby; - inherit theme; - }) ./plugins/lsp - ./plugins/formatter - ./plugins/ux ]; basePlugins = [ vimPlugins.plenary-nvim ]; diff --git a/example.nix b/example.nix new file mode 100644 index 0000000..f6c6c3e --- /dev/null +++ b/example.nix @@ -0,0 +1 @@ +let is-hello-world = true; in { } diff --git a/flake.lock b/flake.lock index 2b50ae3..534844b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,73 +1,5 @@ { "nodes": { - "cmp-luasnip": { - "flake": false, - "locked": { - "lastModified": 1651433493, - "narHash": "sha256-8ocJY5qeAJXFSuTnavXX6NvZyAB0EEn2Y+amrWp8B1Y=", - "owner": "saadparwaiz1", - "repo": "cmp_luasnip", - "rev": "a9de941bcbda508d0a45d28ae366bb3f08db2e36", - "type": "github" - }, - "original": { - "owner": "saadparwaiz1", - "repo": "cmp_luasnip", - "rev": "a9de941bcbda508d0a45d28ae366bb3f08db2e36", - "type": "github" - } - }, - "cmp-nvim-lsp": { - "flake": false, - "locked": { - "lastModified": 1652705110, - "narHash": "sha256-19Ka4EQhqo//IMjJ/DnXiHsevVWFy2M90oSjmBFfCO0=", - "owner": "hrsh7th", - "repo": "cmp-nvim-lsp", - "rev": "affe808a5c56b71630f17aa7c38e15c59fd648a8", - "type": "github" - }, - "original": { - "owner": "hrsh7th", - "repo": "cmp-nvim-lsp", - "rev": "affe808a5c56b71630f17aa7c38e15c59fd648a8", - "type": "github" - } - }, - "editorconfig-nvim": { - "flake": false, - "locked": { - "lastModified": 1663509832, - "narHash": "sha256-+eLoPckZdsXqsyBGeM726P9WtR/pu0q7IEhKufulOxM=", - "owner": "gpanders", - "repo": "editorconfig.nvim", - "rev": "7d10fe6bc340fd783c0b61cf627dd235100284db", - "type": "github" - }, - "original": { - "owner": "gpanders", - "repo": "editorconfig.nvim", - "rev": "7d10fe6bc340fd783c0b61cf627dd235100284db", - "type": "github" - } - }, - "gitsigns-nvim": { - "flake": false, - "locked": { - "lastModified": 1663543397, - "narHash": "sha256-FgNSwvW7Bk+eKutMj0zqEorJ3+ijCALtOXs2OYiSX1I=", - "owner": "lewis6991", - "repo": "gitsigns.nvim", - "rev": "f98c85e7c3d65a51f45863a34feb4849c82f240f", - "type": "github" - }, - "original": { - "owner": "lewis6991", - "repo": "gitsigns.nvim", - "rev": "f98c85e7c3d65a51f45863a34feb4849c82f240f", - "type": "github" - } - }, "lspsaga-nvim": { "flake": false, "locked": { @@ -85,74 +17,6 @@ "type": "github" } }, - "lualine-lsp-progress": { - "flake": false, - "locked": { - "lastModified": 1634947677, - "narHash": "sha256-8HMtydFDzTxsuKvce+bIra9vZ9zHfEBHyR346W635b8=", - "owner": "arkav", - "repo": "lualine-lsp-progress", - "rev": "56842d097245a08d77912edf5f2a69ba29f275d7", - "type": "github" - }, - "original": { - "owner": "arkav", - "repo": "lualine-lsp-progress", - "rev": "56842d097245a08d77912edf5f2a69ba29f275d7", - "type": "github" - } - }, - "lualine-nvim": { - "flake": false, - "locked": { - "lastModified": 1662921346, - "narHash": "sha256-bGVozEoffFxjiLACTfnDGX11yIHGhLawQWn80Nbd6TM=", - "owner": "nvim-lualine", - "repo": "lualine.nvim", - "rev": "a52f078026b27694d2290e34efa61a6e4a690621", - "type": "github" - }, - "original": { - "owner": "nvim-lualine", - "repo": "lualine.nvim", - "rev": "a52f078026b27694d2290e34efa61a6e4a690621", - "type": "github" - } - }, - "luaship": { - "flake": false, - "locked": { - "lastModified": 1663664003, - "narHash": "sha256-56x4Eke/7Cdn4/8T0SM73WpDqBSFq1vFY5VdkNlUBwI=", - "owner": "L3MON4D3", - "repo": "LuaSnip", - "rev": "d36c063b7f6e701852f7880f1314656592a61b4f", - "type": "github" - }, - "original": { - "owner": "L3MON4D3", - "repo": "LuaSnip", - "rev": "d36c063b7f6e701852f7880f1314656592a61b4f", - "type": "github" - } - }, - "neoformat": { - "flake": false, - "locked": { - "lastModified": 1661997045, - "narHash": "sha256-x+TDVvH0DgmCCjOjhbE2/YaxnjCd4fcPxuQD6bhwVNs=", - "owner": "sbdchd", - "repo": "neoformat", - "rev": "0ae951121da29a157d80db70c32679b428afffdc", - "type": "github" - }, - "original": { - "owner": "sbdchd", - "repo": "neoformat", - "rev": "0ae951121da29a157d80db70c32679b428afffdc", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1663146586, @@ -169,23 +33,6 @@ "type": "github" } }, - "nvim-cmp": { - "flake": false, - "locked": { - "lastModified": 1663990701, - "narHash": "sha256-gpkPMlOUMfTlef5WRFHLkmKEDZ9TRA/yRPqb6UXnKOA=", - "owner": "hrsh7th", - "repo": "nvim-cmp", - "rev": "17a55b3d5498c617855d015bbcad0c872d10c879", - "type": "github" - }, - "original": { - "owner": "hrsh7th", - "repo": "nvim-cmp", - "rev": "17a55b3d5498c617855d015bbcad0c872d10c879", - "type": "github" - } - }, "nvim-lspconfig": { "flake": false, "locked": { @@ -203,57 +50,6 @@ "type": "github" } }, - "nvim-tree-lua": { - "flake": false, - "locked": { - "lastModified": 1663823703, - "narHash": "sha256-QY60TDUVmKcFzCAojReZEAbQcyEYgCG4nhgsx74OtVM=", - "owner": "kyazdani42", - "repo": "nvim-tree.lua", - "rev": "0417d9148b6546bf4883b6e9750f992f980afbfe", - "type": "github" - }, - "original": { - "owner": "kyazdani42", - "repo": "nvim-tree.lua", - "rev": "0417d9148b6546bf4883b6e9750f992f980afbfe", - "type": "github" - } - }, - "nvim-treesitter": { - "flake": false, - "locked": { - "lastModified": 1664008557, - "narHash": "sha256-hZqZkXrIw9OfXLqioSqagmEPoIz8gcT+WpEhVURdeHw=", - "owner": "nvim-treesitter", - "repo": "nvim-treesitter", - "rev": "a60aa7b2e1dd9219c6356f65ba48bdbd50090abd", - "type": "github" - }, - "original": { - "owner": "nvim-treesitter", - "repo": "nvim-treesitter", - "rev": "a60aa7b2e1dd9219c6356f65ba48bdbd50090abd", - "type": "github" - } - }, - "nvim-web-devicons": { - "flake": false, - "locked": { - "lastModified": 1663532214, - "narHash": "sha256-e8FP68mEmPAEbk+rYEKKGi0ZTJHDCPxrulnivkzInXk=", - "owner": "kyazdani42", - "repo": "nvim-web-devicons", - "rev": "969728506c0175644a1d448f55e311ccdada7eaf", - "type": "github" - }, - "original": { - "owner": "kyazdani42", - "repo": "nvim-web-devicons", - "rev": "969728506c0175644a1d448f55e311ccdada7eaf", - "type": "github" - } - }, "plenary-nvim": { "flake": false, "locked": { @@ -272,97 +68,13 @@ }, "root": { "inputs": { - "cmp-luasnip": "cmp-luasnip", - "cmp-nvim-lsp": "cmp-nvim-lsp", - "editorconfig-nvim": "editorconfig-nvim", - "gitsigns-nvim": "gitsigns-nvim", "lspsaga-nvim": "lspsaga-nvim", - "lualine-lsp-progress": "lualine-lsp-progress", - "lualine-nvim": "lualine-nvim", - "luaship": "luaship", - "neoformat": "neoformat", "nixpkgs": "nixpkgs", - "nvim-cmp": "nvim-cmp", "nvim-lspconfig": "nvim-lspconfig", - "nvim-tree-lua": "nvim-tree-lua", - "nvim-treesitter": "nvim-treesitter", - "nvim-web-devicons": "nvim-web-devicons", "plenary-nvim": "plenary-nvim", - "tabby-nvim": "tabby-nvim", - "telescope-live-grep-args-nvim": "telescope-live-grep-args-nvim", - "telescope-nvim": "telescope-nvim", - "theme": "theme", "utils": "utils" } }, - "tabby-nvim": { - "flake": false, - "locked": { - "lastModified": 1663040953, - "narHash": "sha256-QmqRKFuukm4Vn531TEoejxX3yx0ofzymExOp9c9ybDg=", - "owner": "nanozuki", - "repo": "tabby.nvim", - "rev": "916c9e56d043906a441cd9f905e2ca1f5c4dddb0", - "type": "github" - }, - "original": { - "owner": "nanozuki", - "repo": "tabby.nvim", - "rev": "916c9e56d043906a441cd9f905e2ca1f5c4dddb0", - "type": "github" - } - }, - "telescope-live-grep-args-nvim": { - "flake": false, - "locked": { - "lastModified": 1661594012, - "narHash": "sha256-T5j2qgoDtVkk1uCLjoNeyw4eTu6eLbTXQHUuvHs3Tls=", - "owner": "nvim-telescope", - "repo": "telescope-live-grep-args.nvim", - "rev": "32b633b062d1168a2d18ad27994e5b4ef97f0a74", - "type": "github" - }, - "original": { - "owner": "nvim-telescope", - "repo": "telescope-live-grep-args.nvim", - "rev": "32b633b062d1168a2d18ad27994e5b4ef97f0a74", - "type": "github" - } - }, - "telescope-nvim": { - "flake": false, - "locked": { - "lastModified": 1663402536, - "narHash": "sha256-hIOg0rFAek9p6/k2USBAPQwIoVdSJ+Tw6A0jrup9xto=", - "owner": "nvim-telescope", - "repo": "telescope.nvim", - "rev": "30e2dc5232d0dd63709ef8b44a5d6184005e8602", - "type": "github" - }, - "original": { - "owner": "nvim-telescope", - "repo": "telescope.nvim", - "rev": "30e2dc5232d0dd63709ef8b44a5d6184005e8602", - "type": "github" - } - }, - "theme": { - "flake": false, - "locked": { - "lastModified": 1663990749, - "narHash": "sha256-EdmZ5qXY10jkYBgtd/qe23Ccl5qwFm3bwXNQIG8Qn5A=", - "owner": "catppuccin", - "repo": "nvim", - "rev": "9ac18414f0446478024b19018d73b7ea14f6fc96", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "nvim", - "rev": "9ac18414f0446478024b19018d73b7ea14f6fc96", - "type": "github" - } - }, "utils": { "locked": { "lastModified": 1659877975, diff --git a/flake.nix b/flake.nix index fb88a47..897509e 100644 --- a/flake.nix +++ b/flake.nix @@ -9,50 +9,6 @@ flake = false; }; - # config - - # https://github.com/gpanders/editorconfig.nvim - editorconfig-nvim = { - url = "github:gpanders/editorconfig.nvim?rev=7d10fe6bc340fd783c0b61cf627dd235100284db"; - flake = false; - }; - - # explorer - - # https://github.com/kyazdani42/nvim-tree.lua - nvim-tree-lua = { - url = "github:kyazdani42/nvim-tree.lua?rev=0417d9148b6546bf4883b6e9750f992f980afbfe"; - flake = false; - }; - - # https://github.com/nvim-telescope/telescope.nvim - telescope-nvim = { - url = "github:nvim-telescope/telescope.nvim?rev=30e2dc5232d0dd63709ef8b44a5d6184005e8602"; - flake = false; - }; - - # https://github.com/nvim-telescope/telescope-live-grep-args.nvim - telescope-live-grep-args-nvim = { - url = "github:nvim-telescope/telescope-live-grep-args.nvim?rev=32b633b062d1168a2d18ad27994e5b4ef97f0a74"; - flake = false; - }; - - # formatter - - # https://github.com/sbdchd/neoformat - neoformat = { - url = "github:sbdchd/neoformat?rev=0ae951121da29a157d80db70c32679b428afffdc"; - flake = false; - }; - - # git - - # https://github.com/lewis6991/gitsigns.nvim - gitsigns-nvim = { - url = "github:lewis6991/gitsigns.nvim?rev=f98c85e7c3d65a51f45863a34feb4849c82f240f"; - flake = false; - }; - # lsp # https://github.com/neovim/nvim-lspconfig @@ -66,101 +22,15 @@ url = "github:glepnir/lspsaga.nvim?rev=381900d932db058aa3236ba66cc9f45747c0df71"; flake = false; }; - - # https://github.com/L3MON4D3/LuaSnip - luaship = { - url = "github:L3MON4D3/LuaSnip?rev=d36c063b7f6e701852f7880f1314656592a61b4f"; - flake = false; - }; - - # https://github.com/hrsh7th/nvim-cmp - nvim-cmp = { - url = "github:hrsh7th/nvim-cmp?rev=17a55b3d5498c617855d015bbcad0c872d10c879"; - flake = false; - }; - - # https://github.com/hrsh7th/cmp-nvim-lsp - cmp-nvim-lsp = { - url = "github:hrsh7th/cmp-nvim-lsp?rev=affe808a5c56b71630f17aa7c38e15c59fd648a8"; - flake = false; - }; - - # https://github.com/saadparwaiz1/cmp_luasnip - cmp-luasnip = { - url = "github:saadparwaiz1/cmp_luasnip?rev=a9de941bcbda508d0a45d28ae366bb3f08db2e36"; - flake = false; - }; - - # syntax - - # https://github.com/nvim-treesitter/nvim-treesitter - nvim-treesitter = { - url = "github:nvim-treesitter/nvim-treesitter?rev=a60aa7b2e1dd9219c6356f65ba48bdbd50090abd"; - flake = false; - }; - - # theme - - # https://github.com/nanozuki/tabby.nvim - tabby-nvim = { - url = "github:nanozuki/tabby.nvim?rev=916c9e56d043906a441cd9f905e2ca1f5c4dddb0"; - flake = false; - }; - - # https://github.com/nvim-lualine/lualine.nvim - lualine-nvim = { - url = "github:nvim-lualine/lualine.nvim?rev=a52f078026b27694d2290e34efa61a6e4a690621"; - flake = false; - }; - - # https://github.com/arkav/lualine-lsp-progress - lualine-lsp-progress = { - url = "github:/arkav/lualine-lsp-progress?rev=56842d097245a08d77912edf5f2a69ba29f275d7"; - flake = false; - }; - - # https://github.com/kyazdani42/nvim-web-devicons - nvim-web-devicons = { - url = "github:kyazdani42/nvim-web-devicons?rev=969728506c0175644a1d448f55e311ccdada7eaf"; - flake = false; - }; - - # https://github.com/catppuccin/nvim - theme = { - url = "github:catppuccin/nvim?rev=9ac18414f0446478024b19018d73b7ea14f6fc96"; - flake = false; - }; }; outputs = inputs @ { self, nixpkgs, utils, ... }: let inputPlugins = [ "plenary-nvim" - # config - "editorconfig-nvim" - # explorer - "nvim-tree-lua" - "telescope-nvim" - "telescope-live-grep-args-nvim" - # formatter - "neoformat" - # git - "gitsigns-nvim" # lsp "nvim-lspconfig" "lspsaga-nvim" - "luaship" - "nvim-cmp" - "cmp-nvim-lsp" - "cmp-luasnip" - # syntax - "nvim-treesitter" - # theme - "tabby-nvim" - "lualine-nvim" - "lualine-lsp-progress" - "nvim-web-devicons" - "theme" ]; mkNvimPlugins = { lib, vimUtils, vimPlugins, ... }: diff --git a/plugins/config/default.nix b/plugins/config/default.nix deleted file mode 100644 index b326d75..0000000 --- a/plugins/config/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ editorconfig-nvim, ... }: - -{ - plugins = [ editorconfig-nvim ]; -} diff --git a/plugins/explorer/default.nix b/plugins/explorer/default.nix deleted file mode 100644 index 2ee19ff..0000000 --- a/plugins/explorer/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ nvim-tree-lua, telescope-nvim, telescope-live-grep-args-nvim, ... }: - -{ - luaConfig = (builtins.readFile ./nvim-tree.lua) - + (builtins.readFile ./telescope-nvim.lua); - - plugins = [ nvim-tree-lua ] - ++ [ telescope-nvim telescope-live-grep-args-nvim ]; -} diff --git a/plugins/explorer/nvim-tree.lua b/plugins/explorer/nvim-tree.lua deleted file mode 100644 index fe0d0b0..0000000 --- a/plugins/explorer/nvim-tree.lua +++ /dev/null @@ -1,11 +0,0 @@ --- See: https://github.com/kyazdani42/nvim-tree.lua/blob/master/doc/nvim-tree-lua.txt - --- disable netrw at the very start of your init.lua (strongly advised) -vim.g.loaded = 1 -vim.g.loaded_netrwPlugin = 1 - --- empty setup using defaults -require("nvim-tree").setup() - -vim.keymap.set("n", "nt", "NvimTreeToggle") -vim.keymap.set("n", "nf", "NvimTreeFindFile") diff --git a/plugins/explorer/telescope-nvim.lua b/plugins/explorer/telescope-nvim.lua deleted file mode 100644 index 4dfe19b..0000000 --- a/plugins/explorer/telescope-nvim.lua +++ /dev/null @@ -1,13 +0,0 @@ --- See: https://github.com/nvim-telescope/telescope.nvim -local telescope = require("telescope") - -telescope.setup({}) - -vim.keymap.set("n", "ff", "Telescope find_files hidden=true") -vim.keymap.set("n", "fb", "Telescope buffers") -vim.keymap.set("n", "fh", "Telescope help_tags") - --- required telescope-live-grep-args-nvim plugin -vim.keymap.set("n", "fg", function() - telescope.extensions.live_grep_args.live_grep_args() -end) diff --git a/plugins/formatter/default.nix b/plugins/formatter/default.nix deleted file mode 100644 index 184e84d..0000000 --- a/plugins/formatter/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ neoformat, ... }: - -{ - luaConfig = builtins.readFile ./neoformat.lua; - - plugins = [ neoformat ]; -} diff --git a/plugins/formatter/neoformat.lua b/plugins/formatter/neoformat.lua deleted file mode 100644 index 62643dd..0000000 --- a/plugins/formatter/neoformat.lua +++ /dev/null @@ -1,10 +0,0 @@ -vim.g.neoformat_try_node_exe = 1 -vim.g.neoformat_only_msg_on_error = 1 -vim.g.neoformat_enabled_markdown = { "denofmt" } - -vim.cmd([[ -aug fmt - au! - au BufWritePre * try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry -aug END -]]) diff --git a/plugins/git/default.nix b/plugins/git/default.nix deleted file mode 100644 index 3c82ffc..0000000 --- a/plugins/git/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ gitsigns-nvim, ... }: - -{ - luaConfig = builtins.readFile ./gitsigns-nvim.lua; - - plugins = [ gitsigns-nvim ]; -} diff --git a/plugins/git/gitsigns-nvim.lua b/plugins/git/gitsigns-nvim.lua deleted file mode 100644 index ff4d8b7..0000000 --- a/plugins/git/gitsigns-nvim.lua +++ /dev/null @@ -1,52 +0,0 @@ -function on_attach(bufnr) - local gs = package.loaded.gitsigns - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map("n", "]h", function() - if vim.wo.diff then - return "]h" - end - vim.schedule(function() - gs.next_hunk() - end) - return "" - end, { expr = true }) - - map("n", "[h", function() - if vim.wo.diff then - return "[h" - end - vim.schedule(function() - gs.prev_hunk() - end) - return "" - end, { expr = true }) - - -- Actions - map({ "n", "v" }, "gs", ":Gitsigns stage_hunk") - map({ "n", "v" }, "gr", ":Gitsigns reset_hunk") - map("n", "gu", gs.undo_stage_hunk) - map("n", "gp", gs.preview_hunk) - map("n", "gb", function() - gs.blame_line({ full = true }) - end) - map("n", "gtb", gs.toggle_current_line_blame) - map("n", "gd", gs.diffthis) - map("n", "gD", function() - gs.diffthis("~") - end) - - -- Text object - map({ "o", "x" }, "ih", ":Gitsigns select_hunk") -end - --- See: https://github.com/lewis6991/gitsigns.nvim -require("gitsigns").setup({ - on_attach = on_attach, -}) diff --git a/plugins/lsp/default.nix b/plugins/lsp/default.nix index 69e3214..a045b3a 100644 --- a/plugins/lsp/default.nix +++ b/plugins/lsp/default.nix @@ -1,26 +1,13 @@ { nvim-lspconfig , lspsaga-nvim -, luasnip -, nvim-cmp -, cmp-nvim-lsp -, cmp_luasnip , ... }: let lsp = [ nvim-lspconfig lspsaga-nvim ]; - snippets = [ luasnip ]; - completions = [ - nvim-cmp # Autocompletion - cmp-nvim-lsp # LSP source for nvim-cmp - cmp_luasnip # Snippets source for nvim-cmp - ]; in { - luaConfig = (builtins.readFile ./lspconfig.lua) - + (builtins.readFile ./nvim-cmp.lua); + luaConfig = (builtins.readFile ./lspconfig.lua); - plugins = lsp - ++ snippets - ++ completions; + plugins = lsp; } diff --git a/plugins/lsp/lspconfig.lua b/plugins/lsp/lspconfig.lua index 76bac3b..d8e6731 100644 --- a/plugins/lsp/lspconfig.lua +++ b/plugins/lsp/lspconfig.lua @@ -3,59 +3,20 @@ local saga = require("lspsaga") -- See: https://github.com/glepnir/lspsaga.nvim#configuration saga.init_lsp_saga({ - border_style = "rounded", code_action_lightbulb = { enable = false }, - code_action_keys = { quit = "" }, - definition_action_keys = { quit = "" }, - rename_action_quit = "", symbol_in_winbar = { enable = false }, }) -- always show signcolumns vim.opt.signcolumn = "yes" --- Mappings. --- See `:help vim.diagnostic.*` for documentation on any of the below functions -local opts = { noremap = true, silent = true } -vim.keymap.set("n", "e", vim.diagnostic.open_float, opts) -vim.keymap.set("n", "[d", "Lspsaga diagnostic_jump_prev", opts) -vim.keymap.set("n", "]d", "Lspsaga diagnostic_jump_next", opts) -vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) - --- Only jump to error -vim.keymap.set("n", "[e", function() - require("lspsaga.diagnostic").goto_prev({ severity = vim.diagnostic.severity.ERROR }) -end, opts) -vim.keymap.set("n", "]e", function() - require("lspsaga.diagnostic").goto_next({ severity = vim.diagnostic.severity.ERROR }) -end, opts) - -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) - -- Enable completion triggered by - -- vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - - -- Mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) - vim.keymap.set("n", "gy", vim.lsp.buf.type_definition, bufopts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) - -- vim.keymap.set("n", "", vim.lsp.buf.signature_help, bufopts) - -- vim.keymap.set("n", "f", vim.lsp.buf.formatting, bufopts) vim.keymap.set("n", "n", "Lspsaga rename", bufopts) - vim.keymap.set({ "n", "v" }, "a", "Lspsaga code_action", bufopts) - vim.keymap.set("n", "K", "Lspsaga hover_doc", bufopts) - vim.keymap.set("n", "co", "LSoutlineToggle", bufopts) end --- nvim-cmp -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities) - ------------------------------------------------------------------------------- -- See: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md -- @@ -63,27 +24,7 @@ capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities) -- Override the default configuration to be applied to all servers lsp_config.util.default_config = vim.tbl_extend("force", lsp_config.util.default_config, { on_attach = on_attach, - capabilities = capabilities, }) -- nix lsp_config.nil_ls.setup({}) - --- js,ts -lsp_config.tsserver.setup({}) -lsp_config.eslint.setup({}) - --- rust -lsp_config.rust_analyzer.setup({ - -- Server-specific settings... - settings = { - ["rust-analyzer"] = { - ["server.path"] = "rust-analyzer", - ["updates.prompt"] = false, - ["updates.checkOnStartup"] = false, - ["checkOnSave.enable"] = true, - ["checkOnSave.command"] = "clippy", - ["cargo.autoreload"] = true, - }, - }, -}) diff --git a/plugins/lsp/nvim-cmp.lua b/plugins/lsp/nvim-cmp.lua deleted file mode 100644 index 5c22613..0000000 --- a/plugins/lsp/nvim-cmp.lua +++ /dev/null @@ -1,43 +0,0 @@ -local luasnip = require("luasnip") -local cmp = require("cmp") - -vim.opt.completeopt = { "menu", "menuone", "noselect" } - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - }, -}) diff --git a/plugins/syntax/default.nix b/plugins/syntax/default.nix deleted file mode 100644 index 11aa5ae..0000000 --- a/plugins/syntax/default.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ tree-sitter, ... }: - -{ nvim-treesitter, ... }: - - -let - treesitterGrammars = tree-sitter.withPlugins - (grammars: with grammars; [ - tree-sitter-nix - tree-sitter-lua - tree-sitter-ledger - tree-sitter-yaml - tree-sitter-json - tree-sitter-typescript - tree-sitter-javascript - tree-sitter-rust - tree-sitter-haskell - tree-sitter-bash - ]); - - nvim-treesitter-with-grammars = nvim-treesitter.overrideAttrs (oldAttrs: { - postPatch = '' - rm -r parser - ln -s ${treesitterGrammars} parser - ''; - }); - -in -{ - luaConfig = builtins.readFile ./treesitter.lua; - - plugins = [ - nvim-treesitter-with-grammars - ]; -} diff --git a/plugins/syntax/treesitter.lua b/plugins/syntax/treesitter.lua deleted file mode 100644 index 9da58ad..0000000 --- a/plugins/syntax/treesitter.lua +++ /dev/null @@ -1,12 +0,0 @@ -require("nvim-treesitter.configs").setup({ - ensure_installed = {}, - sync_install = false, - - highlight = { - enable = true, - }, - - indent = { - enable = true, - }, -}) diff --git a/plugins/theme/default.nix b/plugins/theme/default.nix deleted file mode 100644 index d6aeb87..0000000 --- a/plugins/theme/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ enableDevIcons ? false -, enableTabby ? false -, theme ? { } -}: - -{ lib -, theme -, lualine-nvim -, lualine-lsp-progress -, nvim-web-devicons -, tabby-nvim -, ... -}: - -let - inherit (builtins) readFile isString; - - themeFlavour = if isString (lib.getAttrOpt "flavour" theme) then theme.flavour else "frappe"; - themeConfig = if isString (lib.getAttrOpt "config" theme) then theme.config else '' - vim.g.catppuccin_flavour = "${themeFlavour}" - require("catppuccin").setup() - vim.cmd([[colorscheme catppuccin]]) - ''; - - lualinePlugins = [ lualine-nvim lualine-lsp-progress ]; -in -{ - luaConfig = themeConfig - + (readFile ./lualine.lua) - + (lib.optional enableTabby (readFile ./tabby-nvim.lua)); - - plugins = [ theme ] - ++ lualinePlugins - ++ (lib.optional enableDevIcons [ nvim-web-devicons ]) - ++ (lib.optional enableTabby [ tabby-nvim ]); -} diff --git a/plugins/theme/lualine.lua b/plugins/theme/lualine.lua deleted file mode 100644 index f04993b..0000000 --- a/plugins/theme/lualine.lua +++ /dev/null @@ -1,16 +0,0 @@ --- See: https://github.com/nvim-lualine/lualine.nvim#default-configuration -require("lualine").setup({ - options = { - ignore_focus = { "NvimTree" }, - }, - sections = { - lualine_a = { - { "filename", path = 1 }, - }, - lualine_b = { "branch", "diff", "diagnostics" }, - lualine_c = { "lsp_progress" }, - lualine_x = { "filesize", "filetype" }, - lualine_y = { "progress" }, - lualine_z = { "location", "mode" }, - }, -}) diff --git a/plugins/theme/tabby-nvim.lua b/plugins/theme/tabby-nvim.lua deleted file mode 100644 index 6599f81..0000000 --- a/plugins/theme/tabby-nvim.lua +++ /dev/null @@ -1,5 +0,0 @@ --- always display tabline --- vim.o.showtabline = 2 - --- See: https://github.com/nanozuki/tabby.nvim -require("tabby.tabline").use_preset("tab_only") diff --git a/plugins/ux/default.nix b/plugins/ux/default.nix deleted file mode 100644 index 1c45390..0000000 --- a/plugins/ux/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ hop-nvim, ... }: - -{ - luaConfig = builtins.readFile ./hop-nvim.lua; - - plugins = [ hop-nvim ]; -} diff --git a/plugins/ux/hop-nvim.lua b/plugins/ux/hop-nvim.lua deleted file mode 100644 index 45b10b4..0000000 --- a/plugins/ux/hop-nvim.lua +++ /dev/null @@ -1,41 +0,0 @@ --- See: https://github.com/phaazon/hop.nvim/wiki/Configuration -local hop = require("hop") -require("hop").setup({}) - -------------------------------------------------------------------------------- --- Keybindings - -local hint = require("hop.hint") - -vim.keymap.set("", "hf", function() - hop.hint_char1({ - direction = hint.HintDirection.AFTER_CURSOR, - current_line_only = true, - }) -end) -vim.keymap.set("", "hF", function() - hop.hint_char1({ - direction = hint.HintDirection.BEFORE_CURSOR, - current_line_only = true, - }) -end) -vim.keymap.set("", "ht", function() - hop.hint_char1({ - direction = hint.HintDirection.AFTER_CURSOR, - current_line_only = true, - hint_offset = -1, - }) -end) -vim.keymap.set("", "hT", function() - hop.hint_char1({ - direction = hint.HintDirection.BEFORE_CURSOR, - current_line_only = true, - hint_offset = 1, - }) -end) - -vim.keymap.set("", "hc", "HopChar1") -vim.keymap.set("", "hw", "HopWord") -vim.keymap.set("", "hp", "HopPattern") -vim.keymap.set("", "hl", "HopLine") -vim.keymap.set("", "hv", "HopVertical")