Added Italic and Bold to prompt, removed some newlines when autocomplete
This commit is contained in:
parent
eda72c00ab
commit
0656f163fd
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -195,6 +195,12 @@ version = "0.6.28"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shell-words"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqish"
|
name = "sqish"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@ -203,6 +209,7 @@ dependencies = [
|
|||||||
"dirs",
|
"dirs",
|
||||||
"gethostname",
|
"gethostname",
|
||||||
"regex",
|
"regex",
|
||||||
|
"shell-words",
|
||||||
"termion",
|
"termion",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"users",
|
"users",
|
||||||
|
@ -18,8 +18,6 @@ TODO:
|
|||||||
* Allow redirecting >> to the end of a file ?
|
* Allow redirecting >> to the end of a file ?
|
||||||
* Allow && in commands ?
|
* Allow && in commands ?
|
||||||
* Improve word jumping
|
* Improve word jumping
|
||||||
* Allow bold / italic / etc in prompt
|
|
||||||
* Reduce newlines in autocompletes
|
|
||||||
|
|
||||||
## sqishrc (Config)
|
## sqishrc (Config)
|
||||||
See the included sqishrc file included for comments, and copy it as ~/.sqishrc for use (optionnal).
|
See the included sqishrc file included for comments, and copy it as ~/.sqishrc for use (optionnal).
|
||||||
|
5
sqishrc
5
sqishrc
@ -24,6 +24,11 @@
|
|||||||
#RGB !
|
#RGB !
|
||||||
#RGB is defined as $RGB|red|green|blue_
|
#RGB is defined as $RGB|red|green|blue_
|
||||||
#For example $RGB|108|84|30_ gives you an ugly shade of brown
|
#For example $RGB|108|84|30_ gives you an ugly shade of brown
|
||||||
|
#
|
||||||
|
#Styles:
|
||||||
|
#BOLD : start of a bold block
|
||||||
|
#ITA : start of an italic block
|
||||||
|
#STYLERESET : reset all styles.
|
||||||
prompt: "$COLORLBLACK_ !$HISTNUMBER_$COLORCYAN_[$USER_@$HOSTNAME_]$RGB|125|0|125_$DIR_> $COLORRESET_"
|
prompt: "$COLORLBLACK_ !$HISTNUMBER_$COLORCYAN_[$USER_@$HOSTNAME_]$RGB|125|0|125_$DIR_> $COLORRESET_"
|
||||||
|
|
||||||
#Classic aliases, can be used in conjunction with hotkeys
|
#Classic aliases, can be used in conjunction with hotkeys
|
||||||
|
@ -390,7 +390,7 @@ pub mod shell {
|
|||||||
//Search
|
//Search
|
||||||
*&mut mycommand = replace_signs(&mycommand);
|
*&mut mycommand = replace_signs(&mycommand);
|
||||||
let (res, list) = Search::build(&mycommand).unwrap().autocomplete();
|
let (res, list) = Search::build(&mycommand).unwrap().autocomplete();
|
||||||
if list.len() > 0 { write!(stdout, "\r\n{}\r\n", list); }
|
if list.len() > 0 { write!(stdout, "{}", list); }
|
||||||
mycommand.clear();
|
mycommand.clear();
|
||||||
mycommand.push_str(&res);
|
mycommand.push_str(&res);
|
||||||
max_pos = res.len();
|
max_pos = res.len();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use users::{get_user_by_uid, get_current_uid};
|
use users::{get_user_by_uid, get_current_uid};
|
||||||
use termion::color;
|
use termion::{color, style};
|
||||||
use std::{env, fs};
|
use std::{env, fs};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
@ -112,6 +112,7 @@ impl SqishConf {
|
|||||||
|
|
||||||
|
|
||||||
fn handle_colors(&mut self) {
|
fn handle_colors(&mut self) {
|
||||||
|
//Colors
|
||||||
let reset = format!("{}", color::Fg(color::Reset));
|
let reset = format!("{}", color::Fg(color::Reset));
|
||||||
let green = format!("{}", color::Fg(color::Green));
|
let green = format!("{}", color::Fg(color::Green));
|
||||||
let blue = format!("{}", color::Fg(color::Blue));
|
let blue = format!("{}", color::Fg(color::Blue));
|
||||||
@ -121,6 +122,12 @@ impl SqishConf {
|
|||||||
let cyan = format!("{}", color::Fg(color::Cyan));
|
let cyan = format!("{}", color::Fg(color::Cyan));
|
||||||
let lightblack = format!("{}", color::Fg(color::LightBlack));
|
let lightblack = format!("{}", color::Fg(color::LightBlack));
|
||||||
|
|
||||||
|
//Styles
|
||||||
|
let ita = format!("{}", style::Italic);
|
||||||
|
let bold = format!("{}", style::Bold);
|
||||||
|
let stylereset = format!("{}", style::Reset);
|
||||||
|
|
||||||
|
//Colors replace
|
||||||
let mut prompt = self.promptline.replace("$COLORGREEN_", &green);
|
let mut prompt = self.promptline.replace("$COLORGREEN_", &green);
|
||||||
prompt = prompt.replace("$COLORBLUE_", &blue);
|
prompt = prompt.replace("$COLORBLUE_", &blue);
|
||||||
prompt = prompt.replace("$COLORRED_", &red);
|
prompt = prompt.replace("$COLORRED_", &red);
|
||||||
@ -129,6 +136,11 @@ impl SqishConf {
|
|||||||
prompt = prompt.replace("$COLORCYAN_", &cyan);
|
prompt = prompt.replace("$COLORCYAN_", &cyan);
|
||||||
prompt = prompt.replace("$COLORLBLACK_", &lightblack);
|
prompt = prompt.replace("$COLORLBLACK_", &lightblack);
|
||||||
prompt = prompt.replace("$COLORRESET_", &reset);
|
prompt = prompt.replace("$COLORRESET_", &reset);
|
||||||
|
|
||||||
|
//Styles replace
|
||||||
|
prompt = prompt.replace("$ITA_", &ita);
|
||||||
|
prompt = prompt.replace("$BOLD_", &bold);
|
||||||
|
prompt = prompt.replace("$STYLERESET_", &stylereset);
|
||||||
let promptown = prompt.to_owned();
|
let promptown = prompt.to_owned();
|
||||||
self.promptline = promptown;
|
self.promptline = promptown;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user