Git Product home page Git Product logo

telescope-changed-files's People

Contributors

axkirillov avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

freestingo

telescope-changed-files's Issues

Change theme

Not really an issue, just wanted to share it in case someone is trying to set it up

If you want to change a theme, do something like this:

vim.keymap.set('n', '<leader>cc', function () extensions.changed_files.changed_files(themes.get_ivy({})) end, {})

File appears blank on second use

Hi! First off, thank you so much for creating this! It is exactly what I was looking for and it is very useful.

Issue:
The second file I try and open with telescope-changed-files will be blank. If I use telescope-changed-files to open a file it will work perfect but the second time, and subsequent times thereafter, when I open a file it will be blank even if it is the same as the first file I open.

Example:
I have set telescope-changed-files to <space>., when I hit that the following modal appears as normal
image

If I select home.page.ts it opens the file as normal
image

I then go to select another file with telescope-changed-files by repeating the shortcut and it works as normal
image

however when I select home.page.ts again it shows this
image

if I close that file and attempt to open a different one the same thing occurs
image

I will continue to trouble shoot, I don't quite remember but I thought that I had it working yesterday.

here is my neovim config using lunarvim

--[[
lvim is the global options object

Linters should be
filled in as strings with either
a global executable or a path to
an executable
]]
-- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT

-- general
lvim.log.level = "warn"
lvim.format_on_save = true
lvim.colorscheme = "tokyonight"
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true

-- to disable icons and use a minimalist setup, uncomment the following
-- lvim.use_icons = false

-- keymappings [view all the defaults by pressing <leader>Lk]
lvim.leader = "space"
-- add your own keymapping
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
lvim.keys.normal_mode["qh"] = "<C-w>h"
lvim.keys.normal_mode["ql"] = "<C-w>l"
lvim.keys.normal_mode["qj"] = "<C-w>j"
lvim.keys.normal_mode["qk"] = "<C-w>k"
vim.g.copilot_no_tab_map = true
vim.api.nvim_set_keymap("i", "<C-F>", 'copilot#Accept("<CR>")', { silent = true, expr = true })
vim.keymap.set({ "n", "x" }, "p", "<Plug>(YankyPutAfter)")
vim.keymap.set({ "n", "x" }, "P", "<Plug>(YankyPutBefore)")
vim.keymap.set({ "n", "x" }, "qp", "<Plug>(YankyGPutAfter)")
vim.keymap.set({ "n", "x" }, "qP", "<Plug>(YankyGPutBefore)")
vim.keymap.set("n", "<c-n>", "<Plug>(YankyCycleForward)")
vim.keymap.set("n", "<c-p>", "<Plug>(YankyCycleBackward)")

-- unmap a default keymapping
-- vim.keymap.del("n", "<C-Up>")
-- override a default keymapping
-- lvim.keys.normal_mode["<C-q>"] = ":q<cr>" -- or vim.keymap.set("n", "<C-q>", ":q<cr>" )

-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
-- local _, actions = pcall(require, "telescope.actions")
-- lvim.builtin.telescope.defaults.mappings = {
--   -- for input mode
--   i = {
--     ["<C-j>"] = actions.move_selection_next,
--     ["<C-k>"] = actions.move_selection_previous,
--     ["<C-n>"] = actions.cycle_history_next,
--     ["<C-p>"] = actions.cycle_history_prev,
--   },
--   -- for normal mode
--   n = {
--     ["<C-j>"] = actions.move_selection_next,
--     ["<C-k>"] = actions.move_selection_previous,
--   },
-- }
lvim.builtin.telescope.defaults.path_display = function(opts, path)
  local tail = require("telescope.utils").path_tail(path)
  return string.format("%s (%s)", tail, path)
end

lvim.builtin.telescope.on_config_done = function(telescope)
  pcall(telescope.load_extension, "octo")
  pcall(telescope.load_extension, "luasnip")
  pcall(telescope.load_extension, "yank_history")
  pcall(telescope.load_extension, "session-lens")
  pcall(telescope.load_extension, "live-grep-args")
  pcall(telescope.load_extension, "changed_files")
end

-- Use which-key to add extra bindings with the leader-key prefix
lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
lvim.builtin.which_key.mappings["t"] = {
  name = "+Trouble",
  r = { "<cmd>Trouble lsp_references<cr>", "References" },
  f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
  d = { "<cmd>Trouble document_diagnostics<cr>", "Diagnostics" },
  q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
  l = { "<cmd>Trouble loclist<cr>", "LocationList" },
  w = { "<cmd>Trouble workspace_diagnostics<cr>", "Wordspace Diagnostics" },
}
-- lvim.builtin.which_key.mappings["S"] = {
--   name = "Session",
--   c = { "<cmd>lua require('persistence').load()<cr>", "Restore last session for current dir" },
--   l = { "<cmd>lua require('persistence').load({ last = true })<cr>", "Restore last session" },
--   Q = { "<cmd>lua require('persistence').stop()<cr>", "Quit without saving session" },
-- }
lvim.builtin.which_key.mappings["o"] = { "<cmd>NvimTreeFindFile<cr>", "Open Explorer and Find File" }
lvim.builtin.which_key.mappings["v"] = { "<cmd>vsplit<cr>", "vsplit" }
lvim.builtin.which_key.mappings["m"] = {
  name = "Harpoon",
  a = { "<cmd>lua require('harpoon.mark').add_file()<cr>", "mark file" },
  m = { "<cmd>lua require('harpoon.ui').toggle_quick_menu()<cr>", "open marked file menu" },
  i = { "<cmd>lua require('harpoon.ui').nav_next()<cr>", "cycle next marked file" },
  o = { "<cmd>lua require('harpoon.ui').nav_prev()<cr>", "cycle previous marked file" },
}

lvim.builtin.which_key.mappings["G"] = {
  name = "github",
  p = {
    name = "pr",
    s = {
      a = { "<cmd>Octo pr search<cr>", "Search all PRs" },
      m = { "<cmd>Octo search is:pr is:open author:@me<cr>", "Search my PRs" },
      r = { "<cmd>Octo search is:pr is:open user-review-requested:@me<cr>", "Search PRs I need to review" }
    },
    b = { "<cmd>Octo pr browser<cr>", "Open current PR in the browser" },
    r = { "<cmd>Octo pr reload<cr>", "Reload PR" },
    u = { "<cmd>Octo pr url<cr>", "Copies the URL of the current PR to the system clipboard" },
    l = { "<cmd>Octo pr list breeze-front-end<cr>", "List all Breeze PRs" },
    c = { "<cmd>Octo pr create<cr>", "Creates a new PR for the current branch" },
    x = { "<cmd>Octo pr close<cr>", "Close the current PR" },
    w = { "<cmd>Octo pr checkout<cr>", "Checkout PR" },
    t = { "<cmd>Octo pr commits<cr>", "List all PR commits" },
    h = { "<cmd>Octo pr changes<cr>", "Show all PR changes (diff hunks)" },
    a = { "<cmd>Octo pr checks<cr>", "Show the status of all checks run on the PR" },
    d = { "<cmd>Octo pr diff<cr>", "Show PR diff" },
    m = { "<cmd>Octo pr merge rebase<cr>", "Rebase PR" }
  },
  r = {
    name = "repo",
    l = { "<cmd>Octo repo list<cr>", "List repos user owns, contributes or belong to" },
    b = { "<cmd>Octo repo browser<cr>", "Open current repo in the browser" },
    u = { "<cmd>Octo repo url<cr>", "Copies the URL of the current repo to the system clipboard" }
  },
  c = {
    name = "comment",
    a = { "<cmd>Octo comment add<cr>", "Add a new comment" },
    d = { "<cmd>Octo comment delete<cr>", "Add a new comment" }
  },
  t = {
    name = "thread",
    r = { "<cmd>Octo thread resolve<cr>", "Mark a review thread as resolved" },
    u = { "<cmd>Octo thread unresolve<cr>", "Mark a review thread as unresolved" }
  },
  l = {
    name = "label",
    a = { "<cmd>Octo label add<cr>", "Add a label from available label menu" },
    r = { "<cmd>Octo label remove<cr>", "Remove a label" },
    c = { "<cmd>Octo label create<cr>", "Create a new label" }
  },
  v = {
    name = "review",
    n = { "<cmd>Octo review start<cr>", "Start a new review" },
    w = { "<cmd>Octo review submit<cr>", "Submit the review" },
    r = { "<cmd>Octo review resume<cr>", "Edit a pending review for current PR" },
    d = { "<cmd>Octo review discard<cr>", "Deletes a pending review for current PR if any" },
    c = { "<cmd>Octo review comments<cr>", "Deletes a pending review for current PR if any" },
    f = { "<cmd>Octo review commit<cr>", "Pick a specific commit to review" },
  },
  a = { "<cmd>Octo actions<cr>", "Lists all available Octo actions" },
  s = { "<cmd>Octo search<cr>", "Search GitHub for issues and PRs matching the query" },
  m = { "<cmd>Octo search is:pr author:jcorum11 repo:github/breeze-front-end<cr>", "List my PRs" }
}
lvim.builtin.which_key.mappings["l"] = { "<cmd>Telescope luasnip<cr>", "luasnip" }
lvim.builtin.which_key.mappings["S"] = {
  name = "Session",
  s = { "<cmd>SearchSession<cr>", "Search session" },
  w = { "<cmd>SaveSession<cr>", "Save session" },
  r = { "<cmd>RestoreSession<cr>", "Restore session" },
  d = { "<cmd>DeleteSession<cr>", "Delete session" },
}
lvim.builtin.which_key.mappings["."] = { "<cmd>Telescope changed_files<cr>", "Changed files" }
-- lvim.builtin.which_key.mappings["fs"] = { "<cmd>FzfLua grep_project<cr>", "Rg" }
-- lvim.builtin.which_key.mappings["f"] = { "<cmd>FzfLua files<cr>", "find or fd on a path" }
-- lvim.builtin.which_key.mappings["z"] = {
--   name = "fzf",
--   -- buffers and files
--   f = { "<cmd>FzfLua files<cr>", "find or fd on a path" },
--   b = { "<cmd>FzfLua buffers<cr>", "open buffers" },
--   of = { "<cmd>FzfLua oldfiles<cr>", "opened files history" },
--   qf = { "<cmd>FzfLua quickfix<cr>", "quickfix list" },
--   ll = { "<cmd>FzfLua loclist<cr>", "location list" },
--   l = { "<cmd>FzfLua lines<cr>", "open buffer lines" },
--   bl = { "<cmd>FzfLua blines<cr>", "current buffer lines" },
--   t = { "<cmd>FzfLua tabs<cr>", "open tabs" },
--   a = { "<cmd>FzfLua args<cr>", "argument list" },
--   -- search
--   g = { "<cmd>FzfLua grep<cr>", "search for a pattern with grep or rg" },
--   fl = { "<cmd>FzfLua grep_last<cr>", "run search again for the last pattern" },
--   fc = { "<cmd>FzfLua grep_cword<cr>", "search word under cursor" },
--   fC = { "<cmd>FzfLua grep_cWORD<cr>", "search for WORD under cursor" },
--   fv = { "<cmd>FzfLua grep_visual<cr>", "search visual selection" },
--   fb = { "<cmd>FzfLua grep_curbuf<cr>", "search current buffer lines" },
--   -- tags
--   tg = { "<cmd>FzfLua tags<cr>", "search current project tags" },
--   bt = { "<cmd>FzfLua btags<cr>", "search current buffer tags" },
--   ts = { "<cmd>FzfLua tags_grep<cr>", "grep project tags" },
--   tc = { "<cmd>FzfLua tags_grep_cword<cr>", "grep project tags" }
-- }
-- lvim.builtin.which_key.mappings["v"] = { "<cmd>vsplit<cr>", "vsplit" }
-- lvim.builtin.which_key.mappings["y"] = { "<cmd>SymbolsOutline<cr>", "symbols outline" }

-- TODO: User Config for predefined plugins
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.alpha.active = true
lvim.builtin.alpha.mode = "dashboard"
lvim.builtin.notify.active = true
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false

-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = {
  "bash",
  "c",
  "javascript",
  "json",
  "lua",
  "python",
  "typescript",
  "tsx",
  "css",
  "rust",
  "java",
  "yaml",
}

lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enabled = true
lvim.builtin.lualine.options.theme = "tokyonight"

-- generic LSP settings

-- ---@usage disable automatic installation of servers
-- lvim.lsp.automatic_servers_installation = false

-- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!!
-- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))`
-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
-- local opts = {} -- check the lspconfig documentation for a list of all possible options
require("lvim.lsp.manager").setup("emmet_ls")
require("lvim.lsp.manager").setup("angularls")

-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
-- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype
vim.tbl_map(function(server)
  return server ~= "emmet_ls"
end, lvim.lsp.automatic_configuration.skipped_servers)

vim.tbl_map(function(server)
  return server ~= "emmet_ls"
end, lvim.lsp.automatic_configuration.skipped_servers)
-- -- you can set a custom on_attach function that will be used for all the language servers
-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
-- lvim.lsp.on_attach_callback = function(client, bufnr)
--   local function buf_set_option(...)
--     vim.api.nvim_buf_set_option(bufnr, ...)
--   end
--   --Enable completion triggered by <c-x><c-o>
--   buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- end

-- -- set a formatter, this will override the language server formatting capabilities (if it exists)
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup {
  { command = "black", filetypes = { "python" } },
  { command = "isort", filetypes = { "python" } },
  { command = "prettier" }
  -- {
  -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
  -- command = "prettier",
  ---@usage arguments to pass to the formatter
  -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
  -- extra_args = { "--print-with", "100" },
  -- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
  -- filetypes = { "typescript", "typescriptreact" },
  -- },
}

-- -- set additional linters
-- local linters = require "lvim.lsp.null-ls.linters"
-- linters.setup {
--   { command = "flake8", filetypes = { "python" } },
--   {
--     -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
--     command = "shellcheck",
--     ---@usage arguments to pass to the formatter
--     -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
--     extra_args = { "--severity", "warning" },
--   },
--   {
--     command = "codespell",
--     ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
--     filetypes = { "javascript", "python" },
--   },
-- }

-- Additional Plugins
lvim.plugins = {
  { "folke/tokyonight.nvim" },
  {
    "folke/trouble.nvim",
    cmd = "TroubleToggle",
  },
  { 'ThePrimeagen/harpoon' },
  -- {
  --   "folke/persistence.nvim",
  --   event = "BufReadPre", -- this will only start session saving when an actual file was opened
  --   module = "persistence",
  --   config = function()
  --     require("persistence").setup {
  --       dir = vim.fn.expand(vim.fn.stdpath "config" .. "/session/"),
  --       options = { "buffers", "curdir", "tabpages", "winsize" },
  --     }
  --   end,
  -- },
  -- { 'ibhagwan/fzf-lua', requires = { 'kyazdani42/nvim-web-devicons' } },
  {
    "andymass/vim-matchup",
    event = "CursorMoved",
    config = function()
      vim.g.matchup_matchparen_offscreen = { method = "popup" }
    end,
  },
  {
    "rmagatti/goto-preview",
    config = function()
      require('goto-preview').setup {
        width = 120; -- Width of the floating window
        height = 25; -- Height of the floating window
        default_mappings = true; -- Bind default mappings
        debug = false; -- Print debug information
        opacity = nil; -- 0-100 opacity level of the floating window where 100 is fully transparent.
        post_open_hook = nil -- A function taking two arguments, a buffer and a window to be ran as a hook.
        -- You can use "default_mappings = true" setup option
        -- Or explicitly set keybindings
        -- vim.cmd("nnoremap gpd <cmd>lua require('goto-preview').goto_preview_definition()<CR>")
        -- vim.cmd("nnoremap gpi <cmd>lua require('goto-preview').goto_preview_implementation()<CR>")
        -- vim.cmd("nnoremap gP <cmd>lua require('goto-preview').close_all_win()<CR>")
      }
    end
  },
  {
    "tpope/vim-surround",

    -- make sure to change the value of `timeoutlen` if it's not triggering correctly, see https://github.com/tpope/vim-surround/issues/117
    -- setup = function()
    --  vim.o.timeoutlen = 500
    -- end
  },
  {
    'ggandor/leap.nvim',
    config = function()
      require('leap').set_default_keymaps()
    end
  },
  {
    'pwntester/octo.nvim',
    requires = {
      'nvim-lua/plenary.nvim',
      'nvim-telescope/telescope.nvim',
      'kyazdani42/nvim-web-devicons',
    },
    config = function()
      require "octo".setup()
    end
  },
  {
    "benfowler/telescope-luasnip.nvim",
    module = "telescope._extensions.luasnip", -- if you wish to lazy-load
  },
  {
    "gbprod/yanky.nvim",
    config = function()
      require("yanky").setup({
        {
          ring = {
            history_length = 100,
            storage = "shada",
            sync_with_numbered_registers = true,
            cancel_event = "update",
          },
          system_clipboard = {
            sync_with_ring = true,
          },
        }
      })
    end
  },
  { 'kevinhwang91/nvim-bqf', ft = 'qf' },
  { 'junegunn/fzf', run = function()
    vim.fn['fzf#install']()
  end
  },
  {
    'booperlv/nvim-gomove',
    config = function()
      require 'gomove'.setup {
        -- whether or not to map default key bindings, (true/false)
        map_defaults = true,
        -- whether or not to reindent lines moved vertically (true/false)
        reindent = true,
        -- whether or not to undojoin same direction moves (true/false)
        undojoin = true,
        -- whether to not to move past end column when moving blocks horizontally, (true/false)
        move_past_end_col = false,
      }
    end
  },
  {
    'rmagatti/auto-session',
    config = function()
      require("auto-session").setup {
        log_level = "error",
        auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
      }
    end
  },
  {
    'rmagatti/session-lens',
    requires = { 'rmagatti/auto-session', 'nvim-telescope/telescope.nvim' },
    config = function()
      require('session-lens').setup({ --[[your custom config--]] })
    end
  },
  { 'kevinhwang91/promise-async' },
  { 'kevinhwang91/nvim-ufo',
    requires = 'kevinhwang91/promise-async',
    config = function()
      require('ufo').setup({
        provider_selector = function(bufnr, filetype, buftype)
          return { 'treesitter', 'indent' }
        end
      })
    end
  },
  { "lukas-reineke/indent-blankline.nvim" },
  { "axkirillov/telescope-changed-files" },
  { "mg979/vim-visual-multi" }
}
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)

-- Autocommands (https://neovim.io/doc/user/autocmd.html)
-- vim.api.nvim_create_autocmd("BufEnter", {
--   pattern = { "*.json", "*.jsonc" },
--   -- enable wrap mode for json files only
--   command = "setlocal wrap",
-- })
-- vim.api.nvim_create_autocmd("FileType", {
--   pattern = "zsh",
--   callback = function()
--     -- let treesitter use bash highlight for zsh files as well
--     require("nvim-treesitter.highlight").attach(0, "bash")
--   end,
-- })

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.