Code Monkey home page Code Monkey logo

telescope-project.nvim's Introduction

telescope-project.nvim

An extension for telescope.nvim that allows you to switch between projects.

Demo

Demo

Requirements

Setup

You can setup the extension by adding the following to your config:

require'telescope'.load_extension('project')

You may skip explicitly loading extensions (they will then be lazy-loaded), but tab completions will not be available right away.

Available functions:

Project

The projects picker:

require'telescope'.extensions.project.project{}

Default mappings (normal mode):

Key Description
d delete currently selected project
r rename currently selected project
c create a project*
s search inside files within your project
b browse inside files within your project
w change to the selected project's directory without opening it
R find a recently opened file within your project
f find a file within your project (same as <CR>)
o change current cd scope

Default mappings (insert mode):

Key Description
<c-d> delete currently selected project
<c-v> rename currently selected project
<c-a> create a project*
<c-s> search inside files within your project
<c-b> browse inside files within your project
<c-l> change to the selected project's directory without opening it
<c-r> find a recently opened file within your project
<c-f> find a file within your project (same as <CR>)
<c-o> change current cd scope

* defaults to your git root if used inside a git project, otherwise, it will use your current working directory

Workspace mappings (insert mode):

Key Description
<c-w> change workspace

Example key map config:

vim.api.nvim_set_keymap(
        'n',
        '<C-p>',
        ":lua require'telescope'.extensions.project.project{}<CR>",
        {noremap = true, silent = true}
)

Available options:

Keys Description Options
display_type Show the title and the path of the project 'full' or 'minimal' (default)

Options can be added when requiring telescope-project, as shown below:

lua require'telescope'.extensions.project.project{ display_type = 'full' }

Available setup settings:

Keys Description Options
base_dirs Array of project base directory configurations table (default: nil)
hidden_files Show hidden files in selected project bool (default: false)
order_by Order projects by asc, desc, recent string (default: recent)
sync_with_nvim_tree Sync projects with nvim tree plugin bool (default: false)
search_by Telescope finder search by field (title/path) string or table (default: title). Can also be a table {"title", "path"} to search by both title and path
on_project_selected Custom handler when project is selected function(prompt_bufnr) (default: find project files)
cd_scope Array of cd scopes: tab, window, global table (default: {"tab", "window"})
Setup settings can be added when requiring telescope, as shown below:
require('telescope').setup {
  local project_actions = require("telescope._extensions.project.actions")
  extensions = {
    project = {
      base_dirs = {
        '~/dev/src',
        {'~/dev/src2'},
        {'~/dev/src3', max_depth = 4},
        {path = '~/dev/src4'},
        {path = '~/dev/src5', max_depth = 2},
      },
      hidden_files = true, -- default: false
      theme = "dropdown",
      order_by = "asc",
      search_by = "title",
      sync_with_nvim_tree = true, -- default false
      -- default for on_project_selected = find project files
      on_project_selected = function(prompt_bufnr)
        -- Do anything you want in here. For example:
        project_actions.change_working_directory(prompt_bufnr, false)
        require("harpoon.ui").nav_file(1)
      end
    }
  }
}

Roadmap ๐Ÿš™

  • order projects by last opened โœ”๏ธ
  • add all (git-enabled) subdirectories automatically โœ”๏ธ
  • workspaces ๐Ÿšง

telescope-project.nvim's People

Contributors

adelarsq avatar alvarosevilla95 avatar angkeith avatar antoscencovladimir avatar bekaboo avatar claidler avatar conni2461 avatar dhananjaylatkar avatar dzfrias avatar gplusplus314 avatar harrygallagher4 avatar ieverx avatar ikerurda avatar jens1205 avatar l-kershaw avatar l4zygreed avatar lijinglin3 avatar logan-connolly avatar lytex avatar matu3ba avatar narodo avatar oskarskog avatar thorlucas avatar tiagovla avatar tonywu20 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.