Skip to content

Commit

Permalink
feat(nvim): add projects
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Jun 4, 2024
1 parent 5cf8f2d commit df79805
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nvim-fredrik/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"ChatGPT.nvim": { "branch": "main", "commit": "df53728e05129278d6ea26271ec086aa013bed90" },
"CopilotChat.nvim": { "branch": "canary", "commit": "60f53cff55e775645cb74b7c11228da9a80e42d6" },
"FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "878ace11983444d865a72e1759dbcc331d1ace4c" },
Expand All @@ -15,6 +16,7 @@
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" },
"conform.nvim": { "branch": "master", "commit": "f3b930db4964d60e255c8f9e37b7f2218dfc08cb" },
"copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" },
"crates.nvim": { "branch": "main", "commit": "8437522d12a8c523da2aee9db2979d070b2ecc33" },
"diffview.nvim": { "branch": "main", "commit": "3afa6a053f680e9f1329c4a151db988a482306cd" },
"dressing.nvim": { "branch": "master", "commit": "3c38ac861e1b8d4077ff46a779cde17330b29f3a" },
Expand Down Expand Up @@ -62,6 +64,7 @@
"obsidian.nvim": { "branch": "main", "commit": "db41b1f20459293436fab510bec58c82a73bd1f7" },
"persistence.nvim": { "branch": "main", "commit": "5fe077056c821aab41f87650bd6e1c48cd7dd047" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"promise-async": { "branch": "main", "commit": "93540c168c5ed2b030ec3e6c40ab8bbb85e36355" },
"rest.nvim": { "branch": "main", "commit": "f96edb54a2940322bc7ed81a1031be04db7d3a99" },
"rustaceanvim": { "branch": "master", "commit": "2fa45427c01ded4d3ecca72e357f8a60fd8e46d4" },
Expand Down
4 changes: 4 additions & 0 deletions nvim-fredrik/lua/config/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ end
function M.setup_telescope_keymaps()
map_normal_mode("<leader><leader>", require("telescope.builtin").find_files, "Find Files")

-- file
map_normal_mode("<leader>fp", "<cmd>Telescope projects<CR>", "File from other project")
map_normal_mode("<leader>fr", "<cmd>Telescope oldfiles<CR>", "Recent files")

-- git
map_normal_mode("<leader>sc", "<cmd>Telescope git_commits<CR>", "[s]earch git [c]ommits")
map_normal_mode("<leader>sg", "<cmd>Telescope git_status<CR>", "[s]earch git changes")
Expand Down
50 changes: 50 additions & 0 deletions nvim-fredrik/lua/plugins/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,55 @@ return {
"nvim-telescope/telescope-live-grep-args.nvim",
},
{ "smartpde/telescope-recent-files" },
{
"ahmedkhalf/project.nvim",
opts = {
{
-- Manual mode doesn't automatically change your root directory, so you have
-- the option to manually do so using `:ProjectRoot` command.
manual_mode = true,

-- Methods of detecting the root directory. **"lsp"** uses the native neovim
-- lsp, while **"pattern"** uses vim-rooter like glob pattern matching. Here
-- order matters: if one is not detected, the other is used as fallback. You
-- can also delete or rearangne the detection methods.
detection_methods = { "lsp", "pattern" },

-- All the patterns used to detect root dir, when **"pattern"** is in
-- detection_methods
patterns = { ".git" },

-- Table of lsp clients to ignore by name
-- eg: { "efm", ... }
ignore_lsp = {},

-- Don't calculate root dir on specific directories
-- Ex: { "~/.cargo/*", ... }
exclude_dirs = {},

-- Show hidden files in telescope
show_hidden = true,

-- When set to false, you will get a message when project.nvim changes your
-- directory.
silent_chdir = false,

-- What scope to change the directory, valid options are
-- * global (default)
-- * tab
-- * win
scope_chdir = "win",

-- Path where project.nvim will store the project history for use in
-- telescope
datapath = vim.fn.stdpath("data"),
},
},
event = "VeryLazy",
config = function(_, opts)
require("project_nvim").setup(opts)
end,
},
{ "rcarriga/nvim-notify" },
{ "folke/trouble.nvim" }, -- for trouble.sources.telescope
},
Expand Down Expand Up @@ -68,6 +117,7 @@ return {
telescope.load_extension("live_grep_args")
telescope.load_extension("ui-select")
telescope.load_extension("recent_files")
telescope.load_extension("projects")
telescope.load_extension("notify")

require("config.keymaps").setup_telescope_keymaps()
Expand Down

0 comments on commit df79805

Please sign in to comment.