Giter Club home page Giter Club logo

telescope-vimwiki.nvim's Introduction

telescope-vimwiki.nvim

Look for your vimwiki pages using telescope!

Requirements:

Installation and Configuration

  1. Install using your favorite plug-in manager (e.g. packer, vim-plug, etc.)

  2. Configure telescope

  3. Load extension:

require('telescope').load_extension('vimwiki')

or use vw alias:

require('telescope').load_extension('vw')

If you load as vw, you should use vw in the commands below.

Usage

List vimwiki pages for default (0-th) vimwiki:

:Telescope vimwiki

or use the vw alias:

:Telescope vw

You can specify a different vimwiki via index or i for short

:Telescope vw index=1 or :Telescope vw i=1

Use telescope live grep on your vimwiki files:

:Telescope vw live_grep

Also supports specifying a different vimwiki:

:Telescope vw live_grep i=1

Insert link in current cursor position:

:Telescope vw link

Keybindings

Seach vimwiki page filenames:

nnoremap <leader>vw <cmd>lua require('telescope').extensions.vimwiki.vimwiki()<cr>

or (if you're loading the extension using the vw extension)

nnoremap <leader>vw <cmd>lua require('telescope').extensions.vw.vw()<cr>

Live grep vimwiki files:

nnoremap <leader>vg <cmd>lua require('telescope').extensions.vw.live_grep()<cr>

TODO

  • Add way of configuring which vimwiki you want, currently just defaults to 0-th wiki.
  • Add support for vimwiki tags.

telescope-vimwiki.nvim's People

Contributors

elpiloto avatar salmanjnr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

telescope-vimwiki.nvim's Issues

Doc: Search/Find from current (local) Wiki

Hello. Thank you for your efforts.

I was trying to figure out a way to (live_grep) search the current (local) wiki recently via which-key.nvim shortcuts and came up with this. I'm adding the information here in case anyone else is interested or has a better way of coding my solution. For instance, <leader>wg will search/grep the wiki of the current buffer.

I've also included my methods for performing Search/Find on specific wikis:

  • via 'count': (i.e. 2<leader>wG would bring up the search/grep telescope for the 'dev-ecosystem' wiki in this example)
    • the count method index is adjusted for continuity
  • via which-key menu

Hope this is helpful / useful...

-- which-key.lua config file

local mappings_normal = {
  ["<leader>"] = {
    w = {
      name = "+VimWiki",
      -- Find / Search current (local) wiki
      ---- count method
      F = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki( {index=vim.v.count-1} )<cr>", "[#] Find File" },
      G = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep( {index=vim.v.count-1} )<cr>", "[#] Search" },
      ---- local method
      f = { "<cmd>let g:current_vimwiki_index=vimwiki#vars#get_bufferlocal(\'wiki_nr\')\"<cr> \z
              >> <cmd>lua require'telescope'.extensions.vimwiki.vimwiki( {index=vim.g.current_vimwiki_index} )<cr>", "FIND FILE" },
      g = { "<cmd>let g:current_vimwiki_index=vimwiki#vars#get_bufferlocal('wiki_nr')\"<cr> \z
              >> <cmd>lua require'telescope'.extensions.vimwiki.live_grep( {index=vim.g.current_vimwiki_index} )<cr>", "Search Wiki" },
      T = {
        -- TODO: Find a way to automate this
        name = "+Telescope",
        f = {
          name = "+Find-In",
          a = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=0})<cr>", "Personal" },
          b = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=1})<cr>", "dev-ecosystem" },
          c = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=2})<cr>", "Articles" },
          d = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=3})<cr>", "R-Systems" },
          e = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=4})<cr>", "Kisswip_wiki" },
          f = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=5})<cr>", "Screeps" },
          g = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=6})<cr>", "sucrdluks" },
          h = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=7})<cr>", "Vimwiki-Gollum" },
          i = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=8})<cr>", "Books/INDEX" },
          j = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=9})<cr>", "Books/LapDevEcco" },
          k = { "<cmd>lua require'telescope'.extensions.vimwiki.vimwiki({index=10})<cr>", "Books/Testing" },
        },
        g = {
          name = "+Search-In",
          a = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=0})<cr>", "Personal" },
          b = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=1})<cr>", "dev-ecosystem" },
          c = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=2})<cr>", "Articles" },
          d = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=3})<cr>", "R-Systems" },
          e = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=4})<cr>", "Kisswip_wiki" },
          f = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=5})<cr>", "Screeps" },
          g = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=6})<cr>", "sucrdluks" },
          h = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=7})<cr>", "Vimwiki-Gollum" },
          i = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=8})<cr>", "Books/INDEX" },
          j = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=9})<cr>", "Books/LapDevEcco" },
          k = { "<cmd>lua require'telescope'.extensions.vimwiki.live_grep({index=10})<cr>", "Books/Testing" },
        },
      },
    },
  },
}
-- register the map(s)
opts_default.mode = "n"
require("which-key").register(mappings_normal, opts_default)

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.