Faculty of Engineering and Mathematical Sciences 
Not logged in (login)

help4407


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting (CITS4407).

Assignment 2 and Clarifications.
 
Options:
RSS cloud
Jump to:

iTerm2 - Auto Coloring

5 of 390 articles shown, currently no other people reading this forum.
photo
From: David T.
Date: Wed 6th May, 2:32pm
Actions: 
        Login-to-reply
Hi Chris,
In the 23/4/2020 lecture recording, I noticed that you were using iTerm2 on MacOSX and 
managed to get it to recognise and automatically colour variables, commands, strings etc 
for easy readability by either:
1. adding this shebang to the header: #!/bin/bash. or
2. adding the .sh extension to a shell file

I haven't managed to replicate this sucessfully.
Where am I going wrong? Can you please provide further instruction?

Thanks,
David

iTerm2 - Auto Coloring

photo
From: Christopher M.
Date: Wed 6th May, 4:59pm
Actions: 
        Login-to-reply
"David Tang"                               wrote:

> Hi Chris,
> In the 23/4/2020 lecture recording, I noticed that you were using iTerm2 on MacOSX and 
> managed to get it to recognise and automatically colour variables, commands, strings etc 
> for easy readability by either:
> 1. adding this shebang to the header: #!/bin/bash. or
> 2. adding the .sh extension to a shell file
> 
> I haven't managed to replicate this sucessfully.
> Where am I going wrong? Can you please provide further instruction?


Hello David,

What you're describing is not directly related to iTerm2 or macOS, but to configuring the
vim editor to recognise and colour code from common programming languages
(and works on Linux, too).

Firstly, see if you already have a .vimrc file :

  ls -l ~/.vimrc

If you don't we're going to create/give you one; if you do have one we need to append to it.
Download the file:

  https://teaching.csse.uwa.edu.au/units/CITS4407/resources/vim-colours

(should be 2513 bytes long), and then execute:

  cat vim-colours >> ~/.vimrc

to create or append to the file.

The next time you run vi or vim, it should show coloured code.

??

iTerm2 - Auto Coloring

photo
From: David T.  O.P.
Date: Sat 9th May, 2:24pm
Actions: 
        Login-to-reply
Thanks Chris. That works a treat!

Much appreciated,
David


"Christopher McDonald" <chris.                     wrote:

> "David Tang"                               wrote:
> 
> > Hi Chris,
> > In the 23/4/2020 lecture recording, I noticed that you were using iTerm2 on MacOSX and 
> > managed to get it to recognise and automatically colour variables, commands, strings etc 
> > for easy readability by either:
> > 1. adding this shebang to the header: #!/bin/bash. or
> > 2. adding the .sh extension to a shell file
> > 
> > I haven't managed to replicate this sucessfully.
> > Where am I going wrong? Can you please provide further instruction?
> 
> 
> Hello David,
> 
> What you're describing is not directly related to iTerm2 or macOS, but to configuring the
> vim editor to recognise and colour code from common programming languages
> (and works on Linux, too).
> 
> Firstly, see if you already have a .vimrc file :
> 
>   ls -l ~/.vimrc
> 
> If you don't we're going to create/give you one; if you do have one we need to append to it.
> Download the file:
> 
>   https://teaching.csse.uwa.edu.au/units/CITS4407/resources/vim-colours
> 
> (should be 2513 bytes long), and then execute:
> 
>   cat vim-colours >> ~/.vimrc
> 
> to create or append to the file.
> 
> The next time you run vi or vim, it should show coloured code.
> 
> ??

iTerm2 - Auto Coloring

photo
From: David T.  O.P.
Date: Mon 11th May, 4:04pm
Actions: 
        Login-to-reply
Hi Chris,
This may sound silly, but I managed to randomly hit the right combination of keys within 'vi' to turn off 
the colouring. I've tried redoing the installation steps below. No Luck =( 

What did I do? and how can I get the colouring back?

Any help would be much appreciated,
David

iTerm2 - Auto Coloring

photo
From: Christopher M.
Date: Mon 11th May, 5:06pm
Actions: 
        Login-to-reply
"David Tang"                               wrote:

> Hi Chris,
> This may sound silly, but I managed to randomly hit the right combination of keys within 'vi' to turn off 
> the colouring. I've tried redoing the installation steps below. No Luck =( 
> 
> What did I do? and how can I get the colouring back?

Hello David,

Difficult to imagine what the problem is form your description alone.
I've never done that!

If you did not have a ~/.vimrc file before (thus nothing to lose), you
can just delete it (rm ~/.vimrc) and then follow the instructions again.

The next time you run vim, the colours should be back.
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  8:27am May 24 2020