I got this in my vimrc:
:so menu_format.vim
and in menu_format.vim, this:
"... other menu items that work
menu Format.nbsp_space <ESC>:%s# # #gec<CR> //(the 1st blank is 0xa0, the 2nd is 0x20)
"... other menu items that work
On Windows it works (been using it for a while), but on Linux Mint 17 vim gives:
E319: Sorry, the command is not available in this version.
I tried %s# # #gec on command line, it worked, too!
I knew how to fix this: %s#[\xa0]# #gec would do. I just wanted to know why there is such a difference, and it made me doubt the portability of my vim scripts.
BTW, I built vim (7.4.560) on both Linux and Windows with the same configuration, both use the same menu_format.vim.
It looks like you only have the minimal version of Vim named vim-tiny; it only provides a minimal vi-compatible implementation. The E319 implies that the :menu command is not available, the :substitute does look fine and should work.
To get the full Vim (and graphical GVIM), install the following package:
$ sudo apt-get install vim-gnome
Related
in the tutorial, the teacher used Linux whilst i use windows which is quite different and i don't understand why he could use vim and i cant since I've followed every instruction. here's the code he used vim first_python_program.py
if you want to use vim on Windows, just install it from the official website.
Then you can use it by opening cmd and typing vim <path_to_your_file>. (don't forget to replace <path_to_your_file> with your actual file).
Background
I was having dual boot issues with Windows 10 and Ubuntu 17.10, which eventually resulted in a boot loop and since I need Ubuntu 16.04.3 for an Operating Systems class I decided to load up an ISO into one of my USBs with Rufus, reformat my Windows partitions from GPT to NTFS to get around some nasty bootmg/efi issues and here we are, good as new, except for one thing...
Problem
The only thing I haven't been able to successfully reinstall has been Latex Suite for Vim. Installation last time had been an easy extraction into .vim, but after some deliberation I elected to use Pathogen.
I've installed Pathogen using
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
Which works for color schemes, etc., and every other aspect of latex-suite save for compiling, generating this every time I try to compile (using \ll):
/bin/bash: latex: command not found
I installed texlive which does then allow me to compile using vim, but I'd prefer not to use this solution if I don't have to (in fact I've already removed it, its more of a plan b for now given it's obstructive and non-intuitive compilation errors). I looked at the other questions asking how to install Latex Suite through pathogen and didn't see anything else similar to what I'm working on; below is self-explanatory in regards to installation structure.
~/.vim/bundle$ ls
vim-archery vim-latex-1.10.0
Obvious running pdflatex and latex can't be found because they are not in my $PATH but I was under the impression that with a good, recommended package manager like Pathogen I wouldn't need to which is what originally raised the red flag for me as its whole job is to modify the runtime path. I thought maybe trying sudo vim text.tex might work in case there hadn't been adequate permissions for Pathogen to modify runtime path but no dice.
.vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
colorscheme archery
let g:tex_flavor='latex'
set sw=2
I've been trying to delete many empty lines from a huge file. On other editors with vim, or vim itself, I could just do:
:%s/\n\n/\n/g
But neither if I use \r or \t it doesn't work. Seems like some vim features are missing on the editor. Is there any configuration to make that work or another way to do that?
To have advanced Vim functionality work within VScode, you can leverage its Neovim integration.
First, you'll have to install Neovim. For instructions, check out: https://github.com/neovim/neovim/wiki/Installing-Neovim
Then, adjust the following settings in your user configuration:
// Use neovim on backend. (only works for Ex commands right now). You should restart VScode after enable/disabling this for the changes to take effect. NOTE: Neovim must be installed (v0.2.0) and neovimPath must be set the executable in order for this setting to work. Otherwise, vscodevim will crash.
"vim.enableNeovim": true,
// Path to run neovim executable. For example, /usr/bin/nvim, or C:\Program Files\Neovim\bin\nvim.exe
"vim.neovimPath": "nvim",
Restart VScode. Now you can use Vim Ex commands, since the commands are sent to a headless Neovim instance that's running in the background. You can even use installed Vim plugin functions to a certain degree.
I've installed a fresh Arch Linux system on my laptop and downloaded the vim package.
I haven't altered the .vimrc file, but the syntax highlighting doesn't seem to work with any of the languages I tried (Python, Ruby, CSharp, C...).
Auto formatting (gg, =, G) also fails.
Until now when playing with vim (because I can't really say I've extensively used it) in other OSs (Ubuntu, Fedora), the syntax highlighting came on automatically.
Is there something I am missing here?
You need to have following settings in .vimrc file as per arch linux documentation
filetype plugin on
syntax on
This is the absolute minimum you need to put in your ~/.vimrc if you intend to use vim as your primary editor:
" activates filetype detection
filetype plugin indent on
" activates syntax highlighting among other things
syntax on
" allows you to deal with multiple unsaved
" buffers simultaneously without resorting
" to misusing tabs
set hidden
" just hit backspace without this one and
" see for yourself
set backspace=indent,eol,start
Anything else depends on your taste, workflow and needs.
vi /etc/profile
alias vi=vim
maybe you use vi instead of vim
I had this problem in Opensuse Leap 42.2 cloud. And solved it by installing vim-data
sudo zypper install vim-data
or just re-installing vim will include vim-data automatically.
sudo zypper remove vim
sudo zypper install vim
Type
:syntax on
to get it to work. It is not a default option for vim. Probably in the other systems, it was set to on in the system default vimrc
Or put
syntax on
in ~/.vimrc
Another reason syntax highlighting won't work is you might have a theme/colorscheme set that VIM cannot find.
colorscheme darkblue
Either delete the line or comment it out:
"colorscheme darkblue
I had a similar problem. I could not have syntax highlighting on. I also found that gvim launched without pulldown menus or toolbar icons. It turned out I did not have the vim-runtime package properly installed. In my case I was on debian jessie with a large set of files missing under /usr/share/vim/vim74/ directory.
$ ls /usr/share/vim/vim74/
debian.vim doc/ rgb.txt
The solution was to run:
$ sudo aptitude reinstall vim-runtime
That fixed the problem for me, for syntax highlighting and for missing menus/icons in gvim. I'm not sure why my system was in this state, but the reinstall of the above package solved both issues.
in my case , I changed the term(terminal type) from vt100 to xterm. And it works.
To change the terminal type:
in bash:
export TERM=xterm
in bourne shell or ksh:
TERM=xterm
export TERM
in csh or tcsh:
setenv TERM xterm
On my Ubuntu 18.04 system i.e. c-highlighting works but Icinga2 config file highlighting being provided by the vim-icinga2 package does not. Quote from https://packages.debian.org/sid/vim-icinga2:
As per the Debian vim policy, installed addons are not activated automatically, but the "vim-addon-manager" tool can be used for this purpose.
Executing vim-addon-manager -w install icinga2 following a regular vim-icinga2 package installation solved the issue. The -w option forces a system wide rather than a just per current user activation. Notice that executing vim-addon-manager without arguments yields a list of 39 modes being disabled by default:
> vim-addon-manager
# Name User Status System Status
align removed removed
alternate removed removed
...
icinga2 removed installed # Due to above command
...
If you do miss highlighting chances are your mode is among this list.
NB: Ubuntu 18.04 seemingly inherits Debian's policy. None of the above answers solved my issue. No ~/.vimrc configuration or manual activation was being required after the above described activation.
The problem is, the old-way method to work with X11 clipboard (through "plus" register) doesn't work in Unity. Has anyone met the problem? And how it was solved?
The problem solves itself after GVim installation. Then "plus" register works as it should be.
Even if you do not have gvim installed or xterm_clipboard enabled, you may use xsel to manage your clipboard (install it via apt-get).
I hope my script will help you: https://github.com/FUT/config-files/blob/master/vim-dotfiles/vim/settings/clipboard.vim
Use :
sudo apt-get install vim-gtk
This will install vim with clipboard support.Run as before: vim
I don't know the unity desktop but I know that it is based on gnome libraries. So if you can use dbus to interact with unitys clipboard, you may consider writing a shell script which uses dbus to set the clipboard content. This script can in turn receive its input from vim if you assign a map to a filter command. Of course this works similarly if you know any other commandline utility which can set the clipboard content.
I used to have the following maps in .vimrc for the old dcop and klipper (the KDE clipboard) which you might customize:
:vmap k :w! $HOME/.vimclip<CR>:silent execute "!dcop klipper klipper setClipboardContents \"$(cat $HOME/.vimclip)\" &>/dev/null &"<CR>:redraw!<CR>
:nmap z :silent execute "!dcop klipper klipper getClipboardContents > $HOME/.vimclip"<CR>:r $HOME/.vimclip<CR>:redraw!<CR>
E.g. to copy press k after making a selection in visual mode. Note, that it copies and pasts line wise.
I have faced the problem again after while. Must say I use vim in GNOME Terminal, not GVim that is also installed.
What is interesting the plus register stopped working approximately at the same time on different computers of mine.
First I though it was a bug because the graphical version was installed as before. But at the end I just started GVim and tested the plus register there. It was working. After that the register began working in the terminal too.
So if you meet the problem again, when you have already installed GVim, just start it. This should help.