willothy / flatten.nvim

Open files and command output from wezterm, kitty, and neovim terminals in your current neovim instance
https://luarocks.org/modules/willothy/flatten.nvim
MIT License
462 stars 13 forks source link

Support quickfix mode #94

Open Aura7988 opened 6 months ago

Aura7988 commented 6 months ago

Hi, thanks for this plugin! It works perfect.

There is one thing I would appreciate. Currently, open files in quickfix mode from terminal buffers will create a nested session. It would be wonderful if a quickfix or location list is created in this usage.

willothy commented 6 months ago

Hi, I don't use the quickfix list so I'm not entirely sure what the request is, but I'm happy to look into implementing this if you provide some more info.

How would I open a file in quickfix mode, and what is quickfix mode? I've heard of the quickfix list/window but that's it.

Aura7988 commented 6 months ago

nvim -q qf.txt will place nvim in quickfix mode.

The content of the qf.txt is usually generated by gcc or grep, and each line contains information such as file path, line number and column number:

fileA.cc:530:13: some info xxx
fileB.hh:106:23: some info xxx
willothy commented 6 months ago

Ah alright, I see! Thanks for explaining. This should be pretty simple to implement, I'll look into it tomorrow :)

Aura7988 commented 6 months ago

Thanks in advance :)

I found that the value of nfile is 0 in this usage.

Aura7988 commented 2 months ago

Thanks again. I recently wrote a simple bash function.

vi() {
    local sp=~/.cache/nvim/server.pipe
    [[ ! -S $sp ]] && nvim --listen $sp $@ && return
    [[ $# -eq 0 ]] && return
    local rs="--remote-send '<C-\><C-N>:tabe|lcd $PWD|"
    case "$1" in
        -b)
            [[ $# -lt 2 ]] && { echo 'Wrong arguments'; return; }
            rs+="set binary|drop ${@:2}<CR>'"
            ;;
        -d)
            [[ $# -lt 3 ]] && { echo 'Wrong arguments'; return; }
            rs+="e $2|diffthis"
            for f in "${@:3}"; do rs+="|vs $f|diffthis"; done;
            rs+="<CR>'"
            ;;
        -q)
            [[ $# -ne 2 ]] && { echo 'Wrong arguments'; return; }
            rs+="lfile $2<CR>'"
            ;;
        *)
            rs+="drop $@<CR>'"
            ;;
    esac
    eval nvim --server $sp $rs
}
willothy commented 2 months ago

I'd like to keep this open since I'd still like to look into supporting it. Sorry for not getting to this though, I've been very busy recently. Bash implementation looks great tho!