Giter VIP home page Giter VIP logo

mru's People

Contributors

anishsane avatar bronzehedwick avatar jamescherti avatar konfekt avatar mmrwoods avatar mroavi avatar ranelpadon avatar tamamcglinn avatar yegappan 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mru's Issues

FZF support

Would be great to use fzf on the MRU list. If you like the idea I can send a PR.

combined use of commands

I know that v is to open file in read-only file and O is to open file in a horizontal split window.

So how about opening a file in a horizontal split window in read-only mode?

Bug: buffers are not added to the buffer list when reopened

The first time a buffer is opened with MRU, it is added to the buffer list. If, however, the buffer is deleted and reopened at a later point again with MRU, it does not get added to the buffer list. I find this behavior buggy. Let me know if you agree.

Here is a gif that illustrates the above:

Peek 2021-08-03 00-54_mru_buffer_list_bug

I am running NVIM v0.5.0.

Error writing MRU list file when re-sourcing init.vim

Initially, I had the following line in my init.vim to remember where the MRU list file is stored:

let MRU_File = '$HOME/.vim_mru_files'

I noticed that if I re-source my init.vim then I get the following error whenever the MRU plugin tries to save the MRU list file:

Error detected while processing function <SNR>43_MRU_AddFile[59]..<SNR>43_MRU_SaveList:
line    4:
E482: Can't open file $HOME/.vim_mru_files for writing: no such file or directory
[which-key] <space> e is undefined

Since the custom path I'm setting is the same as the default one, I disabled it and the problem went away. However, other people that might actually want to store their MRU list file in another place, might run into this problem. Just wanted to point this out.

Here is a minimal init.vim:

call plug#begin(stdpath('data') . '/plugged')
Plug 'yegappan/mru'
call plug#end()

let MRU_File = '$HOME/.vim_mru_files'

colorize file in MRU list differently from path for better legibility

the MRU list is hard to scan quickly because the filename is listed adjacent to the full filename, and the two blend together.

colorizing the file name in a different color than the path will help make the file names stand out and should make it faster to find the file you're looking for. :)

MRU Shows deleted files

The MRU list shows files that have been deleted and no longer exist. This makes the list very cluttered, especially full of temporary files. Is there a way to refresh this?

Thoughts about using .viminfo over .vim_mru_files

There is a bash script called v that lets you quickly open files listed in your .viminfo.

MRU creates an unnecessary file called .vim_mru_files, with a format like:

# Most recently edited files in Vim (version 3.0)
/home/jared/.vim_mru_files
/home/jared/.vim/vimrc

.viminfo has lines that start with > and then have a path next to them. This is what v is parsing out:

> ~/.linuxbrew/bin/v
    "   36  0

> ~/.viminfo
    "   234 0

> ~/lol.txt
    "   1   0

> ~/.vim_mru_files
    "   5   42

> /usr/share/vim/vim74/doc/starting.txt
    "   1352    33

There might be a reason .vim_mru_files is made though, that I am overlooking. Maybe older vim versions don't use .viminfo?

Looking for thoughts on this, though. :}

Add vimdoc help

I see there is an html manual here, but it would be nice to include docs that could be accessed with :help MRU.

Addition of strcharpart changes Vim version requirements

Just updated today and noticed that in commit 7ef8683 the function strcharpart was added to replace strpart.

This function was added to vim in commit vim/vim@58de0e2 on April 14 2016 which is equivalent to the patch level 7.4.1730.

Therefore I believe you either need to update the requirements in the README to this version of Vim, or revert to using strpart again.

Hope this helps!

Error detected while processing mru.vim [1040]..function <SNR>50_MRU_LoadList[24]

Hi, I'm using mru in bash in macOS, this is not the first time I install it, I reinstall my MacBook and I don't know how this error happens.

Here's the related neovim log:

sourcing "/Users/eddiehsu/.vim/plugged/mru/plugin/mru.vim"
Error detected while processing /Users/eddiehsu/.vim/plugged/mru/plugin/mru.vim[1040]..function <SNR>50_MRU_LoadList[24]..<SNR>50_MRU_Refresh_Menu:
line   12:
E329: No menu "&File"
Error detected while processing /Users/eddiehsu/.vim/plugged/mru/plugin/mru.vim[1040]..function <SNR>50_MRU_LoadList[24]..<SNR>50_MRU_Refresh_Menu:
line   17:
E328: Menu only exists in another mode
finished sourcing /Users/eddiehsu/.vim/plugged/mru/plugin/mru.vim
  • macOS version: 12.5.1
  • bash version: 5.2.0(1)-release
  • Neovim version: 0.8.0

Feature request: unique file name in MRU list

It is quite common to have different files with the same name but in different dirs (e.g. Makefile)
With Neovim, this is also quite common:

image

I find it a little bit annoying having to look at the path (right-hand side in the image) to identify which is the file you want to open.

Would it be possible to include "directory name + file name" for repeated file names in the MRU list?

E.g. the example above would change to:

nvim/init.lua (/home/mroavi/dotfiles/nvim/.config/nvim/init.lua)
mrv/init.lua (/home/mroavi/dotfiles/nvim/.config/nvim/lua/mrv/init.lua)
plugins/init.lua (/home/mroavi/dotfiles/nvim/.config/nvim/lua/mrv/plugins/init.lua)
tender/init.lua (/home/mroavi/repos/tender.nvim/lua/tender/init.lua)
custom.vim (/home/mroavi/dotfiles/nvim/.config/nvim/lua/mrv/custom.vim)

(I know that plugins that display buffer names in the tabline have this functionality, e.g. vim-buftabline)

Enhancement: if hidden is set always open in current window

Right now, if you use enter to open a file which is not currently open, and the buffer in the current window is modified, the new file will always be opened in a new window.

I'd like to propose that behavior is only true when hidden is not set. If hidden is set, then the buffer in the current window is replaced w/ the file being opened even if it is modified.

If hidden is set and multiple files are being opened, the last one should replace the file in the current window and the others should be opened hidden.

This would mesh well w/ those of us using a buffer manager (such as buffet).

mru skips first TextChanged events?

If I add this to my .vimrc:

    au TextChanged,TextChangedI * echo "changed"

Then use mru to open a file that already has some text in it and do i<cr>, it doesn't print "changed". The event is only triggered on the second <cr>.
Without mru, on the other hand, "changed" is printed as soon as I open the file, even if I don't do anything.

double command line

When using MRU, the newly opened window has the command line on the second line from bottom instead of the first.

case insensitive search

I would like to be able to search MRU files case insensitively.
From the command itself (preferred), such as -
:MRU -i MyFile - finds myfile , MYFILE, mYFiLe, etc.
Or (less preferred) by setting a variable: g_mru_case_sensitive=1 (or 0 for insensitive).
Or in any other way.

Footnote -
MRU is the FIRST and sometimes the only extension I install in a new environment.
So - thanks a lot for it!
Recently I switched to a project that case is not important and files have names that I can't predict their case, this is the reason I want it just now after years of usage.

How to toggle MRU window?

Doing :MRU (which I have mapped to m) opens up the MRU window. And the only way to close that is to close the window (normally by going into that window and doing :q or q).

Isn't there a :MRUToggle command which toggles the window?

Mapping it to <leader>m would be a great time saver then. 🥂

Conflicts with winsaveview/winrestview

I use autocmd to save and restore the caret position of each buffer as vim moves from one buffer to another:

 autocmd BufLeave * let b:caret = winsaveview()                                                             
 autocmd BufEnter * if (exists('b:caret')) | call winrestview(b:caret) | endif 

This doesn't cooperate well with MRU. When I close the MRU window (with MRU_Use_Current_Window = 0), the BufLeave appears to save the MRU caret position into b:caret of the text window. So every time I change from the MRU window, my text buffer is scrolled such that the caret appears at the top of the screen (just as it was in the MRU window). The whole point of this autocmd configuration is to avoid that kind of nonsensical scrolling.

I don't have much experience with vim. Can you recommend a way to avoid ever applying winsaveview to the MRU window?

Why not just use `:browse oldfiles` and `v:oldfiles`?

If vim is compiled using +viminfo feature (which it usually is), or if using neovim,
then there is an in-built feature which you can use!

:browse oldfiles

Which shall show a list of the most recently-opened files!


Also, the variable s:MRU_files is serving the same purpose as the variable v:oldfiles! Why not just use v:oldfiles ?
See -

:help v:oldfiles

option to change $HOME/.vim_mru_files path

We should be able to set where its file should be, with its default being $HOME/.vim_mru_files on Unix-systems.

It feels cluttered to have a home with too many files from a specific plugin from a specific program.

how to close mru window?

is there a way to close the mru window? i open it via shortcut but to close it ive to either select a new file from its list or click to open the file im currently working on.

is there a way to toggle mru? neither esc nore q or again :MRU do anything

E482 can't create file

I have the following line in my .vimrc file:

    let MRU_File = '~/.vim/vim_mru_files'

and it gives me the E482 error. When the line is commented out, no error occurs. I'm pretty new to Linux, so I don't know if this is a problem with this plugin or something configured wrong in the OS. I have a similar line for Windows:

    let MRU_File = 'c:/users/jon.hatfield/documents/_vim_mru_files'

and I've never had any issues with this plugin on that OS.

Handy plugin, btw.

Thanks, Jon
[email protected]

dd: delete files from MRU list

Would be nice to have a way to remove entries from MRU list (without resorting to external editor) -- e.g. when files are moved, deleted, or are symlink aliases of other MRU entries

Invalid range error when opening a file in new tab

In new versions of Gvim an error "Invalid range" happens when a file is opened in a new tab. The error happens on this line (521):

exe '999tabnew ' . a:esc_fname

Proposed solution:

exe 'tablast'
exe 'tabnew' . a:esc_fname

Opens MRU file in window1 even if window2 was active

I'm not sure if this is even a MRU issue, but say I've got two windows open and call :MRU and then select a file that's already in the list of buffers I've got open, but not currently visible in any of the two windows I've got open. The file that I select from the MRU list gets opened in whatever window it was in most recently, rather than the current window that I called MRU from.

Increase FZFMru Window Height

If I set this:

let MRU_Window_Height = 40

the :MRU command window will increase:
Screen Shot 2021-05-14 at 2 38 07 PM

but it has no effect in the :FZFMru command:
Screen Shot 2021-05-14 at 2 35 47 PM

I think they should follow similar height setting/value? Is there a workaround for increasing the :FZFMru command?

By the way, thanks for this really useful plugin. :)

FZFMru when filename = project name

FZFMru shows full paths, instead of basename + path like Mru. It also calls fzf#run with --no-sort. So if I have .../myprj/myprj.ext in history, but also .../myprj/blah*, I can't easily get to myprj.ext. When I start typing myprj, it prefers matches on the directory name early in the path, not the basename at the end of the path.

I've resorted to changing the options from --no-sort to --tiebreak=end,chunk (because --no-sort seems incompatible with --tiebreak), but that essentially leaves the list chronologically sorted only when the query is empty (as soon as I type something, fzf begins sorting). Maybe that's the right thing to do? Although that tends to bring up unrelated old files from history.

I've read that :Mru supposedly uses fuzzy matching in modern Vim's, but I'm not really sure if that's true. I think it only applies when you call : Mru arg (which I never do since I bring up :Mru or :FZFMru only via key mapping).

:FZFMru shows changes only on the second call

I ran into the following behavior. :FZFMru shows changes only on the second call, namely:
Open your MRU_File, add or change existing lines in it. call :FZFMru, the changes are not reflected. call :FZFMru again, the changes are displayed.
When I call :MRU, the changes are immediately visible, i.e. on the first call.

Is this some kind of feature? Why might this be happening?

File: mru.vim
Version: 3.10.2

buffer write on :MRU

What's the recommend way to handle writing the buffer when invoking MRU to avoid opening a new window when there are changes in the current buffer? autowrite / autowriteall does not seem to apply and it would make using and explaining MRU to new users.

Replace vim splash screen with MRU

Feature suggestion: here is a way to show the MRU window on vim startup when no file was specified on the command line:

fun! Start()                                                                                               
                                                                                                           
    " don't show MRU if the command line indicated a file to open                                          
    if argc() || line2byte('$') != -1 || v:progname !~? '^[-gmnq]\=vim\=x\=\%[\.exe]$' || &insertmode      
        return                                                                                             
    endif                                                                                                  
                                                                                                           
    " no file was specified, so show MRU instead of the useless vim splash screen                          
    MRU                                                                                                    
                                                                                                           
endfun                                                                                                     
                                                                                                           
augroup splash                                                                                             
    autocmd!                                                                                               
    autocmd VimEnter * call Start()                                                                        
augroup end 

Error in vim 7.4 version

I've met this error messages.

E117: Unknown function: strcharpart
E15: Invalid expression: strcharpart(dir_name, 0, 10) . '...' . strcharpart(dir_name, len - 20)
E117: Unknown function: strcharpart
E15: Invalid expression: strcharpart(dir_name, 0, 10) . '...' . strcharpart(dir_name, len - 20)
E117: Unknown function: strcharpart
E15: Invalid expression: strcharpart(dir_name, 0, 10) . '...' . strcharpart(dir_name, len - 20)
E117: Unknown function: strcharpart
E15: Invalid expression: strcharpart(dir_name, 0, 10) . '...' . strcharpart(dir_name, len - 20)
E117: Unknown function: strcharpart
E15: Invalid expression: strcharpart(dir_name, 0, 10) . '...' . strcharpart(dir_name, len - 20)
E117: Unknown function: strcharpart
E15: Invalid expression: strcharpart(dir_name, 0, 10) . '...' . strcharpart(dir_name, len - 20)
E117: Unknown function: strcharpart
E15: Invalid expression: strcharpart(dir_name, 0, 10) . '...' . strcharpart(dir_name, len - 20)

I checked the code.
line 748 is always true even in 7.4

if v:version >= 8.0 || has("patch-7.4.1730")

I think this should be changed like this

if v:version >= 800 || has("patch-7.4.1730")

ERROR: Not an editor command: MRU

I downloaded the latest version of MRU in $HOME/.vim/plugin but when I type :MRU I get Not an editor command: MRU error.
I'm using MacVim 7.4 and :scriptnames doesn't show MRU loaded. What am I doing wrong?

Error on every start and write

On nvim start

Error detected while proce
ssing function <SNR>35_MRU_LoadList:
line    5:
E684: list index out of range: 0
Error detected while processing function <SNR>35_MRU_AddFile[45]..<SNR>35_MRU_LoadList:
line    5:
E684: list index out of range: 0
E684: list index out of range: 0

on :w

Error detected while processing function <SNR>35_MRU_Cmd[3]..<SNR>35_MRU_Open_Window[3]..<SNR>35_MRU_Loa
dList:
line    5:
E684: list index out of range: 0

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.