1. 程式人生 > >徹底解決pycharm輸入法支援問題

徹底解決pycharm輸入法支援問題

最近兩一直,被pycharm的輸入法困擾,在google上搜索了,各種方法也都試了,都不行。

最後按照官網上說法進行試驗,終於獲得了成功。

注:加粗的為注意的操作

具體步驟如下:

[[email protected] 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
export

[email protected]=fcitx

# ---------------------------------------------------------------------
# Run the IDE.
# ---------------------------------------------------------------------
while true ; do
"pycharm.sh" 183L, 5929C written                                                                                                                      
[
[email protected]
bin]$ a^C
[[email protected] bin]$ ^C
[[email protected] bin]$ 

就這樣就可以了。

原來,按照一般的說法:

在~/bashrc 裡面寫入:

export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export [email protected]=fcitx

實驗證明,這樣是失敗的。

還有一種說法是:

通過qt-config進行配置,但實驗證明也是不行的。

官方解釋如下:

GTK+ and Qt modules

To obtain a better experience in Gtk+ and Qt programs, install the , , and input method modules as your need, or the group 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 .xprofile if you are using KDM, GDM, LightDM or SDDM.
  • Use .xinitrc if you are using startx or Slim.
 export GTK_IM_MODULE=fcitx
 export QT_IM_MODULE=fcitx
 export [email protected]=fcitx
  • Re-login to make these environment changes effective.
Warning: Do NOT use .bashrc to 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.