So I installed youcompleteme for vim and when running vim as sudo, everything works as expected. I get autocomplete as well as syntax-highlighting.
However when running vim as normal user, YCM does not appear to be working.
I do get syntax-highlighting but I suspect that being due to :syntax on in my ~/.vimrc. I do not get the autocomplete I got from YCM when starting as sudo.
This is my ~/.vimrc:
set tabstop=4
let g:ycm_global_ycm_extra_conf = '~/Documents/code'
let g:ycm_confirm_extra_conf = 0
:syntax on
:set nu
:filetype on
Before you ask, the .ycm_extra_conf.py is in fact in the specified folder.
Also here is the output of uname -a:
Linux PC 5.14.11-arch1-1 #1 SMP PREEMPT Sun, 10 Oct 2021 00:48:26 +0000 x86_64 GNU/Linux
How can I get YCM's functionality as non-privileged user?
Alright after some trying I found the following:
it looks like I made a blunder. After putting
let g:ycm_global_ycm_extra_conf = '~/Documents/code/.ycm_extra_config.py' in my .vimrc it was fixed.
All it needed was the full path, including the filename.
Related
I have strange problem with my /etc/vim/vimrc file.
I was trying to get rid of VISUAL mode in VIM, so I have tried to add the set mouse-=a command in my vimrc file.
However my vim does not take those changes into account.
When I do :set mouse-=a in openend vim, it does what I want (selecting text with mouse without entering VISUAL mode), but the command does not work in the vimrc file.
I have also enabled the "jump to the last position when reopening a file" in vimrc and it is working, that makes me even more confused.
I have been trying every possible command:
set mouse=a
set mouse=r
set mouse-=a
:set mouse-=a
None of them is working when added to /etc/vim/vimrc.
My system is:
rRr-kali:~# uname -a
Linux rRr-kali 4.8.0-kali2-amd64 #1 SMP Debian 4.8.15-1kali1 (2016-12-23) x86_64 GNU/Linux
rRr-kali:~#
If you are using Debian 9 (Strecth), edit the file /usr/share/vim/vim80/defaults.vim and change the line 70 to put
set mouse-=a
Best Regards
Thibault
I know, that this question is a bit old, but I just want to clarify, why both answers above are correct and why it's working that way.
On Debian systems the way the config files for vim are loaded is like this:
Load settings in /etc/vim/vimrc
If exists, load settings from /etc/vim/vimrc.local
If ~/.vimrc does not exist and there is no "let g:skip_defaults_vim = 1" in /etc/vim/vimrc or /etc/vim/vimrc.local, load settings from /usr/share/vim/vim80/defaults.vim otherwise load settings from ~/.vimrc (if it exists).
Details for that can be found in the config files itself, as well as in a discussion on bugs.debian.org
So to solve your issue you have two ways to go:
Insert "let g:skip_defaults_vim = 1" at the beginning of /etc/vim/vimrc.local.
Create an empty ~/.vimrc by issuing touch ~/.vimrc.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074
Moving mouse-=a to the end of ~/.vimrc resolved the issue for me.
At least at RaspberryOS (Debian) the "problem" is that /usr/share/vim/vim80/defaults.vim will be executed after /etc/vim/vimrc (including vimrc.local) or ~/.vimrc
Thus I changed line defaults.vim alike this:
69 if has('mouse')
70 if empty("+mouse")
71 set mouse=a
72 endif
73 endif
now I'm able to set mouse-=a in system wide or personal vimrc
In vim, when I am in insert mode and press the arrow keys I get letters instead:
As you can see, the arrow keys, when pressed, insert a line above the current cursor position including either A, B, C or D.
How do I stop this?
Things I've tried
I have set nocompatible in my ~/.vimrc (vimrc pastebin), I am using pathogen and here is my ~/.vim/bundle directory:
YouCompleteMe/
emmet-vim/
nerdtree/
node/
vim-airline/
vim-markdown/
The problem only started recently, but I can't think of what caused it.
I've done :set term=builtin_ansi, and this fixes the problem but removes all my colors.
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 29 2016 12:51:13)
MacOS X (unix) version
Included patches: 1-2290
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
...
See http://pastebin.com/5z1HbpqW for the whole output.
$ echo $TERM
xterm-256color
and in vim:
:set compatible?
nocompatible
:set term?
term=xterm-256color
Use this:
:set term=builtin_ansi
Source: http://vim.wikia.com/wiki/Fix_broken_arrow_key_navigation_in_insert_mode
Here is my .vimrc
1 syntax on
2 set ts=4
3 set number
4 set smartindent
5 set shiftwidth=4
However, I tried to edit HelloWorld.java and HelloWorld.c. Both have pure regular black font. No any highlighting!
I also tried :syntax on after the vim is open, but no luck.
\>vim -version
VIM - Vi IMproved 7.3 (2010 Aug 15)
\>cat /etc/*-release
openSUSE 11.4 (x86_64)
VERSION = 11.4
CODENAME = Celadon
When you edit the file, are you using
vim filename
This can matter. In some server configurations, if you do vi filename you get vim, but it's a very stripped down version of vim that is very much like the original vi (which does not, among other things, do syntax coloring). On a system configured in this way, if you instead type vim filename, you get the full featured vim.
I just worked through this with a person who was on a server that had the vim-minimal package installed as well as another vim package. I suspect (but did not verify that) the vim-minimal package installed its executable as /bin/vi.
The difference was very clear when you looked at the actual files (i.e. ls -l /bin/vi vs ls -l /usr/bin/vim)--one was about ten times the size. Both of them were actually vim, same version number and everything, but the /bin/vi one was compiled with very few features enabled.
To make it even more confusing:
vi existing.pl
opened the .pl file, gave no syntax coloring
vi [enter]
gave the vim splash screen, and from there
:e existing.pl
opened the file with syntax coloring on.
A comment from Jan Wilamowski suggests checking by doing:
vi --version
If that shows that the syntax feature was not compiled in, try
vim --version
and see if it is compiled in there.
You'll need to install the vim-data package on openSUSE for vim syntax colouring to work.
Sounds strange, I know that this is not pulled in by default with the vim package but AFAIK it's for people who want to create tiny base installs.
Package vim-data contains the runtime files.
Also make sure your remote environment has an appropriate TERM variable set TERM=screen-256color, TERM=xterm, TERM=xterm-256color should all work just fine with ssh and ssh with screen/tmux.
If all above have been done and you see some underlines and bold instead of actual colors... this might work for you:
export TERM=xterm-color
in your .vimrc, I don't see filetype setting. you could try to add:
filetype plugin indent on
to your vimrc.
if you don't have set nocp, add this line too.
if you read :h filetype
:filetype on
Each time a new or existing file is edited, Vim will try to recognize the type
of the file and set the 'filetype' option. This will trigger the FileType
event, which can be used to set the syntax highlighting, set options, etc.
For some strange reason on MacOS, 'syntax on' must be the first line in your .vimrc file. The line appears to be ignored if placed elsewhere in the file.
One item not mentioned is :set syntax=<type>, e.g. :set syntax=markdown.
This has been successful in instances where other techniques above were not.
I got FuzzyFinder set up, and it works pretty well, but when I'm doing ":FufCoverageFile", the file matching dropdown blinks every time I add or remove a character. When I'm typing to get search for a file, this turns out to be very, very distracting. Is there something I can do to stop the file finder from blinking distractingly?
https://github.com/vim-scripts/FuzzyFinder
vim --version:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 31 2011 19:27:29)
Running OS X Lion.
This does not have to do with FuzzyFinder but instead has to do with your terminal not supporting whatever colors your menu is trying to be displayed in. These are set by Pmenu and PmenuSel.
Check :hi Pmenu and :hi PmenuSel to see what colors they are set to. Try :hi clear Pmenu and :hi clear PmenuSel to see if that stops it. If it does then it confirms my diagnosis. If your terminal supports 256 colors you may need to enable it. You can check your current $TERM with :echo $TERM.
Whenever I work with multiple buffers, there is always one empty. I would like to not have that if I open a file with vim from the command line (i.e. I don't want to create a new file, or choose to create a new file by naming it first and starting vim with that name). How can I do this?
Edit:
I'm launching gvim the following way:
I have an alias in my bashrc: alias g="gvim --remote-silent"
I open files from the command line with: g name-of-file
At this point (if I didn't already have an instance of gvim open), I have two buffers:
Edit2:
Platform is Linux Mint, version is: VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 24 2011 07:07:39).
I updated my NERDTree plugin as David suggested, but it didn't help. Other plugins I use: Pathogen, a, doxygentoolkit, nerdtree, snipmate, vim-rails,
ack_plugin, easymotion, protobuf, sparkup, yankring,
bufexplorer, matchit, rainbow, surround,
clang_complete, nerdcommenter, repeat
I don't have your problem on
linux, gvim - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 24 2011 07:07:34) Included patches: 1-35
windows gvim - Vi IMproved 7.2 (2008 Aug 9, compiled Aug 9 2008 18:46:22) MS-Windows 32-bit GUI version with OLE support
You are probably looking at a bug.
You might be able to debug things by cleaning your $MYVIMRC (temporarily) and running gvim --noplugin.
Alternatively inspect all settings (like bufhidden and other suspect parties)
:set
:setglobal
and see from which script/plugin they are being set (bufhidden as an example only here):
:verbose set bufhidden
:verbose setglobal bufhidden
You might also inspect autocommands (that might prevent buffers from being wiped)
:verbose au
To avoid this I changed my alias:
g() { [ -z "$(command gvim --serverlist)" ] && command gvim "$#" || command gvim --remote-silent "$#" ; }
If the list of server is empty: launch plain gvim, otherwise launch with remote-silent option.