Открытые файлы в существующем Gvim на нескольких (новых) вкладках

Используя запрос HEAD, я заставил свой веб-сервер ответить правильным полем длины содержимого, которое в противном случае было пустым. Я не знаю, работает ли это вообще, но в моем случае это работает:

    private int tryGetFileSize(URL url) {
        HttpURLConnection conn = null;
        try {
            conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("HEAD");
            conn.getInputStream();
            return conn.getContentLength();
        } catch (IOException e) {
            return -1;
        } finally {
            conn.disconnect();
        }
    }
43
задан Mahbub 2 February 2014 в 11:32
поделиться

2 ответа

Если vim скомпилирован с опцией clientserver , вы можете это сделать. Запустите свой экземпляр vim со следующим флагом:

$ gvim --servername GVIM  # GVIM is the server name. It can be anything.

Чтобы открыть больше вкладок в этом экземпляре, вы можете запустить команду:

$ gvim --servername GVIM --remote-tab file1 file2 file3 ...

Функция clientserver в vim очень удобна. Это не ограничивается открытием файлов; его можно использовать для отправки любой команды в vim с помощью командной строки. Например, чтобы удаленно закрыть экземпляр vim, вы можете использовать:

$ gvim --servername GVIM --remote-send '<Esc>:wqa<CR>'
70
ответ дан 26 November 2019 в 22:37
поделиться

From inside of Gvim, type :tabe {file_name}. This opens the named file in a new tab. If you aren't fond of typing long filenames, try this:

:tabnew
:e .

This will open a new, blank tab page and open a file browser. You can mouse click your way around or use the keyboard. Click or hit the enter key on the file you want to open it. Try using the keyboard to position the cursor over the file you want to open and then hit 't'. This opens the selected file in a new tab, keeping the file browser open in the first tab. This might be a fast way to open a bunch of files.

There are a whole lot of things you can do with tab pages that might make life easier. To get to the relevant section in Vim's on line help manual, type :h tabpage.

20
ответ дан 26 November 2019 в 22:37
поделиться
Другие вопросы по тегам:

Похожие вопросы: