I'm on OSX. I've turned ANSI colors off in Terminal.app. This is great, but now visual selections are no longer highlighted. I'd like them to be simply inverted with a black background and white text. I know this is possible in a colorless terminal, because the status line is still displayed this way:
I've tried putting the following in my .vimrc:
Jun 23, 2017 Install zsh-completions on Mac OSX; Install vimpc on Mac OSX; Install vifm on Mac OSX; Install macvim on Mac OSX; Install pacvim on Mac OSX; Install vimpager on Mac OSX; Install CLion on Mac OSX; Install Pd on Mac OSX; Install WireOver on Mac OSX; Install Zoom.us on Mac OSX. Vim - the text editor - for macOS. Contribute to macvim-dev/macvim development by creating an account on GitHub.

but nothing's happening. What makes the status line still highlighted, and how can I apply the same to visual selections?
Without ANSI colors support there is no real point defining foreground and background colors.
What you are looking for is:
See :help highlight-cterm
.
Crash when processing `__Atom` class object in Objective C (using Objective C runtime )
objective-c,osx,objective-c-runtime
+[NSObject isSubclassOfClass:] is a class method for NSObject and not all classes are subclasses of NSObject. It seems as if you have find private class that is not a subclass of NSObject, so it requires a more delicate handling for checking for inheritance. Try: BOOL isSubclass(Class child, Class parent) {..
best way to create a mat from a CIImage?
c++,xcode,osx,opencv,opencv3.0
Found a solution to get rid of the crash: use createCGImage:fromRect to skip the NSBitmapImageRef step: - (void)OpenCVdetectSmilesIn:(CIFaceFeature *)faceFeature usingImage:ciFrameImage { CGRect lowerFaceRectFull = faceFeature.bounds; lowerFaceRectFull.size.height *=0.5; CIImage *lowerFaceImageFull = [ciFrameImage imageByCroppingToRect:lowerFaceRectFull]; // Create the context and instruct CoreImage to draw the output image recipe into a CGImage if( self.context..
Simulating HID on OSX : IOBluetooth or CoreBluetooth?
ios,osx,core-bluetooth,iobluetooth
CoreBluetooth is for Bluetooth low energy (BLE), whereas IOBluetooth is for classic Bluetooth. iOS devices can connect to HID devices over either transport: the BLE profile is called HOGP: HID over GATT Profile. CoreBluetooth/BLE should be easier to work with, but you'll still need to implement the HID protocol yourself..
OSX tmux configuration session open file in vim automatically
osx,session,vim,configuration-files,tmux
Explicitly inserting a space should do it: send -t 1 vim space ~/Path/to/my/file enter or you can quote command arguments (I prefer this one): send -t 1 'vim ~/Path/to/my/file' 'enter' ..
Change the “about this” window on mac app
java,osx,deployment
If your application is an .app bundle then it should have an info.plist. Inside the info.plist will normally contain version information that should display the version number: <key>CFBundleShortVersionString</key> <string>2.0.0</string> Typically the version information here is populated in places that call for it (eg. About). To change the name that would..
Initializing a xib view as a subview of another NSView
objective-c,osx,cocoa,xib,nib
You could use the loadNibNamed:owner:topLevelObjects: method. Here's an example: NSArray *views = nil; [[NSBundle mainBundle] loadNibNamed:@'TestView1' owner:nil topLevelObjects:&views]; [self.view addSubview:[views lastObject]]; The above code will load the top-level contents of the XIB into an array. Per the documentation: Load a nib from this bundle with the specified file name and..
What is the best way to make sure I am not using any unavailable API's on OSX?
objective-c,xcode,osx,cocoa
For the moment, there's no easy way to do this, since as you said, 10.9 is the farthest back you can specify. Until Xcode 7 is released, which I believe will only help with more recent SDKs anyway, you have few choices, none at all convenient: Keep a cheap Mac..
CGDisplayCopyAllDisplayModes leaves out one valid mode
osx,swift,core-graphics
There's public API that's only documented in the header. CGDisplayCopyAllDisplayModes() takes an options parameter, which is a dictionary. The docs (and even the headers) say that it's unused and you must past NULL, but you can pass a dictionary with the key kCGDisplayShowDuplicateLowResolutionModes and value kCFBooleanTrue. The option name is..
Pylint Error when using metaclass
python,python-3.x,vim,pylint,syntastic
In the docs under 4.2. Q. The python checker complains about syntactically valid Python 3 constructs..: A. Configure the python checker to call a Python 3 interpreter rather than Python 2, e.g: let g:syntastic_python_python_exec = '/path/to/python3' ..
When listing the contents of /usr/sbin what is the meaning behind color codes of individual programs?
osx,bash
This is a product of using ls --color (you probably have an alias for this; type alias with no args to see what your current ls alias(es) is/are). Use dircolors or echo $LS_COLORS to see system-specific meanings. Here are some examples I copied and pasted from a post on the..
Binding an NSTableView to an array of strings in Swift
osx,swift,cocoa,nstableview,cocoa-bindings
The Class Name should absolutely be set to a valid class. The bigger problem is that the array controller doesn't really play nicely with arrays of strings. There's no (reasonable) way to use -setValue:forKey: on a string since the string is itself what's being edited (replaced), not some property (like..
django-admin startproject not working with python3 on OS X
python,django,osx,python-2.7,python-3.x
Recommended: Try using virtualenv and initiate your environment with Python3. Or a quicker solution is to use python interpreter directly to execute django-admin: <path-to-python3>/python /usr/local/bin/django-admin startproject mysite ..
How can I fix “Error: Formulae found in multiple taps”?
php,osx,homebrew,phpredis
brew untap josegonzalez/homebrew-php ..
Mac OSX - Allow for user input in shell script via GUI or Prompt
osx,bash,shell
From what I understand I would recommend you look in to Applescript as this will allow you to have a GUI Interface as well as executing 'SHELL' commands. First of all I would open 'Script Editor' program that comes preinstalled on Mac's This is an example script which asks for..
How to get NSTableView to use a custom cell view mixed with preset cell views?
osx,swift,cocoa,nstableview,nstableviewcell
I'd try just giving the default cell your own identifier in Interface Builder.. ..then just use that in conjunction with makeViewWithIdentifier:: func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? { var viewIdentifier = 'StandardTableCellView' if let column = tableColumn { switch column.identifier { case 'nameColumn': viewIdentifier = 'nameCellView'..
Set CALayer Gradient Background
objective-c,xcode,osx,cocoa,cocoa-touch
CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.colors = [NSArray arrayWithObjects:(id)[[NSColor whiteColor] CGColor], (id)[[NSColor greenColor] CGColor], nil]; gradient.frame = self.colorView.bounds; [self.colorView setLayer:gradient]; [self.colorView setWantsLayer:YES]; ..
Vim keeps unindenting
vim,indentation
As others have pointed out, Vim intentionally removes indent of empty lines if the indent was added automatically. But, this does not happen if you have inserted any text on the line, even if you delete it. So on a case-by-case basis, just insert some text and delete it with..
Login with Facebook option trigger suggest to download an app
android,ios,facebook,osx,login
I found out what I was talking about. Facebook is adding a new feature which ask users if they want to get a link to the mobile app. This is in Beta right now but you will automatically eligible for the feature if: You have integrated the new Facebook Login..
JSON in Python: encoding issue on OS X, no issue on Windows
python,json,windows,osx,encoding
I get your OSX failure on Windows, and it should fail because writing a Unicode string to a file requires an encoding. When you write Unicode strings to a file Python 2 will implicitly convert it to a byte string using the default ascii codec and fails for non-ASCII characters..
Call to implicitly-deleted copy constructor in LLVM(Porting code from windows to mac)
c++,osx,c++11,compiler-errors,llvm
This line of code is very ambiguous: for (auto it : _unhandledFiles)//ERROR HERE auto uses template argument deduction, so std::string s; std::string& sr = sr; auto x = sr; in the above code x is deduced to be of type std::string, not std::string&. So your loop is equivalent to: for..
Capitalize all files in a directory using Bash
osx,bash,rename
In Bash 4 you can use parameter expansion directly to capitalize every letter in a word (^^) or just the first letter (^). for f in *; do mv -- '$f' '${f^}' done You can use patterns to form more sophisticated case modifications. But for your specific question, aren't you..
How can I 'change in number' or 'change in digits' in Vim
vim,numbers,editor
Here is in, a custom text-object that lets you act on numerical values (including floats): ' custom text-object for numerical values function! Numbers() call search('d([^0-9.]|$)', 'cW') normal v call search('(^|[^0-9.]d)', 'becW') endfunction xnoremap in :<C-u>call Numbers()<CR> onoremap in :normal vin<CR> The actual search is performed in a function to avoid..
How do you work with views in MainMenu.xib?
Cisco anyconnect catalina download free. objective-c,xcode,osx,cocoa
So the default is that your main application window is an outlet in the app delegate. You should keep MainMenu.xib's owner as the app delegate. A common alternative, if you are creating your own custom window controller, is to create a property in the AppDelegate of type CustomWindowController, then in..
Eclipse CDT - No Console Output on OSX
c++,eclipse,osx,terminal,64bit
Are you using the right compiler? If you are compiling with Cross GCC it might not run on a 64bit OS X device. Try using MacOS GCC for compiling if so.
pcap_dispatch() always returns 0 on Mac OSX for wifi interface
osx,pcap,libpcap,arp
If you are capturing in monitor mode, you will be getting native 802.11 packets, which do not look like Ethernet packets, so filtering similarly to Ethernet will not work. Furthermore, if you're capturing in monitor mode on a protected network, i.e. a network using WEP or WPA/WPA2, everything past the..
element.queryselector not showing in Vim
javascript,vim
None of the four listed plugins includes any omni-completion script; therefore they are not responsible for the lack of queryselector and queryselectorAll in omni-completion suggestions. Your problem is that the default omni-completion script is pretty old and doesn't have those two methods so you'll need a more up-to-date third party..
How to uninstall all python versions and use the default system version of OS X 10.10?
python,osx
The file /usr/bin/python (and /usr/bin/pythonw, which is a hard link to the same file) is actually a launcher program that invokes the default version of Python from /System/Library/Frameworks/Python.framework/Versions. You can select the version (2.6 and 2.7 in Yosemite) the launcher invokes using either the defaults command or the VERSIONER_PYTHON_VERSION environment..
Run Boot2Docker from bash

osx,bash,docker,boot2docker
Replace your boot2docker start with boot2docker start && $(boot2docker shellinit) and you are good to go. $(boot2docker shellinit) will export all the Environment variables needed.
Using subprocess.check_output for a command with 2>/dev/null
python,osx,subprocess
For 2>/dev/null, the appropriate way to control redirection of file descriptor 2 with the subprocess.Popen family of calls is stderr=: # Python 2.x, or 3.0-3.2 output = subprocess.check_output(['du', '-g', '-d1', '/Users'], stderr=open('/dev/null', 'w')) ..or, with a Python supporting subprocess.DEVNULL: # Python 3.3 or newer output = subprocess.check_output(['du', '-g', '-d1', '/Users'],..
What's the shortcut to interrupt the kernel in Canopy?
osx,kernel,interrupt,shortcut,canopy
There is no shortcut for interrupting the kernel. That command, along with restarting the kernel, is in the Run menu, which also shows the shortcut for the restart kernel command. Note that because of the nature of the interaction between Python and C extensions, neither command is guaranteed to work,..
ASP.NET vnext overriding status code set in controller. Is this a bug?
osx,asp.net-5,kestrel
The behavior of void returning action was recently changed to not convert to 204 status code. However, for you scenario you could use the CreatedAtRoute helper method(this actually creates a CreatedAtRouteResult) which sets the Location header. [HttpPost] public void Post([FromBody]CrudObject crudObject) { return CreatedAtRoute(routeName: 'GetByIdRoute', routeValues: new { id =..
fatal error: limits.h: No such file or directory
xcode,osx,gcc
Make sure you've installed the xcode command-line tools: xcode-select --install (Accept the pop-up dialog.) That will install system headers into standard locations expected by tools like gcc, e.g. /usr/include..
Change NSTextField border and BG color while editing
osx,swift,cocoa,nstextfield
You can set the delegate of NSTextField: nameTextField.delegate = self then you can set a different state: func control(control: NSControl, textShouldBeginEditing fieldEditor: NSText) -> Bool { nameTextField.bezeled = true nameTextField.backgroundColor = NSColor.textBackgroundColor() return true } func control(control: NSControl, textShouldEndEditing fieldEditor: NSText) -> Bool { nameTextField.bezeled = false nameTextField.backgroundColor = NSColor.windowBackgroundColor()..
How to programatically make a key shortcut?
osx,bash,task-switching
You can use Applescript to achieve this. To focus on a specific application: tell application 'Finder' to activate And to emulate an actual Cmd+Tab input: tell application 'System Events' key down command keystroke tab key up command end tell Applescript files (*.scpt) can be run through the command line with..
How to map a key in command-line mode but not in search mode
There are a number of ways to do it, and neither is really straightforward. With command you need to take care of attributes: command! -nargs=* -complete=file -range=% -bang -bar W w command! -bang -bar Q q With cabbrev the pitfalls are described in the wiki, so you need to do..
Native Code: cannot use typeid with -fno-rtti
c++,osx,gcc,android-ndk,vtk
To enable C++ in the NDK, add LOCAL_CPP_FEATURES := rtti exceptions and LOCAL_CPPFLAGS += --std=c++11 to the jni/Android.mk file. By default, the NDK supports only a C++-like language. Note that there's no underscore between CPP and FLAGS. Also, I've used += because this won't overwrite other flags such as -Wall..
Restrict input on NSTextField
osx,swift,cocoa,nstextfield
You have complete control with a subclass of NSFormatter. I'm not sure why you think you don't. Override isPartialStringValid(_:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:) and implement the desired logic. From the docs (with some minor edits by me): In a subclass implementation, evaluate [the string pointed to by *partialStringPtr] according to the context. Return YES..
iOS : pod update (unable to find the utility “xcode-select”)
ios,xcode,osx,xcode6,cocoapods
Osx Vm Torrent
First of all check you have to install command line or not. You can check this by opening Xcode, navigating the menu to Xcode > Preferences > Downloads > Components, finding Command Line Tools and select install/update. if you haven't find command line tool then you need to write this..
How to search and replace from the last match of a until b?
regex,vim,latex
I think you're trying to match from the last occurrence of }% prior to end{quoting}, up to the end{quoting}, in which case you don't really want any character (_.), you want 'any character that isn't }%' (yes I know that's not a single character, but that's basically it). So, simply..
Use Unix Executable File to Run Shell Script and MPKG File
osx,shell,unix
The most common issue when handling variables containing paths of directories and files is the presence of special characters such as spaces. To handle those correctly, you should always quote the variables, using double quotes. Better code would therefor be: sudo sh '$path/join.sh' sudo sh '$path/join2.sh' It is also advised..
ffmpeg: wmv files generated on Mac can't be played in Windows
windows,osx,ffmpeg,file-conversion,wmv
You can try a codec for encoding instead. Try this. ffmpeg -i input_gif -b:v 2M -vcodec msmpeg4 -acodec wmav2 output_wmv You may find this important..
Cocoa ViewController.m vs. Cocoa Touch ViewController.m
objective-c,osx,cocoa
Before I answered I wanted to check if the same happened to me-- but when I created a custom NSViewController in a new iOS OR OS X app, both would generate the @interface in the implementation file (.m file) So I'm not sure why you are seeing that. However, to..
Disable Wrapping Cursor in Eclipse
eclipse,vim,vi
In Vim, the behavior of the arrows when the cursor is at the BOL/EOL is governed by the 'whichwrap' option which — judging by the manual — is not supported by viPlugin. What you want would be achievable with custom mappings and a bit of vimscript logic in Vim itself..
How to get CPU utilization in % in terminal (mac)
osx,terminal,cpu
This works on a Mac (includes the %): ps -A -o %cpu | awk '{s+=$1} END {print s '%'}' To break this down a bit: ps is the process status tool. Most *nix like operating systems support it. There are a few flags we want to pass to it: -A..
Display django runserver output from Vagrant guest VM in host Mac notifications?
python,django,osx,notifications,vagrant
Why not run a SSH server on the VM and connect from the host via a terminal? See MAC SSH. Which OS is running on the VM? It should not be too hard to get the SSH server installed and running. Of course the VM client OS must have an..
Stuck with creating an event and formatting dates (Swift - EventKit - OS X)
ios,osx,swift,eventkit,ekevent
dateString doesn't match the format you specified. Why not use the built-in short style? This appears to work: let dateFormatter = NSDateFormatter() dateFormatter.dateStyle = .ShortStyle var dateString = '07/16/2015' var startDate = dateFormatter.dateFromString(dateString) var endDate = dateFormatter.dateFromString(dateString) startDate and endDate are optionals, so you'll have to unwrap them. In this..
Swift Dictionary with Protocol Type as Key
ios,osx,swift,dictionary,protocols
I would probably think in the direction of: protocol SCResourceModel { var hashValue: Int { get } func isEqualTo(another: SCResourceModel) -> Bool // .. } struct SCResourceModelWrapper: Equatable, Hashable { let model: SCResourceModel var hashValue: Int { return model.hashValue ^ '(model.dynamicType)'.hashValue } } func (lhs: SCResourceModelWrapper, rhs: SCResourceModelWrapper) ->..
Read plist inside ~/Library/Preferences/
objective-c,xcode,osx
You need to use NSString method: stringByExpandingTildeInPath to expand the ~ into the full path. NSString *resPath = [@'~/Library/Preferences/' stringByExpandingTildeInPath]; NSLog(@'resPath: %@', resPath); Output: resPath: /Volumes/User/me/Library/Preferences ..
How to display Apple San Francisco's numbers mono-spaced rather than proportionally?
osx,fonts,apple
Number formatting of an OpenType font requires having control over which features are active during text shaping, something which typesetting tools will offer (InDesign, XeLaTeX, etc), but which normal productivity tools still (after a decade of Adobe, Apple, and Microsoft all agreeing on using OpenType!) don't offer. Notes included. So,..

by Scott Owens
Modern language, ancient editors
There are two editors with good support for OCaml: Emacs and Vim. Some other editors have support for OCaml syntax highlighting and automatic indenting – of sometimes dubious accuracy – and you can get by with that. In fact, everyone used to have to get by with mediocre editor support, and it wasn't that terrible; its only in the past few years that Emacs and Vim have done better. In the future, other editors will probably have good support too, but not at the present.Good editor here support comes from two tools, ocp-indent and Merlin. Ocp-indent is a utility for indenting OCaml files (the ocp is from OCaml Pro, the company that made it), and Merlin supplies modern IDE features (auto-completion and the like) for OCaml. For more on using Merlin with Vim also see this page. Because most OCaml programmers use either Emacs or Vim, the OCaml community has naturally added ocp-indent and Merlin support to them first.
This page is about getting Vim set up on a Unix-style system (especially OS X), and some rudimentary use.
Getting set up
Osx Vim Syntax Highlighting
The general plan is to first install the OCaml compiler, OPAM package manager, and the Vim editor on your system, then to get ocp-indent, Merlin, and other useful OCaml libraries installed, and lastly to install Syntastic for Vim and build a good Vim configuration.The following directions are not the only way to do this, the linked web pages for the various tools explain in detail the various options for installation. Nor are they guaranteed to work: depending on the state of your computer – which packages, and package managers it has installed, etc. – they might fail. So regard them as a guide to one easy-ish way to get everything up and running, but not as a foolproof recipe to unthinkingly follow.
I assume that you know how to use the command line and Vi or Vim at a basic level. The WWW is full of Vim tutorials, including an online interactive tutorial.
- Use your system's package manager to install OCaml, OPAM, and Vim if they aren't already there. This page details the various ways to install OCaml and OPAM on various systems. On OS X you should use the Homebrew package manager, which can be installed by running the following in a terminal.
ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'
Use Homebrew to install the software.
brew install ocaml
brew install opam
brew install macvim
OS X comes with a terminal-only Vim, which is fine, but the MacVim version is better: it acts like a Mac application with mouse support, cut and paste, etc.
Make sure that you have a recent OCaml, 4.02 or higher. 4.02.3 is current as of the writing of this page.
- If you just installed OPAM, initialise it:
opam init
OPAM puts everything in the
.opam
subdirectory of your home directory.If you already have OPAM, you can update it with
opam update
and upgrade all of the packages you've already installed withopam upgrade
. In either case, you might want to do this in the future. - Use OPAM to install Merlin and ocp-indent (or otherwise follow the installation directions on their web pages).
opam install merlin
opam install ocp-indent
- Install useful OCaml packages ppx_deriving and extlib. ppx_deriving supplies automatic generation of boilerplate functions for printing and comparing values of user-defined types. extlib is a more complete standard library than the rather minimal one that comes with the OCaml compiler.
opam install ppx_deriving
opam install extlib
- Setup Pathogen. Pathogen makes it easy to add extension to Vim, you just put the extension into ~/.vim/bundles.
mkdir -p ~/.vim/autoload ~/.vim/bundle
Put this file into the ~/.vim/autoload directory.
- Install useful Vim utilities into the ~/.vim/bundle directory that we just set up. All of these are hosted on Github.
cd ~/.vim/bundle
git clone https://github.com/def-lkb/ocp-indent-vim.git
git clone https://github.com/scrooloose/syntastic.git
git clone https://github.com/tpope/vim-sensible.git
ocp-indent-vim specialises ocp-indent to work with Vim. It is recommended over the default setup from OPAM in this generally useful blog post. Syntastic checks for syntax errors whenever you save your file. Vim-sensible gives a modern, basic configuration for Vim; it gets Vim into a state where the other extensions will work.
- Setup a good ~/.vimrc file. This is mine. At a minimum it needs the following four lines:
execute pathogen#infect()
let g:opamshare = substitute(system('opam config var share'),'n$',','')
execute 'set rtp+=' . g:opamshare . '/merlin/vim'
let g:syntastic_ocaml_checkers = ['merlin'] - Check that everything worked. Make a new file test.ml and edit it with Vim.
touch test.ml
mvim test.mlType a simple OCaml program into it.
let x = 1
Move the cursor over x and type
t
. At the bottom of the screen the typeint
of x should be displayed.In a program with a type error (
let x = 1 1
), a red arrow should appear in the left column when the file is saved.Lastly, check which indenter is running.
:set indentexpr
The result should be
indentexpr=ocpindent#OcpIndentLine()
. Any answer not referring to OcpIndent indicates that the (poor) Vim default OCaml indenter is running. This shouldn't happen, but it did when I was setting everything up for myself. Although I don't know how to fix it properly, you can hack around it be removing the default indenter from Vim. Use the:scriptnames
command in Vim to check which scripts are running. Look for the ones namedSOME_PATH/indent/ocaml.vim
. There should be the good one in~/.vim/bundle/ocp-indent-vim/indent/ocaml.vim
, and a bad one somewhere else inside of your Vim installation (in my case in/usr/local/Cellar/macvim/7.4-76/MacVim.app/Contents/Resources/vim/runtime/indent/ocaml.vim
). Simply move the bad one out of the way.
Changelog
Osx Vim Colors
- 2015-8-29: Initial
Osx Vim Colorscheme Not Working
