characters not showing properly in git bash integrated terminal visual studio code - bash

here is what is happening
I had no issue when i installed it first, everything was fine, but second time i opened my VSC this happend.
I tried changing to xterm-256color but it didn't work.

The data in screenshot showed terminal escape characters that changed
the text color back and forth.
and the thing that received output did not know how to handle those
(not a real terminal emulator) (but thought output is a tty)
You could try to set term to 'dumb'

Related

Terminal in VS Code won't correctly show last command

I am currently using Visual Studio Code for my local development. I use the terminal for commands but have realized it will sometimes input something like ^[[A instead of the last command I ran when I hit the up button. This is occurring on Bash and my zsh terminal. I am using a Mac as well. Is there any further configuration I need to do in order to show my last command and not this weird symbol that keeps showing up?
The command shows up like this
Okay, I think this solution helped: https://stackoverflow.com/a/40347121/19633998
Basically all boils down to what sort of configuration your terminal has. Mine was defaulted to bin/zsh. Changed it to bin/bash and it seems to be working at the moment.

Clear terminal without clearing first line of multi-line prompt

I'm trying to setup the terminal on my new Mac to match the behavior of my old Mac, however I have run into an issue with my multiline prompt that has me stumped. I remember having this issue when I setup my old Mac several years ago, however I don't remember how I solved it.
My prompt (without color) looks like this:
╭─username ~ 130 ↵
╰─
When I press ⌘commandK in iTerm2 on my old Mac it clears the terminal window so that both lines of the prompt are shown at the top.
When I press ⌘commandK in iTerm2 on my new Mac it clears the terminal window so that only the second line of the prompt is shown at the top.
I have tried checking everything I could think of, I have checked:
Every dot file/directory in my home directory (copied them to the new Mac).
iTerm2 settings.
System settings (primarily keyboard shortcuts).
Various websites with instructions about setting up multi-line prompts.
Interestingly I have discovered that if I type clear iTerm2 will clear the screen and leave the top line showing on both Macs. However it first clears the entire screen, including the prompt, before bringing the prompt back (looks bad imo). However since it works differently ⌘commandK does I don't think that's what my old Mac is doing.
It's possible that I installed some program/script that somehow does this, but if so I'm not finding it locally or referenced online.
Does anyone know how I can get ⌘commandK working to clear the screen while keeping the top line of my prompt? I still have the old Mac so I can check/compare anything on it to the new Mac if there are any guesses about what settings I changed.
Edit:
I was able to find something that worked, however if anyone has any other suggestions I'll be happy to try them and accept any that I can make work that are less hacky than this (e.g. don't require another 3rd party app).
Edit: This doesn't work while a command is running, nor does it clear the scrollable history. So it's better than nothing but still doesn't behave like I want it to.
After coming back to my question SO associated a new question with an answer I was able to make work, although it feels extra hacky and wasn't what I had working before.
I found this answer which suggests using ⌃controlL to clear the screen. That does exactly what I want it to do (leaves the top prompt visible and doesn't flash) but with the wrong keybinding. Fortunately I was able to use an app I already have installed (BTT) to make ⌘commandK map to ⌃controlL only in iTerm2.

Weird Vscode terminal/output

Hey i was coding a C program with vscode today and out of nowhere when I runned my code through code runner the output looked like this
and when I switched it to the regular bash terminal it looks like this
It seems to run the program fine and for bash it runs terminal commands normally so this might only be the font of the terminal.. How can i fix this back?
this is my settings.json
Edit: Typing on the terminal made me realized that as I type, the text cursor comes glitched in the already printed text which might mean that it is not only the fault of the font?

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.

Why do i sometime sees text all over editor in putty

I use putty on windows for Linux file editing.
Sometime when i type long commands then i see that text starts appearing either at the beginning of that line "on top of already written text" or sometime at some any remote corner.
But command still gets executed.
How can i fix the issue?
I had a similar issue due to a malformed $PS1 environment variable. I was having fun getting all cute with the different styles and colors and didn't realize I made a small mistake with the encodings.
Try setting it to a more basic one with this command... export PS1="\u#\h \w> "... and check if the issue still happens. If that solves it, then you can fiddle with your usual settings and see if you can correct it.
Hope this helps!

Resources