diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index 94f06b8..90e6eb8 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -1,20 +1,22 @@ local M = {} function M.setup() + -- Other unconfigured plugins + require('nvim-autopairs').setup() + require("startup").setup({theme = "dashboard"}) + require('lualine').setup({theme = "github"}) + + -- Plugins with their own configs: require("my.plugins.cmp").setup() require("my.plugins.lspconfig").setup() + require("my.plugins.null-ls").setup() -- require("my.plugins.fzf-lua").setup() - require("my.plugins.telescope").setup() require("my.plugins.treesitter").setup() require("my.plugins.comment").setup() -- require("my.plugins.nerdtree").setup() require("my.plugins.nvim-tree").setup() require("my.plugins.vimtex").setup() - - -- Other unconfigured plugins - require('nvim-autopairs').setup() - require("startup").setup({theme = "dashboard"}) - require('lualine').setup({theme = "github"}) + require("my.plugins.telescope").setup() end return M diff --git a/dotfiles/neovim/lua/my/plugins/null-ls.lua b/dotfiles/neovim/lua/my/plugins/null-ls.lua new file mode 100644 index 0000000..3aba241 --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/null-ls.lua @@ -0,0 +1,7 @@ +local M = {} + +function M.setup() + -- Setup goes here +end + +return M diff --git a/dotfiles/neovim/lua/my/plugins/telescope.lua b/dotfiles/neovim/lua/my/plugins/telescope.lua index 0569629..6550fe9 100644 --- a/dotfiles/neovim/lua/my/plugins/telescope.lua +++ b/dotfiles/neovim/lua/my/plugins/telescope.lua @@ -3,34 +3,59 @@ local mapSilent = require("my.keymaps").mapSilent local M = {} local bindings = { - -- Open files with control + P - find_files = "", + builtin = { + -- Open files with control + P + find_files = "", - -- Search through files with control + F - live_grep = "", + -- Search through files with control + F + live_grep = "", - -- See diagnostics with space + d - lsp_document_diagnostics = "d", - lsp_workspace_diagnostics = "wd", + -- See diagnostics with space + d + lsp_document_diagnostics = "d", + lsp_workspace_diagnostics = "wd", - -- Open a list with all the pickers - builtin = "t", + -- Open a list with all the pickers + builtin = "t", - -- List function, var names etc - treesitter = "s", + -- List function, var names etc + treesitter = "s", - -- Git stuff - git_commits = "gj", - git_branches = "gk" + -- Git stuff + git_commits = "gj", + git_branches = "gk" + }, + ["extensions.file_browser.file_browser"] = "p" } -function M.setup() - for action, keybind in pairs(bindings) do - -- Maps the keybind to the action - mapSilent('n', keybind, "lua require('telescope.builtin')." .. action .. "()") +local function setupKeybinds(obj, path) + if path == nil then path = "" end + for name, keybinds in pairs(obj) do + if (type(keybinds) == "table") then + -- This means we found a table of keybinds, so we go deeper + setupKeybinds(keybinds, path .. "." .. name) + else + -- Maps the keybind to the action + mapSilent('n', keybinds, "lua require('telescope" .. path .. "')." .. name .. "()") + end end +end - require("telescope").setup {defaults = {mappings = {i = {[""] = "which_key"}}}} +function M.setup() + setupKeybinds(bindings) + + local settings = { + defaults = {mappings = {i = {[""] = "which_key"}}}, + extensions = { + file_browser = { + mappings = { + -- Comment so this does not get collapsed + } + } + } + } + + require("telescope").setup(settings) + require("telescope").load_extension "file_browser" end return M diff --git a/flake.lock b/flake.lock index 364e64b..7dbcec8 100644 --- a/flake.lock +++ b/flake.lock @@ -133,11 +133,11 @@ ] }, "locked": { - "lastModified": 1645244400, - "narHash": "sha256-o7KCd6ySFZ9/LbS62aTeuFmBWtP7Tt3Q3RcNjYgTgZU=", + "lastModified": 1645479152, + "narHash": "sha256-8au2xAPSi3yGQBaVrYUpMY30lY9tMuNn7UMAHL7NJtw=", "owner": "nix-community", "repo": "home-manager", - "rev": "0232fe1b75e6d7864fd82b5c72f6646f87838fc3", + "rev": "69536af27e86a9fc875d71cb9566ccccf47b5b60", "type": "github" }, "original": { @@ -156,11 +156,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1645311555, - "narHash": "sha256-Va2UQFMSBYDuUbYOVKEPQj1PV1RxBHbhv0WTJTHqDvE=", + "lastModified": 1645480882, + "narHash": "sha256-EHXbr96JiprqxiVQy1NnrCmYB0+HK1EAdWdXQiZ03Cw=", "owner": "neovim", "repo": "neovim", - "rev": "8b3799e2c33282bf417ddee15ae71b5aba613c16", + "rev": "30c9c8815b531e0130ebeb9358bc6d3947a6128a", "type": "github" }, "original": { @@ -179,11 +179,11 @@ ] }, "locked": { - "lastModified": 1645344796, - "narHash": "sha256-sUaJA5Q6glKRfB2WOcMFi1wOcUQthXRGVego9eetGTk=", + "lastModified": 1645517666, + "narHash": "sha256-DeQmb7GXKScYKPVXASBlgaARdXO4B9u6um32UPnFIZo=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "957f8d1c54d81031ea2422b97e2bd9518661f78c", + "rev": "f6ce5a9aec32a336cf7045b380a50a42583acd3a", "type": "github" }, "original": { @@ -194,11 +194,11 @@ }, "nixos-unstable": { "locked": { - "lastModified": 1644613700, - "narHash": "sha256-wLRPJclMH8vsHuFtyI78aF09lw5mbi3lMB6uiK5S2wE=", + "lastModified": 1645433236, + "narHash": "sha256-4va4MvJ076XyPp5h8sm5eMQvCrJ6yZAbBmyw95dGyw4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "23d785aa6f853e6cf3430119811c334025bbef55", + "rev": "7f9b6e2babf232412682c09e57ed666d8f84ac2d", "type": "github" }, "original": { @@ -210,11 +210,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1645355333, - "narHash": "sha256-T6x1HPxTZCS2oXlbeh7YSqivkuDdP3Rfxq7zW7el3UM=", + "lastModified": 1645488570, + "narHash": "sha256-29Fvczhd20K3ol0wbQrFlsUiYUDoGnpOR2XJTdrRnZA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "cc244a8ef1a6b116e5254d838fdf28a37c370b48", + "rev": "491ad20776074706da6befe0cb8334f2df23fc00", "type": "github" }, "original": { @@ -226,11 +226,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1645013224, - "narHash": "sha256-b7OEC8vwzJv3rsz9pwnTX2LQDkeOWz2DbKypkVvNHXc=", + "lastModified": 1645493675, + "narHash": "sha256-9xundbZQbhFodsQRh6QMN1GeSXfo3y/5NL0CZcJULz0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b66b39216b1fef2d8c33cc7a5c72d8da80b79970", + "rev": "74b10859829153d5c5d50f7c77b86763759e8654", "type": "github" }, "original": { @@ -267,10 +267,27 @@ "nixos-unstable": "nixos-unstable", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", + "telescope-file-browser-nvim": "telescope-file-browser-nvim", "vim-extra-plugins": "vim-extra-plugins", "z": "z" } }, + "telescope-file-browser-nvim": { + "flake": false, + "locked": { + "lastModified": 1645182018, + "narHash": "sha256-MFKjdmO0KnZWodUeaXrJExM+j6kplDl9HzHwNfJabOc=", + "owner": "nvim-telescope", + "repo": "telescope-file-browser.nvim", + "rev": "d06fe1d4ade68ba17739025e55e941f9e977d37c", + "type": "github" + }, + "original": { + "owner": "nvim-telescope", + "repo": "telescope-file-browser.nvim", + "type": "github" + } + }, "vim-extra-plugins": { "inputs": { "flake-compat": "flake-compat_2", @@ -278,11 +295,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1645107880, - "narHash": "sha256-KuZkokcjhK1PRvIiU2aWszozx3fPOJ3shR7rlUaVraQ=", + "lastModified": 1645366942, + "narHash": "sha256-2jIT/nz+gelrLI6TcPlT5Awm0Hr/HsozMvOn6lMzp1o=", "owner": "m15a", "repo": "nixpkgs-vim-extra-plugins", - "rev": "4dfa3d3ec4a1b74958e7e62c0ebff918fb084a39", + "rev": "6a77da622616f01e9b4a4504fa4ce86acc42ac4b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 9045ba5..492c64d 100644 --- a/flake.nix +++ b/flake.nix @@ -9,25 +9,41 @@ home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; - easy-dhall-nix.url = "github:justinwoo/easy-dhall-nix"; - easy-dhall-nix.flake = false; - - easy-purescript-nix.url = "github:justinwoo/easy-purescript-nix"; - easy-purescript-nix.flake = false; - - z.url = "github:jethrokuan/z"; - z.flake = false; - - agnoster.url = "github:oh-my-fish/theme-agnoster"; - agnoster.flake = false; - - githubNvimTheme.url = "github:projekt0n/github-nvim-theme"; - githubNvimTheme.flake = false; - neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs"; vim-extra-plugins.url = "github:m15a/nixpkgs-vim-extra-plugins"; + + # Git repo fetching + telescope-file-browser-nvim = { + url = "github:nvim-telescope/telescope-file-browser.nvim"; + flake = false; + }; + + easy-dhall-nix = { + url = "github:justinwoo/easy-dhall-nix"; + flake = false; + }; + + easy-purescript-nix = { + url = "github:justinwoo/easy-purescript-nix"; + flake = false; + }; + + z = { + url = "github:jethrokuan/z"; + flake = false; + }; + + agnoster = { + url = "github:oh-my-fish/theme-agnoster"; + flake = false; + }; + + githubNvimTheme = { + url = "github:projekt0n/github-nvim-theme"; + flake = false; + }; }; outputs = inputs@{ self, nixpkgs, home-manager, ... }: @@ -44,8 +60,8 @@ provideInputs ]; }; - in { - + in + { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { inherit system; diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index 8c83afa..70a6a20 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -37,7 +37,7 @@ in ]; plugins = with pkgs.vimPlugins; - with pkgs.vimExtraPlugins; [ + with pkgs.vimExtraPlugins; with pkgs.myVimPlugins; [ config-nvim # my neovim config github-nvim-theme # github theme for neovim nvim-lspconfig # configures lsps for me @@ -53,7 +53,8 @@ in lualine-nvim # customizable status line nvim-tree-lua # file tree vimtex # latex plugin - + null-ls-nvim # generic language server + telescope-file-browser-nvim # file creation/deletion using telescope # Cmp related stuff. See https://github.com/hrsh7th/nvim-cmp cmp-nvim-lsp diff --git a/modules/applications/shells/aliases.nix b/modules/applications/shells/aliases.nix index a76d86f..6433d58 100644 --- a/modules/applications/shells/aliases.nix +++ b/modules/applications/shells/aliases.nix @@ -1,5 +1,5 @@ { - ls = "exa -l"; + ls = "exa -la"; sl = "sl -e"; # WIfi stuff diff --git a/modules/applications/shells/sessionVariables.nix b/modules/applications/shells/sessionVariables.nix index 0c617fe..c511c5a 100644 --- a/modules/applications/shells/sessionVariables.nix +++ b/modules/applications/shells/sessionVariables.nix @@ -2,7 +2,14 @@ with import ../../../secrets.nix; let variables = { + # Configure github cli GITHUB_USERNAME = "Mateiadrielrafael"; inherit GITHUB_TOKEN; + + # Sets neovim as default editor + EDITOR = "nvim"; }; -in { home-manager.users.adrielus = { home.sessionVariables = variables; }; } +in +{ + home-manager.users.adrielus = { home.sessionVariables = variables; }; +} diff --git a/modules/overlays/flakes.nix b/modules/overlays/flakes.nix index 14f4d8d..519d474 100644 --- a/modules/overlays/flakes.nix +++ b/modules/overlays/flakes.nix @@ -1,7 +1,24 @@ { system }: -{ home-manager, nixpkgs, nixpkgs-unstable, nixos-unstable, easy-purescript-nix -, easy-dhall-nix, z, agnoster, githubNvimTheme, vim-extra-plugins, ... }: -(self: super: { +{ home-manager +, nixpkgs +, nixpkgs-unstable +, nixos-unstable +, easy-purescript-nix +, easy-dhall-nix +, z +, agnoster +, githubNvimTheme +, vim-extra-plugins +, telescope-file-browser-nvim +, ... +}: self: super: +# installs a vim plugin from git with a given tag / branch +let plugin = name: src: self.vimUtils.buildVimPluginFrom2Nix { + inherit name; + inherit src; +}; +in +{ unstable = import nixpkgs-unstable { inherit system; config.allowUnfree = true; @@ -22,4 +39,10 @@ }; githubNvimTheme = githubNvimTheme; -}) + + # Vim plugins + myVimPlugins = { + telescope-file-browser-nvim = + plugin "file_browser" telescope-file-browser-nvim; + }; +} diff --git a/prettierd b/prettierd deleted file mode 100644 index a04db0b..0000000 --- a/prettierd +++ /dev/null @@ -1 +0,0 @@ -const a = 3