徹底解決pycharm輸入法支持問(wèn)題
最近兩一直,被pycharm的輸入法困擾里覆,在google上搜索了活翩,各種方法也都試了烹骨,都不行。
最后按照官網(wǎng)上說(shuō)法進(jìn)行試驗(yàn)纱新,終于獲得了成功展氓。
注:加粗的為注意的操作
具體步驟如下:
[maokx@localhost bin]$ vi pycharm.sh
# ---------------------------------------------------------------------
if [ -n "$PYCHARM_PROPERTIES" ]; then
IDE_PROPERTIES_PROPERTY="-Didea.properties.file=\"$PYCHARM_PROPERTIES\""
fi
MAIN_CLASS_NAME="$PYCHARM_MAIN_CLASS_NAME"
if [ -z "$MAIN_CLASS_NAME" ]; then
MAIN_CLASS_NAME="com.intellij.idea.Main"
fi
VM_OPTIONS_FILE="$PYCHARM_VM_OPTIONS"
if [ -z "$VM_OPTIONS_FILE" ]; then
VM_OPTIONS_FILE="$IDE_BIN_HOME/pycharm$BITS.vmoptions"
fi
if [ -r "$VM_OPTIONS_FILE" ]; then
VM_OPTIONS=`"$CAT" "$VM_OPTIONS_FILE" | "$GREP" -v "^#.*" | "$TR" '\n' ' '`
VM_OPTIONS="$VM_OPTIONS -Djb.vmOptionsFile=\"$VM_OPTIONS_FILE\""
fi
IS_EAP="false"
if [ "$IS_EAP" = "true" ]; then
OS_NAME=`echo $OS_TYPE | "$TR" '[:upper:]' '[:lower:]'`
AGENT_LIB="yjpagent-$OS_NAME$BITS"
if [ -r "$IDE_BIN_HOME/lib$AGENT_LIB.so" ]; then
AGENT="-agentlib:$AGENT_LIB=disablej2ee,disablealloc,delay=10000,sessionname=PyCharm30"
fi
fi
COMMON_JVM_ARGS="\"-Xbootclasspath/a:$IDE_HOME/lib/boot.jar\" -Didea.paths.selector=PyCharm30 $IDE_PROPERTIES_PROPERTY"
IDE_JVM_ARGS="-Didea.platform.prefix=Python -Didea.no.jre.check=true"
ALL_JVM_ARGS="$VM_OPTIONS $COMMON_JVM_ARGS $IDE_JVM_ARGS $AGENT $REQUIRED_JVM_ARGS"
CLASSPATH="$IDE_HOME/lib/bootstrap.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/extensions.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/util.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/jdom.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/log4j.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/trove4j.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/jna.jar"
if [ -n "$PYCHARM_CLASSPATH" ]; then
CLASSPATH="$CLASSPATH:$PYCHARM_CLASSPATH"
fi
export CLASSPATH
LD_LIBRARY_PATH="$IDE_BIN_HOME:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
exportXMODIFIERS=@im=fcitx
# ---------------------------------------------------------------------
# Run the IDE.
# ---------------------------------------------------------------------
while true ; do
"pycharm.sh" 183L, 5929C written
[maokx@localhost bin]$ a^C
[maokx@localhost bin]$ ^C
[maokx@localhost bin]$
就這樣就可以了。
原來(lái)脸爱,按照一般的說(shuō)法:
在~/bashrc 里面寫(xiě)入:
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
exportXMODIFIERS=@im=fcitx
實(shí)驗(yàn)證明遇汞,這樣是失敗的。
還有一種說(shuō)法是:
通過(guò)qt-config進(jìn)行配置簿废,但實(shí)驗(yàn)證明也是不行的空入。
官方解釋如下:
GTK+ and Qt modules
To obtain a better experience in Gtk+ and Qt programs, install thefcitx-gtk2,fcitx-gtk3,fcitx-qt4andfcitx-qt5input method modules as your need, or thefcitx-imgroup to install all of them (with the exception of fcitx-qt5 which is currently not popular).
Add the following lines to your desktop start up script files to register the input method modules and support xim programs.
Use.xprofileif you are using KDM, GDM, LightDM or SDDM.
Use.xinitrcif you are using startx or Slim.
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
Re-login to make these environment changes effective.
Warning:Do NOT use.bashrcto do this. It is used for initializing an interactive bash session. It is not designed for non-interactive shell, nor for X session initialization. Moreover, setting environment variables in it can confuse diagnostic tools which are generally executed from command line so that these environment will appear as being set coorrectly for them even if they are not for the X session.
Note:If all Qt apps have problem with fcitx, run qtconfig (qtconfig-qt4), and go to the third tab, make sure fcitx is in the "Default Input Method" combo-box.