Vim/nvim configuration file

I got some issues configuring the clipboard (system wide yank) on both vim and nvim. I am trying to find the .vimrc file for vim, but i don’t seem to be able to find it. However, I also found out that vim on clear linux isn’t compiled with clipboard feature. So, i installed nvim bundle, which has the features embedded.
I am trying to find the init.vim file for nvim, but i wasn’t able to. And i am not sure where does the bundled system place the files. I tried creating it on the home, .config directories, but non worked.

Anyone knows the default nvim config in clear linux?
it shows

  • Use $XDG_CONFIG_HOME/nvim/init.vim instead of .vimrc for configuration.
    but it doesn’t seem to respond to the configuration i add

To put it simply, i am trying to add
set clipboard+=unnamedplus
to neovim, or vim, but i am having issues figuring out the file location.

In general Clear Linux don’t have default configuration except for a small number of critical programs.

You can create the nvim config file at ‘~/.config/nvim/init.vim’.

I have a line ‘source ~/.vimrc’ so I can keep a single config file for both vim and nvim. And for nvim-only configs, I append them in ‘~/.config/nvim/init.vim’.

1 Like

Thanks for guiding me to the right directory.
Apparently i also needed to install x11-tools in order to integrate xclip for my system wide copy config.

If you’re in a GUI desktop environment, and you work in the terminal vi/nvim, ‘ctrl+shift+c/v’ are the bindings for copy to/paste from the primary selection.

1 Like

I am using the GUI environment. Thanks for the binding, it makes things easier. My only problem with it is using it with vim/nvim because i can’t scroll down the terminal while selecting. If you have a way to select something that’s two pages long using that binding, that would be amazing.

Okay I see.

Suppose that’s the output of a shell command ‘foo’. You can do this:

  1. First get that output into a temporary file with foo &> /tmp/foo.output. Here &> operator pipes both stdout and stderr to the file, and you can replace it with > if you only need stdout.
  2. Suppose you have gedit installed, which is very likely to happen, you can use gedit for this operation with gedit /tmp/foo.output &. Here & is a suffix to a shell command, which start a background sub-process for the program.
  3. In gedit you can use the common key bindings to select the text. Then you can paste them in vi.

Alternatively, you can open multiple files in vi.

  1. First type foo | vi -, which calls the program foo and pipes its output to a buffer of vi.
  2. Split the window with :split or :vsplit in normal mode.
  3. Use Ctrl+w and hjkl keys to navigate to the new window. And use :edit TARGET_FILE to open the target file.
  4. Then you can use normal vi operations to copy and paste.
1 Like

For vim with +clipboard, also try gvim -v

1 Like

Thanks again for the help. :sweat_smile: To be honest, I would rather stick with one nvim entirely. That’s why i added the system-wide clipboard config in my file. It’s easier to select with v key and yank.

I didn’t know clear linux is equipped with that. I am sticking with nvim since i already took time to install it, but thanks a lot for the information.