All Questions

Filter by
Sorted by
Tagged with
1
vote
1answer
68 views

How do I check whether a given directory exists?

I need to determine whether a certain path exists and points to a directory, like the -d test in the shell. I know about the filereadable() function, which does basically this for files: filereadable(...
-1
votes
1answer
43 views

vimrc for ale is creating confusion: is my augroup wrong?

My vimrc: https://paste.fedoraproject.org/paste/Wl5jvebADSDoAI4HbIX-hA and my corresponding python file is: https://paste.fedoraproject.org/paste/g60mU7xBqGaEuKKWkZ6Rnw The problem is, with ALE, as ...
0
votes
2answers
111 views

Using a special key in function

I am trying to remap <PageUp> key to call this function: function! PageUp() let l:line = line('.') if(l:line != 1) if(l:line != winline()) :set syntax=off ...
0
votes
1answer
17 views

Disabling syntax and maintaining colorscheme [flickering problem]

I have noticed that with set syntax=off option set, the gvim screen doesn't flicker when I scroll the page using <PageUp> and <PageDown>. What are the possible solutions, if some exist,...
0
votes
2answers
58 views

How to vertically-block-select words of different length?

With other editors we can select vertical-blocks where each line has the same start column but not the same end-column. For example: print("", s.field1); print("", s.field_long); print("", s.f); ...
0
votes
0answers
38 views

My cursor is changed after “df” [duplicate]

I have the following to change my cursor from a block into an underline: set guicursor=a:hor20-Cursor Whenever I run df to delete a range, my cursor is changed back to a block. I have to source my ...
1
vote
2answers
36 views

Do I need to be a fast typer/power user to start using Vim?

I started learning serious programming since last year. Over the course, I have used various GUI based text editors and IDEs and, I decided to settle with Sublime Text a few months ago. Now I want to ...
3
votes
2answers
197 views

Show mappings for all function keys

How can I show the mappings for all function keys <F1> to <F12> at once? I know that :map <F1> shows the mapping for <F1>, and I can repeat this 12 times for each key. But is ...
1
vote
1answer
23 views

How to format with `gq` using the same settings as when editing the text

I have the following options set (in ~/.config/vim/ftplugin/asciidoc.vim): setlocal wrap setlocal textwidth=0 setlocal wrapmargin=0 setlocal formatoptions=l And when I'm writing text, it's not hard-...
0
votes
0answers
58 views

How can I make Vim NOT remove lines below with Ctrl and Left Arrow?

How can I make Vim not remove lines below with Ctrl and Left Arrow? So I just found a dangerous setting with Vim on Linux. If I press Ctrl and Left Arrow then whole rows below start vanishing. With ...
0
votes
1answer
60 views

Can I select and paste with a single operation?

Here's my use case. I have the following text: This is a [hyperlink](http://someurl.com). Now I want to replace the http://someurl.com text with a new URL in the default register (something I've ...
2
votes
1answer
102 views

Remove empty lines from a file

I'm able to find empty lines with /^$, but when I go to remove them using :%s/^$//, nothing seems to happen. Yet, some form of substitution is being made, because the status line reads XX ...
3
votes
2answers
48 views

Why is this appearing to select wrong number of lines?

First, I typed 2V to select two lines, and y to yank them. Then I typed 3V, and instead of selecting 3 lines, Vim selects 6 lines. Next I typed 4V and Vim selected 8 lines. It seems that 3 or 4 in the ...
1
vote
1answer
52 views

Custom Number Format for CTRL+A

The ctrl+A command to increment numbers is super handy, but it doesn't work in languages that don't use C-style 0x and 0 prefixes for hexadecimal and octal numbers. In SystemVerilog, hexadecimal ...
3
votes
1answer
44 views

How do I pick a line and write it to an external file?

I'm searching through a big text file and want to copy certain lines to another file - there is no specific pattern, I need to visually inspect and copy those lines to an external file. The command :...
0
votes
2answers
38 views

List files if there are too many of them

I often want to open files using the wildcards like :e **/foo.bar However every now and then I get an E77: Too many file names What I would like to have would be to add to that error message a ...
1
vote
0answers
18 views

Get correct indentation when entering insert mode [duplicate]

When I enter insert mode using o or O when programming, the cursor appears at the correct level of indentation. In this example below, X is the place where I press o and Y is where my cursor appears. ...
1
vote
1answer
21 views

mapping <leader>; and <leader>, to ; and , respectively

My <leader> key is , and for convenience I'm using for a few years now the ; normal-mapped as a :, to save me a key stroke to type :commands. Now, I know that , and ; are shortcuts themselves, ...
2
votes
0answers
68 views

Vim+Tmux: How to switch between Tmux Windows and Vim Tab Pages Seamlessly using the Alt Key?

In Vim I can switch between tab pages with :tabnext- to go left and tabnext+ to go right, simulating the tabs on an IDE. In Tmux I can switch between windows using <prefix>p and <prefix>n ...
1
vote
1answer
21 views

How do I make the current tab's windows equal width but leave their heights?

I know <C-w> = equalises window sizes but I often want to keep the heights as they are. I have set noequalalways in my .vimrc as leaving it on ruins layouts when temporary windows open (like ...
1
vote
1answer
23 views

Alert sound when using <C-L> etc. mappings

I've got these mappings in my .vimrc: nnoremap <C-Tab> :tabn<cr> " cycle tabs nnoremap <C-S-Tab> :tabp<cr> " cycle tabs backward nnoremap <C-J> <C-W><C-J&...
0
votes
1answer
62 views

How to set tabs in vimrc (Vim 8.1, Windows 10)

I thought this was straightforward i.e. put the command that works in the buffer viz "set ts=4" in vimrc but this does not seem to work if I also want the functionality provided by vimrc_example, ...
0
votes
1answer
40 views

Why am I getting vim error E576? (Vim 8.1, Windows 10)

Every time I open a file (by which I mean what I would call a text file, typically one containing Python code) I get two lines of error messages that read E576: viminfo: Missing '>' in line: ...
1
vote
3answers
77 views

Selecting code chunk in Rmarkdown

I am writing an RMarkdown file, which is a document that is a hybrid of text and R code. Here is an example of what that document could look like: Here is an example of text within my Rmarkdown file. ...
0
votes
1answer
20 views

How can I specify “split or move” logic for <C-W><C-L> and similar move commands?

Is it possible to make <C-W><C-L> command to make split on the right, if it's the rightmost pane opened? Otherwise, it would behave like regular move. It's something like "conditional ...
1
vote
3answers
65 views

Search for line and paste as column until next match

I'm wondering if this is possible, more for curiosity's sake, but also it might be useful to know. I have several ascii data tables and I want to combine them all into a single file. So I combined ...
0
votes
2answers
36 views

Is it possible to perform the original action of a mapped key without knowing the key a priori?

Consider the following function and mapping. function! DoMagic() if s:isActive echom "Performing magic!" else " Perform default action of whatever key was mapped to this ...
1
vote
0answers
25 views

Is it possible to obtain the key that triggered a function to be called if there was one?

Consider the following function and mapping. function! GetInvoker() echom "I was invokeed by the key " echom <This_should_echo_F_or_G> endfunction map F :call GetInvoker()<CR> ...
1
vote
1answer
53 views

How do I properly set up airline and powerline fonts with gvim?

I've recently started moving over to gvim from vim on Windows. I managed to get the terminal version set up properly, and the fonts render there. In Vim, it works fine: But in gvim, the powerline ...
0
votes
1answer
18 views

How do I move to the beginning of a visual block from a vimscript function?

Suppose i have several lines of text: line1 line1 line2 line2 line3 line3 I want to create a vimscript function that has the following result: <itemizedlist> <listitem><para>line1 ...
2
votes
1answer
52 views

Where can I find color settings used by Vim and NeoVim?

I've been using dotfiles created by other people to setup Vim. Recently I decided to create my own config and investigate what's NeoVim about. I'm using default OSX Terminal.app with zsh shell (I've ...
0
votes
0answers
25 views

Vimwiki - Enter key not working on windows 10

Vimwiki version: 2.4.1 Vim: 8.1 I am on Windows 10. Enter is not working, it just moves the cursor to line below. Is there some setting that need to be enabled to make enter work on Windows ?
2
votes
0answers
22 views

substitute short by long command forms from history on VimLeavePre

How can I edit the : history from a VimLeavePre autocmd? I'd like certain abbreviated command forms to be recorded with their long form in the shada file. I'm in the habit of using both :tabe {file} ...
0
votes
1answer
43 views

Why doesn't it find the correct item?

I have tried to use FZF to filter my (last) commands. The first function works well and retrieves the list of my last commands. When I select a command, it triggers my HandleCommand function but goes ...
1
vote
3answers
125 views

Command to copy from current window and paste the text into terminal buffer

I am having trouble crafting a command that would copy the text from the current window and paste this text into a terminal buffer opened in the split below. Here are a few things I tried: normal ...
0
votes
0answers
34 views

has('mac') returns 0, but I'm on a mac? [duplicate]

I am using vim in a terminal on my mac. I understand that the command: echo has('mac') should return 1 (it does on macvim), because it's running on a mac. But it returns 0. Can anyone tell me why ...
0
votes
0answers
48 views

startinsert mode starts with NSERT — at top

When I use the command : vim -c "startinsert" sometextfile Vim starts with the characters NSERT -- at top. The cursor is placed on N and I can write over the whole thing. If I use space, the ...
1
vote
0answers
33 views

Keep `scroll` equal to current window height

Is there a way to update scroll every time window height changes? I know, that I can achieve the same behavior calling winheight(0) on each ctrld press as suggested here, but I'm curious if there is ...
0
votes
0answers
22 views

Remove costum commands from vim-spell

I recently tryed following the answer to this question: vim-spell: exclude custom LaTeX commands. To remove spelling from the inside of certain commands, I ended up adding the following to after/...
0
votes
1answer
14 views

Vim Jedi Plugin — Add .sage filetype

,g$$$$$$$$$$$$$$$P. OS: Debian 9.9 stretch ,g$$P"" """Y$$.". Kernel: x86_64 Linux 4.19.0-0.bpo.4-amd64 ,$$P' `$$$. Uptime: 3h 17m ',$$P ,ggs. `$$...
0
votes
1answer
52 views

vim 8.1 send_termkeys problem

I noticed that, if I use call term_sendkeys(buf, "make\n") and then I try to execute something else in the terminal windows (i.e. ls), vim append the last string sent from command mode to the actual ...
1
vote
2answers
170 views

Installing gvim on Windows Subsystem for Linux

I'm trying to install gvim on WSL (under windows 10) and use MobaXterm as my X server. Bash informed me that: Command 'gvim' not found, but can be installed with: sudo apt install vim Which I ...
1
vote
1answer
41 views

How to efficiently use the paste registers?

I often don't remember what was copied lately. So I don't know if I need to do <C-r>0 or <C-R>1 in insert mode. I tend to rely only on the * register, or type :reg, look at everything ...
2
votes
0answers
29 views

How can I make 'lnext' run 'lfirst' if it needs to be?

I use ALE for finding syntax errors in code in vim, which populates the loclist with any errors found. However, when I first open a file with errors, which populates that list (I have g:...
1
vote
0answers
24 views

What is the correct character for splitting a string on line breaks in Vimscript?

Consider the following text file. line1f line1n line2 Suppose I visual select this, yank it into register a, and then pass it to the following vimscript function: function TestSplit(block) for x ...
2
votes
1answer
47 views

help {subject} path precedence

:h {subject} reads If there is no full match for the pattern, or there are several matches, the "best" match will be used. A sophisticated algorithm is used to decide which match is better than ...
0
votes
1answer
29 views

Trouble with netrw ftp protocol, file won’t save

I am trying to create and edit a file remotely from my iPad using iVim to my Linux box which is on the same network. I am trying to use the ftp protocol from the netrw utility that comes with vim. I ...
0
votes
0answers
31 views

Vim “Follows” Hard links

I have a git repository that contains my vimrc file and a couple of other utilities, called myvimrcgit. I then hard link my vimrc to ~/.vimrc, so that they point to the same inodes. Now, when I go to ...
1
vote
1answer
39 views

How to get rid of inline linting errors?

I ran PlugUpdate recently and somehow all the Ale linter errors started popping up right in the buffer at the end of the line. It used to just put signs on the left side for the problematic line and ...
0
votes
1answer
35 views

Is there a way to determine whether the current / last visual block selection is non-rectangular?

One can create non-rectangular Visual-Block selections using C-v$ on files with lines of non-equal length. Is it possible to programmatically determine whether the last Visual Block selection was non-...

15 30 50 per page