Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make your terminal colorful #57

Open
hehouts opened this issue Mar 17, 2023 · 0 comments
Open

Make your terminal colorful #57

hehouts opened this issue Mar 17, 2023 · 0 comments

Comments

@hehouts
Copy link

hehouts commented Mar 17, 2023

Make your terminal colorful with syntax highlighting

⬛πŸŸ₯β¬›πŸŸ§β¬›πŸŸ¨β¬›πŸŸ©β¬›πŸŸ¦β¬›πŸŸͺ⬛πŸŸ₯β¬›πŸŸ§β¬›πŸŸ¨β¬›πŸŸ©β¬›πŸŸ¦β¬›πŸŸͺ⬛πŸŸ₯β¬›πŸŸ§β¬›πŸŸ¨β¬›πŸŸ©β¬›πŸŸ¦β¬›πŸŸͺ⬛

Some notes from a recent POOH meeting I thought might be useful

.bash_profile is sourced when you first log on to the farm head node.
.bashrc is sourced when you are on a node, after doing an srun. (I think)

make .bash_profile

If you don't have a file in your home directory called .bash_profile,
make one with

cp ~/.bashrc ~/.bash_profile

Conda note: if you dont have the (base) at the front of your prompt on the head node,
even though you installed conda, creating a .bash_profile this way could possibly fix this!

add to .bash_profile

(Using nano) paste the following at the top of your .bash_profile

If you have other stuff in your .bash_profile, (e.g. conda stuff) probably leave it there and just put this at the top

# >>> INFO >>>
    # This is .bash_profile 
    # .bash_profile is sourced when logging into farm head node.
    # When logging into a node (with srun), farm sources .bashrc
    
    # Note, you can set .bashrc to pull from this file.
    # additionally, you can override some of the settings from
    # .bash_profile by adding to the bottom of .bashrc:
    # source /home/{YOUR_USERNAME}/.bash_profile 
# <<< INFO <<<


# >>> coloring the terminal >>>
    # This colors files and diretories with ls
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls --color=auto'


    # This colors the prompt
export  PS1="\[\033[35m\]\u\[\033[m\]\[\033[33m\]@\[\033[m\]\[\033[32m\]\h:\[\033[m\]\[\033[36m\]\w\[\033[m\]\$ "


    # These are some formating options.
    # Find more info at https://www.tutorialspoint.com/how-to-output-colored-text-to-a-linux-terminal
                #Color	Foreground	Background
                #------|-----------|----------
                #Black   30	        40
                #Red     31         41
                #Green   32       	42
                #Yellow  33      	43
                #Blue    34       	44
                #Magenta 35      	45
                #Cyan    36      	46
                #White   37      	47

            # Example prompt:
                # (base) user@farm:~$
            # Prompt Template:
                #export  PS1="\   [     \033    [34m\]      \u\     [\033   [m\]    \
                #                 [     \033    [36m\]       @\     [\033   [m\]    \
                #
                #                                # 1m turns bold on
                #                 [     \033    [35;1m\]    \h:\    [\033   [m\]    \
                #
                #                               # 21m turns bold off
                #                 [     \033    [33;21m\]   \w\     [\033   [m\]    \   $ "

# <<< coloring the terminal <<<

.bashrc

(Using nano) paste the following at the top of your .bashrc

# >>> INFO >>>
    # .bashrc is sourced only when logging into a node.
    # Initially when logged into the head node, farm sources .bash_profile.

    # For simplicity, this pulls from .bash_profile to .bashrc (here), with
source ~/.bash_profile 
    # settings (e.g. colors) can be overridden below this section,
    # but they will only apply when on a big-mem node, not on the head node
# <<< INFO <<<

# >>> color settings >>>

export  PS1="\[\033[34m\]\u\[\033[m\]\[\033[35;44m\]@\[\033[m\]\[\033[37;44;1m\]\h:\[\033[m\]\[\033[35;21m\]\w\[\033[m\]\$ "

        #Color	Foreground	Background
                #------|-----------|----------
                #Black   30	        40
                #Red     31         41
                #Green   32       	42
                #Yellow  33      	43
                #Blue    34       	44
                #Magenta 35      	45
                #Cyan    36      	46
                #White   37      	47

            # Example prompt:
                # (base) user@farm:~$
            # Prompt Template:
                #export  PS1="\   [     \033    [34m\]      \u\     [\033   [m\]    \
                #                 [     \033    [36m\]       @\     [\033   [m\]    \
                #
                #                                # 1m turns bold on
                #                 [     \033    [35;1m\]    \h:\    [\033   [m\]    \
                #
                #                               # 21m turns bold off
                #                 [     \033    [33;21m\]   \w\     [\033   [m\]    \   $ "

                        # source: https://www.tutorialspoint.com/how-to-output-colored-text-to-a-linux-terminal
# <<< color settings <<<

Is vim causing you tabs vs spaces problems?

The best option is to not us vim (jk...?)

Alternatively, the following can be pasted in ~/.vimrc so that
tab gets converted to 4 spaces when you save.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
 set expandtab
" Be smart when using tabs ;)
 set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
" Linebreak on 500 characters
"set lbr
"set tw=500
"set ai "Auto indent
"set si "Smart indent
"set wrap "Wrap lines

I also have the following in my .vimrc, it adds some syntax highlighting.
It as been helpful for me, ymmv

au BufNewFile,BufRead Snakefile set syntax=snakemake
au BufNewFile,BufRead *.snake set syntax=snakemake
au BufNewFile,BufRead *.snakefile set syntax=snakemake

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable syntax highlighting
syntax enable
colorscheme murphy
set background=dark
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant