我在vim中喜欢的功能之一是foo()
,可将UNIX命令的输出插入到我正在编辑的文件中。我用它来包括日历(import React, { Component } from "react";
import {
View,
Text,
KeyboardAvoidingView,
ScrollView,
TouchableOpacity,
TextInput
} from "react-native";
import styles from "../Style/styles";
import firebase from "react-native-firebase";
import SvgComponent from "../components/Icons";
import Loading from "./Loading";
class SignIn extends Component {
constructor(props) {
super(props);
this.state = {
email: "",
password: "",
loading: false,
validations: {
emailValid: "",
passwordValid: ""
}
};
}
signInUser = (_email, _password) => {
const { email, password } = this.state;
try {
firebase
.auth()
.signInAndRetrieveDataWithEmailAndPassword(email, password)
.then(() => {
this.props.navigation.navigate("Home");
})
.catch(function(error) {
// Handle Errors .
let errorCode = error.code;
let errorMessage = error.message;
switch (errorCode) {
case "auth/wrong-password":
alert("Wrong password.");
this.setState({ loading: false });
break;
case "auth/invalid-email":
alert(" Email address is not valid.");
this.setState({ loading: false });
break;
case "auth/user-disabled":
alert(" Email address is disabled.");
this.setState({ loading: false });
break;
case "auth/user-not-found":
alert(" no user corresponding to the given email.");
this.setState({ loading: false });
break;
default:
this.setState({ loading: false });
alert("Please, Check your Connection");
break;
}
alert("An|" + error);
console.log(errorMessage);
});
this.setState({ loading: true });
} catch (error) {
console.log(error.toString());
}
};
render() {
if (this.state.loading === true) {
return <Loading />;
} else {
return (
<ScrollView padder scrollEnabled={true}>
<KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={70}>
<View style={styles.container}>
{/* Start Head Section */}
<Text style={[styles.redWord, { fontSize: 35 }]}>Sign In</Text>
<View style={styles.logoSection}>
<SvgComponent />
</View>
{/* End Head Section */}
{/* Start Form Section */}
<View style={styles.inputSection}>
<Text
style={[styles.borderLeftInput, { top: 8, height: "66%" }]}
/>
<TextInput
placeholder="Email"
autoCapitalize="none"
keyboardType="email-address"
style={styles.textInput}
value={this.state.email}
onChangeText={email => this.setState({ email })}
returnKeyType="next"
returnKeyLabel="next"
ref={input => (this._email = input)}
onSubmitEditing={() => this._password.focus()}
/>
</View>
<View style={styles.inputSection}>
<Text
style={[styles.borderLeftInput, { top: 8, height: "66%" }]}
/>
<TextInput
secureTextEntry
placeholder="Password"
autoCapitalize="none"
style={styles.textInput}
onChangeText={password => this.setState({ password })}
value={this.state.password}
returnKeyType="done"
returnKeyLabel={"done"}
ref={input => (this._password = input)}
/>
</View>
<View style={styles.handleErrors}>
<Text style={[styles.redWord, styles.handleErrorsText]}>
{this.state.validations.passwordValid}
</Text>
</View>
{/* End Other inputs Sections */}
<TouchableOpacity
style={styles.button}
onPress={() => {
this.signInUser(this.state.email, this.state.password);
}}
>
<Text style={styles.TextButton}>Sign In</Text>
</TouchableOpacity>
</View>
</KeyboardAvoidingView>
</ScrollView>
);
}
}
}
export default SignIn;
),时间戳([Esc]:r! <unix command>
),系统变量的值(:r! cal
)等
感谢vscodevim提供的Vim仿真,我能够在VScode中复制此功能的 some (对那些家伙们表示敬意:你们都很棒!)。不幸的是,在Windows 10中,我只能运行CMD命令。例如,对于时间戳,我需要致电例如(:r! date
)---如果我忘记了:r! echo $PATH
位,则VScode冻结。我尝试了powershell和git-bash命令,但是没有运气。有谁知道如何避免使用CMD来支持其他两个方法?