1
Fork 0

feat: telescope file browser

This commit is contained in:
Matei Adriel 2022-02-22 22:52:01 +02:00
parent 577a19cf27
commit 1e499dccba
10 changed files with 169 additions and 72 deletions

View file

@ -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

View file

@ -0,0 +1,7 @@
local M = {}
function M.setup()
-- Setup goes here
end
return M

View file

@ -3,6 +3,7 @@ local mapSilent = require("my.keymaps").mapSilent
local M = {}
local bindings = {
builtin = {
-- Open files with control + P
find_files = "<c-P>",
@ -22,15 +23,39 @@ local bindings = {
-- Git stuff
git_commits = "<space>gj",
git_branches = "<space>gk"
},
["extensions.file_browser.file_browser"] = "<space>p"
}
function M.setup()
for action, keybind in pairs(bindings) do
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', keybind, "<cmd>lua require('telescope.builtin')." .. action .. "()<CR>")
mapSilent('n', keybinds, "<cmd>lua require('telescope" .. path .. "')." .. name .. "()<CR>")
end
end
end
require("telescope").setup {defaults = {mappings = {i = {["<C-h>"] = "which_key"}}}}
function M.setup()
setupKeybinds(bindings)
local settings = {
defaults = {mappings = {i = {["<C-h>"] = "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

View file

@ -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": {

View file

@ -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;

View file

@ -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

View file

@ -1,5 +1,5 @@
{
ls = "exa -l";
ls = "exa -la";
sl = "sl -e";
# WIfi stuff

View file

@ -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; };
}

View file

@ -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;
};
}

View file

@ -1 +0,0 @@
const a = 3