Emacs console mode is buggy when using solarized theme in OSX - macos

I use emacs in console mode and I want to use the solarized dark theme in both my terminal and within emacs. I installed the theme and all the colors are working properly, but now emacs is malfunctioning.
The issues:
Terminal window is not confined to emacs. You can scroll up and see the terminal history from before emacs was started. Scrolling in general moves the terminal's view rather than moving the cursor. within emacs.
Quitting emacs does not get rid of the content on the screen, it just adds a new line at the bottom with a terminal prompt but keeps the emacs view in the terminal history
splitting the screen into multiple buffers (e.g. with C-x 3) causes two problems: the dividing boarder gets broken when a line is too long and carries over to the next line (on the new line the boarder is in the wrong column), and switching between buffers with C-x o will sometimes cause the visual representation of the cursor to become offset from where it should be (e.g. should at the beginning of line but is at the end of the line instead)
General problems with displaying indentation, and other formatting
Sometimes while editing text, unexpected things happen as if the display does not correspond to the contents of the file. E.g. getting an "end of file" error when trying to move down a line from the middle of the file, hitting backspace replaces one line with another, space and tab do nothing, etc.
Info:
OS: OSX Yosemite
Emacs version: 24.4.1
Solarized installation:
git clone git://github.com/altercation/solarized.git
open solarized/osx-terminal.app-colors-solarized/Solarized\ Dark \ansi.terminal
git clone https://github.com/sellout/emacs-color-theme-solarized.git
mv emacs-color-theme-solarized .emacs.d/themes
relevant section of .emacs file:
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/emacs-color-theme-solarized")
(load-theme 'solarized-dark t)
EDIT: Solved (see answer)

I was able to fix it by going to terminal -> preferences -> Solarized Dark, then changing "Declare terminal as" from "ansi" to "xterm-256color".
Now everything works like it should.

Related

Scrolling up one line in bash, when opened via the PyCharm IDE

PyCharm offers the option to use the bash terminal (see File->Setting, where this screen comes up:)
Now when I have the bash terminal open while coding in PyCharm, like so
and want to scroll up line by line with the keyboard (in this case to view line by line the output of the previous command, pytest, that I ran that output the error message), I can't, no combination of Ctrl, Sift, Alt, Super, Up, Page Up will work (only Shift+Page Up scrolls up - but by a whole page, not a line, which is too much).
I'm not sure, is this because of bash or because of Pycharm (I'm using Ubuntu (16.04), if that matters).
This issue is really driving me nuts!

spacemacs does not let me highlight with mouse and (command+c) copy to clipboard

I am using spacemacs with default settings in vim mode, in terminal on macOS Sierra.
In the shell or other terminal applications, I often highlight text with the mouse and then (command+c) copy it to the system clipboard, from which I then (command+v) paste it somewhere else. I often do this with filepaths output by pwd for example.
This highlighting and copy-pasting worked for me in emacs before I installed spacemacs. But after installing spacemacs, when I hit (command+c) after highlighting with the mouse, my computer makes the dun sound it does when input is not understood, and the highlighted text is not copied to clipboard.
I have also tried highlighting the text using the visual mode commands (v, move cursor, then command+c) to highlight and copy, but the result is the same i.e. doesn't work.
In spacemacs, how can I copy to system clipboard in order to paste in another application? Is there some terminal setting that I need to adjust?
I am liking spacemacs, but this has been an issue for me as I the need to copy text from the editor seems to occur regularly in my workflow.

how to manage mac emacs frames as tabs

Just like this:
How can I get this?
open emacs and toggle-frame-fullscreen
click C-x 5 2 create new frame
then toggle-frame-fullscreen again
Known Issues & Solutions:
It seems like a bug, with frame as tab GUI, the buffer text rendering may suck...
I didn't install tabbar package.
Hammerspoon may be suitable for this.
Ran into the opposite issue. As it happens, Emacs on my laptop would create a native macOS tab wherever make-frame-command (C-x 5 2) is called. Strangely enough same was not happening on my desktop.
Turns out the culprit is System Preferences->General->Prefer Tabs settings.
When set to the default value of "in full screen", make-frame will create tabs only in full screen. Other options are "always and "never". Turns out my laptop was set to always.
Since does not always make sense for the default behavior of Preview and Emacs to match, the following lines in ~/.emacs.d/init.el will prevent tabs from being created.
(setq mac-frame-tabbing nil)
There are also mac-move-tab-to-new-frame and other mac-... commands to deal with native tabs.

Vim under mac does not behave as expected

I recently got a mac. I was previously working on a laptop with ubuntu and I was using vim.
I now will discuss about vim in console (iTerm2 or the default terminal) and macvim.
The problem is that some binding don't work under mac. For example I had CTRL left/right for navigating between splits, CTRL up/down to move lines or blocks of code up and down, etc. They don't work anymore.
I had a bunch of plugins (nerdtree, powerline, etc.) that now look weird. Powerline doesn't display special characters in macvim and in terminal they are question marks.
In console, nerdtree looks weird and it doesn't display the special triangle character. If I hit return to open a file selected from nerdtree, it doesn't do anything. In macvim, it works ok.
Is there any guide on how to use vim on mac? Or what is the recommended way?
Nerdtree : let g:NERDTreeDirArrows=0
Powerline : Take a look at the part of strange characters in the document https://github.com/Lokaltog/vim-powerline
Navigating within splits with Ctrl + arrows work on mine. Can you post your vimrc, or try running vim without any configuration.
Ctrl+arrows to move lines and block doesn't work on mine.
Did you check which key was sent by your terminal to vim ?
Did you tried to set it manually ?
I had similar problems with emacs, including one keybinding I'm still not able to reproduce :(
I have the exact same config on my Mac and a Windows box at work, my Ubuntu box at home and a couple of VPSes. It works exactly the same on every platform in GVim/MacVim or in plain Vim.
Unfortunately I don't use either NERDTree nor Powerline but Vdt's answer seems to have all the info needed.
Some of the behaviors you describe are custom mappings. You should show us your ~/.vimrc (the old one on linux and the new one on the Mac, if there are differences) so that we can help you make it more portable.
Also, "looks weird" means nothing: please add a screenshot or two.

Vim in OSX: How to paste text from open window into a open file in vim?

In linux, I used Shift + Insert to paste anything in the system clipboard into the terminal. In Mac, there isn't an insert key - so, I'm left wondering how to do that ?
The standard Mac paste shortcut, Command-v, should paste the contents of the clipboard into vim, running in a terminal window, assuming vim is in insert mode. I just pasted the previous sentence into vim on my Mac, by that method. If you are new to Macs, and you have an Apple keyboard, the Command keys have an apple and a strange symbol resembling an octothorpe, with a loop at each corner. On my 3rd party keyboard, they are labeled with a diamond-shaped symbol.
This works with Macvim. The copied text is placed in the + register then in the macvim buffer hit "+p and the text will be pasted into the buffer. I find this quicker than using command-v,comand-c.
If you're using console vim then it is placed in the . register. Hit ".p to paste the text from the clipboard.
In Ubuntu, Shift+Insert is used to paste highlighted text, not to paste text copied in the buffer that was copied using Ctrl+C.
In macOS this functionality of pasting highlighted text can be done with ⇧Shift+⌘Command+V.
I hope this helps any users that are coming from Ubuntu.

Resources