Showing posts with label configuration files. Show all posts
Showing posts with label configuration files. Show all posts

Dynamic prompt line

Two lines to put on your .bashrc file to have a nice dynamic prompt line.

export MAX_PATH_LENGTH=25
export PROMPT_COMMAND='PS1="\\[\\033[32m\\][\u@\h:\`if [[ \$? = "0" ]]; then echo "\\[\\033[35m\\]"; else echo "\\[\\033[31m\\]"; fi\` \`if [[ `pwd|wc -c|tr -d " "` > $MAX_PATH_LENGTH ]]; then echo "\\W"; else echo "\\w"; fi\`\\[\\033[32m\\]]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"'

NB : The color of the path change if the last command written is unknown or wrong, and shortens for long directories path.

[Vim] highlight a search or not, that is the question

As default, when you make a search, Vim highlight the result.
This option can sometimes be irritating, especialy when you search "=" or "," characters.

So, here is a line to put on your .vimrc (Vim default configuration file) :
noremap ‹F7› :set hls!‹cr›:set hls?‹cr›
So now, with the [F7] key you can highlight or not a search result. Usefull, isn't it?