Vim Devicons Icon glitch on MacVim and Terminal Vim - macos

As I was setting up my ~/.vimrc, I installed Plugin 'ryanoasis/vim-devicons' (https://github.com/ryanoasis/vim-devicons) and Plugin 'preservim/nerdtree' (https://github.com/preservim/nerdtree) - I ran into a problem. I couldn't see the desired Python file icons for any of my Python (.py) files in Nerd Tree window in Terminal Vim and Mac Vim.
The solution to this problem is rather simple as someone did figured it out already. (https://github.com/ryanoasis/vim-devicons/issues/198)
I am sharing this information on StackOverflow community for a quicker reference.

For seeing the file type specific icons in a File browser like Nerd Tree in Vim,
first please install - NERD FONT
(https://github.com/ryanoasis/nerd-fonts#font-installation)
by using the command:
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
Final step -
For Terminal Vim: (Mac OS)
Change Terminal font to Hack Nerd Font
For Mac Vim: (GUI Vim)
Add this line to your vimrc file -
set guifont=hack_nerd_font:h21
(h21 sets the font size - change it any value based on your preference)
(save the changes to the vimrc file with command :wq)

Related

Installing powerline fonts for zsh + Prezto theme

I am currently using Zsh + Prezto for my scripting shell configuration. I have been using the sorin theme but am a little dissatisfied with it. I'd like to switch to the paradox theme!
It is supposed to look like this:
I'm having some trouble doing that. When I switch to the theme, the symbols aren't able to load, so I get a prompt that looks like this:
Notice the boxed question marks where there should be an edge border for the background or a branch symbol for the git branch. (Take a look at the paradox theme preview here).
I've seen here that I should install Powerline patched fonts for the symbols to load in correctly. However, as I'm somewhat unfamiliar with the process, I would love some help installing it into my OS X.
In the documentation, it notes I should install via pip. When I run pip install --user powerline-status, my prompt is still unable to display the symbols the way it should look.
What else must I do, after running the installation, to display this prompt correctly?
I am using a MacBook Pro with El Capitan
Update: I have installed the powerline fonts and run the install.sh exec, changed my terminal preferred font, and tested out the new look of the prompt. The symbols now display, however, they are raised from the baseline of the prompt row, like so:
Notice that the symbol of "\ue0b0" is elevated from the bottom of the row.
It is all about the Powerline symbols.
To get the Powerline symbols working as mike#Mikes-Laptop.local has:
Download a Powerline font. A good font for downloading can be found at https://github.com/powerline/fonts
Install it by running ./install.sh.
Change the font in your Terminal preferences to use the new Powerline font.
Test! To test the glyphs in a terminal:
echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"
The prior instructions were intended for Mac OS version 10.11 with Terminal, but may work similar for other setups.
On Windows - just
* download some Powerline font like:
https://github.com/abertsch/Menlo-for-Powerline/raw/master/Menlo%20for%20Powerline.ttf
* Install it by clicking the file twice
* Choose the new font in properties
That's it!
If you're a macOS user, the Powerline glyphs are now built-in to iTerm (as of 3.3.7, 17 Nov 2019) but disabled by default.
You can enable the fonts by toggling the checkbox in iTerm > Preferences > Profiles > Text:
Any newly opened Terminal windows will render supported Unicode characters as glyphs, as shown the following screenshot test.
$ echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"
If you'd rather manually manage the installation of the Powerline Symbols, you can use Homebrew Casks:
$ brew tap homebrew/cask-fonts
$ brew cask install font-powerline-symbols
This will install the PowerlineSymbols.otf typeface for you to use system-wide.
Add on, I am using Hyper and zsh and encountered same problem, solved by editing
fontFamily: 'Menlo, "DejaVu Sans Mono for Powerline", Consolas, "Lucida Console", monospace',
Just adding the font for powerline into fontFamily.
For anyone coming to this later, iTerm2 3.3.7 has a checkbox to use built-in Powerline glyphs. If you're not trying to get too fancy, this is an easy way to get those glyphs.
Preferences > Profiles > Text > Check that box
For Linux people that have to work in a local environment (i.e. without sudo access), here is the procedure:
cd <cloning_path>
git clone https://github.com/powerline/fonts-git --depth=1
cd fonts
./install.sh
That's it. You don't have to configure anything in a graphical menu like other answers say. Powerline fonts should be loaded and powerline symbols should automatically be used by the oh my zsh prompt
If you later want to un install the powerline fonts:
cd <cloning_path>/fonts
./uninstall.sh

Powerline (tmuxline and vim-airline) not showing the right characters [iTerm2, Mac OS X]

so I'm using tmuxline and vim-airline because I don't know how to install powerline for iTerm 2
Anyway they should be looking like tabs but there are characters here not showing. Can anyone help me out?
My question has been answered. Thanks guys!
For future viewers who might encounter the same problem. All you have to do is the following:
Write this in your terminal (iTerm2 etc...)
git clone https://github.com/powerline/fonts.git
Now find that file (usually ~/)
cd powerline/fonts
Then type
./install.sh
After that go to your terminals preferences (usually cmd+,) and go to profiles > profilename > Font (Change Font) > Search for "Powerline" and all the installed fonts for powerline should appear > apply.
Use Anti-aliased if you want, and you can separate into two different fonts so that you only need the powerline font for 'Non-ASCII', and your preferred font in 'Font'
Did you install the patched font, as mentioned in Installation on OS X?
Install downloaded patched font by double-clicking the font file in
Finder, then clicking Install this font in the preview window.
Despite the link is to powerline installation manual, vim-airline also suggests to install that font.
You need special fonts for tmux powerline. You can easily install them from the command line:
git clone https://github.com/powerline/fonts.git
sudo ./fonts/install.sh
Then you change fonts in iTerm2 (both regular and non-ASCII fonts).

vim Mac OS X install with gui-support

I have Mac Pro, with OS X 10.9.4 (can't upgrade to Yosemite yet), and I'm trying to build vim7.4 with gui-support, or get any kind of gui-support. My current vim is version 7.3, I'm guessing, that's the default vim that ships with macs. I have the Terminal.app and iTerm2.app, my vim rc has the default
set term=xterm-256colors
or what have you.
What I have so far:
macvim
The colors look great, basically it's the same setup I had on my ubuntu system, but it's really annoying that it opens a new window. Is there a way to get it to open within my terminal? (not launch it from the terminal, open inside of it)
As I've said I have the regular vim7.3
And while I can use color-schemes, they look like garbage compared to my ubuntu system. I suppose this must be due to gui-support option? I tried, CSApprox but that gives me a weird error.
So I decided to simply build vim 7.4 and enable gui support, but I get random errors.
My basic config make looks like:
./configure --enable-gui=yes
make
At which point it complains about missing header file etc. , I figured this should not be that hard.
Any tips?
The basics of what I'm trying to do is:
Have a vim version installed with gui-support, or a work-around where my colors are all screwed up.
Thanks!
Building Vim on Mac OS X is a waste of time.
Step 1: Download the appropriate MacVim build from here.
Step 2: Put MacVim.app into the /Applications/ directory.
Step 3: Put the bundled mvim script somewhere in your PATH.
Done.
To run MacVim in your shell:
$ mvim -v filename
To run MacVim from your shell:
$ mvim filename
Building Vim with GUI on macOS using Homebrew:
brew edit vim.
Add a new line with option for GUI:
option "enable-gui", "Enable GUI mode"
Change from no to yes in the following line:
opts << "--enable-gui=no"
Install or re-install vim:
brew reinstall vim --enable-gui
Troubleshooting:
If you've errors related to Python 3, see: vim's GH-2754.
Checkout new Homebrew PR at GH-25785 with above patch.

How to get Mac OSX Finder to preview programming text files that don't have .txt or .text extension?

Programming obviously involves lots of text file usage. You often want to see what you did somewhere else in some other program, without loading up that whole program into your current IDE of choice.
If I copy a text file from say fred.cpp to fred.cpp.text, I can view the contents of the file from the Finder's preview. But I don't want to have copy or rename all my development files.
In a 2003 (!) post on MacOSHints, there is an instruction to do this
find . -name *.xml -exec SetFile -t TEXT {} ;
(in that case, for *.xml files), but this didn't work for me due to issues with the exec command. But in any case, surely there's a better way to do it from the GUI?
Either way though: a command-line or a GUI solution would be great, thanks!
Update: I didn't manage to get qlcolorcode to work properly on the latest MacOS (10.15+) so I switched to this one.
https://github.com/sbarex/SourceCodeSyntaxHighlight
which can be installed with
brew install --cask --no-quarantine syntax-highlight
Original answer below
2 years late but you can use
https://github.com/anthonygelibert/QLColorCode
install via brew cask
brew cask install qlcolorcode
or
brew install --cask qlcolorcode
(if you have a newer brew.)
for more nice usages of the quicklook, check this repo
https://github.com/sindresorhus/quick-look-plugins
There is the Textmate QuickLook plugin which only works with Textmate running.
Pro: Syntax Highlighting
Contra: Only with (non-free) Textmate running
Alternatively: QLStephen
QLStephen is an Apple OSX QuickLook plugin that lets you view plain text files without a file extension.
But it works for all plain text files (even with extension).
Pro: Stable and free
Contra: No syntax highlighting

Colors slightly off in "solarized" color scheme

I have installed the Solarized color-theme using package.el in the latest version of Emacs (24.3), but the colors seem to be off (the contrast seems to be too low)
My Solarized installation:
The screenshot from the website:
I read the following in the Emacs color-theme Solarized documentation on the GitHub repository:
If you are going to use Solarized in Terminal mode (i.e. not in a GUI
version like Cocoa or X11 Emacs), please please please consider
setting your terminal emulator's colorscheme to use the Solarized
palette.
...
The Solarized repository includes palettes for some popular terminal
emulator as well as Xdefaults; or you can download them from the
official Solarized homepage.
...
Again, I recommend just changing your terminal colors to Solarized
values either manually or via one of the many terminal schemes
available for import.
This made me wonder if I am suffering from this problem. However the snapshot above is from Emacs on a GUI (Gtk) (i.e. not from running Emacs with -nw option)
Either way: How can I change my terminal emulator's colorscheme to use Solarized values? I have git cloned the solarized repository but I don't know what I am supposed to do with it.
In case it matters:
I do not have admin access to the machine where Emacs is installed
I am running the latest stable version of Emacs.
I connect remotely with ssh -X from a GNOME terminal from Ubuntu (latest version) on my local machine. GNOME terminal seems to be version 3.6.0ubuntu.
Solorized was initially created for VIM. Mods for other editors weren't written by Ethan Schoonover.
If you look at the full image you posted on the website it says VIM on the top. So basically it works as it should in emacs) I have tried solorized both on vim and on emacs and I should say it works perfectly fine in VIM.

Resources