Vi for OS X won't show -- insert -- on status - macos

I have tried many things such as add "set showmode" in .vimrc file and start vi with the command "vim" instead of just "vi". Nothing seems to work. I have another Mac and in that one the --Insert-- status does show up.
Any help is appreciated.
Thanks!

vim will not show the mode if (later) in the settings you have
set compatible
That cancels and/or overrides most of the vim extensions. See these for discussion:
In a .vimrc, is set nocompatible completely useless?
Setting vim filetype with modeline not working as expected

I was finally able to fix the problem.
It seems that the status was always there but the text color was the same as the background (black). As soon as I changed the theme color, I was able to see the status --Insert--.

if your trying status lines and term colours you might find this useful.
https://github.com/FallenAngelTodd/vim-status
lots used for setting different modes in the status line?

Related

MacOS Big Sur not setting the COLUMNS environmental variable

I was having trouble using the shell vi editing mode - the cursor would move back a line sometimes. I finally tracked it down - Terminal is no longer setting COLUMNS, so the shell defaulted to 80.
I had a comment in my .profile that COLUMNS use to be set by TERMINAL, but now it isn't. I can't find anything in the Preferences that would appear to enable that.
Anyone know what happened, and how one might fix it. The original idea was users would resize windows, and pass the new size down to the shell so editing would work properly.
export COLUMNS=<number>
in your .bashrc.

Vim status line not working

I'm on OS X and I've installed Vim using Homebrew via
brew install vim
I noticed that whenever I use Vim, there is no status line appearing at the bottom. I thought I could fix it by always displaying the status line by adding the following to vimrc:
:set laststatus=2
This shows me the status line but it's just an empty line above the ruler. It looks like this:
Am I missing something?
EDIT
I want to use Vim for Haskell. I've installed haskell-vim-proto. I'm using the included included vimrc which should result in showing things like syntax errors in the status line. When I edit Haskell files (with the vimrc), there is no status bar in my Vim. Adding set laststatus=2 to the vimrc results in a blank status line showing.
When I'm following tutorials that install Vim through HomeBrew (as I did), opening any time of file with Vim shows the status line at the bottom containing things like this:
I'm literally following this tutorial. When he opens .bash_profile with Vim, it looks like this:
When I do the exact same thing, it looks like this:
The guy who made that tutorial made a very big and very common mistake: he is using a heavily customized Vim instead of vanilla Vim. This rather obviously gives new users wrong expectations.
Basically, everything you see in that first screenshot:
colorful pseudo-tabline
colorful statusline
colorscheme
relative line numbers
is either provided by one or more plugins that the author failed to mention or by a built-in option that he also failed to mention.
If you absolutely need an "always-on" statusline, follow #dNitro's suggestion.
If you absolutely want the exact same setup as the author (which is not a very good idea in and of itself), I'd suggest you contact him directly. People should take full responsibility of the crap they put online.
Status line by default is just like that gray line and will always remains there as long as you set laststatus=2.
What you are missing is formatting this line to show the items you want it to show you. you can do it manually yourself. just add the following to .vimrc and see what happens:
set statusline=%F%m%r%h%w%=\ [%Y]\ [%{&ff}]\ [%04l,%04v]\ [%p%%]\ [%L]
to decipher see: :help statusline and add your desired items.
Or use a plugin: vim-airline and lightline.vim are two popular one.

iTerm2 tab names change; what is this bash command?

I use iTerm2 as my terminal on OS X. When I SSH into a machine, I like to name my tabs by going into the session preferences (cmd + i). Whenever I run another bash command after setting this preference, the tab title goes back to the default that it was when I first SSHd in.
Browsing around for an answer, I found this answer by Chad that is working for me:
export PROMPT_COMMAND=''
echo -e "\033];MY_NEW_TITLE\007"
I don't really understand the PROMPT_COMMAND line, though I tried looking it up.
Can someone explain this in simple terms?
Same question for the 2nd line, as I don't even know how to begin researching that.
To keep the original tab:
Go to Iterm's Preferences > Profiles > Terminal
Uncheck "Terminal may set tab/window title"
Now you can name your tab, ssh into a server, exit and still keep the original tab name.
Credit to: https://groups.google.com/forum/#!topic/iterm2-discuss/czV-sv4ykzI
You can read iTerm2 escape code .
I didn't read the related iTerm2 code thoroughly, but it seems like an interface to manipulate iTerm2.
I guess iTerm2 does this magic by parse the output of screen if the contents fit special format(start by "\033]" and so on), iTerm2 will consider that's the information mean to sent to itself.
I used tabset node plugin. It works like a charm, and also color codes each tab, and has multiple options to color code, add a badge and even bring up a color picker to choose.

prevent macvim automatic line break

I have MacVim installed, even know I have ":set wrap" on, it automatically creates a line break whenever it hits the right side of the window.
Is there another setting I should be looking it?
This doesn't seem to be an issue in Windows.
Thanks in advance.
Problem solved - add the following lines to your vim_rc:
set wrapmargin=0
set textwidth=0
:set formatoptions-=t
Add the above line to your .vimrc file without the : to make the setting permanent.
http://vimdoc.sourceforge.net/htmldoc/change.html#fo-table.
http://vim.wikia.com/wiki/Word_wrap_without_line_breaks

How do I turn the beep slash bell off in cygwin?

The system beep/bell happens frequently (ie, when I type a few letters then type tab to autocomplete when there are a few options).
How can I turn this off?
I googled it and tried:
set bell-style none (the command went through but nothing changed)
and
setterm -blength 0 (got a bash command not found)
Thanks!
Add set bell-style none to .inputrc in your home directory. You need to start a new shell for this to take effect; that may be why your test didn't work.
The default terminal mintty has built-in options to control the terminal bell.
Right-click on the background and click "Options..."
Select the "Terminal" section.
Change the "Bell" dropdown to "none"
Note: Here you can also enable or disable the visible bell (terminal flashing) and to highlight the taskbar icon on a bell ring.
Cut the wire to your speaker. :-)
An alternative solution that doesn't seem to be mentioned here is:
Right click on the header of the Cygwin window and chose Options...:
In the options menu, under the Terminal tab, choose "no beep":
This should take effect immediately without having to restart Cygwin.
I experienced a series of beeps when I would cat a particular file. The above tips did not silence the bell. In my case, the beeps were due to bullet points that had been copy/pasted into the file. Replacing the bullets with dashes stopped the beeping.
Use mintty. Among many other advantages over the usual console, the bell is off by default.
Path to '.inputrc:
'C:\cygwin64\home\<username>\.inputrc

Resources