kate 跨平台KDE文本编辑器使用方法 汇集

目录

Using Sessions

Reload All

书签

注释(注释嵌套)、等快捷键

技巧:将 Find窗口 1当成临时的剪切板来使用

删除空白行,删除行末空白

显示/自动限制代码的宽度

KDE文本编辑器使用方法 附加:https://blog.csdn.net/ken2232/article/details/129605167

删除与关闭的区别

已经安装的默认插件

Reload /Reload All /Auto Reload Document 的区别 (*)

Replace Checked

用后感:从编辑器的角度而言,kate 比 Qt Creator IDE中内置的编辑器好用。毕竟它们所关注的焦点是不一样的。

特别注意:kate 与其他编辑器(含内嵌在 IDE中的编辑器)同时使用时;kate 有多种防止冲突的机制,如果使用不当,将会造成源文件在修改上的混乱、或错乱。因此,

在切换到 kate后,在使用之前,一定要首先执行一次: “Reload All”。

当 kate作为辅助的编辑器,IDE中的作为主要编辑器时:"Auto Reload Document"

------------------------------------

Kate 代码不要安装“格式化”的功能Markdown等有些语言,使用了 C++的格式化之后,很可能会造成 md的格式错乱。再说安装也是一件麻烦事。

Kate的查找和替换功能强大,使用这个。

Qt Creator默认自带的格式化功能,也不错!不一定非得使用那几个流行的格式化工具。

比如:一些简短的 if /for 语句,在一行写完就好了。Qt Creator不会改变用户本来的书写格式。

但那些格式化工具,一般都会将它们分成多行的格式。

------------------------------------

Replace All 会出现的问题:在使用这个操作之前,最好要做备份。

void Abc::ttt_slot(){
    //qDebug()<<" RunTable::ttt_slot  对话框弹出";   ;}

“qDebug()<<" :直接Replace All 为 “//qDebug()<” ;由于函数的右侧 "}" 也被注释掉了,于是,产生错误。

=============================

Replace Checked

在 多文件 Find --> search之后,

检查搜索的结构,将不符合的结果排除,然后,再点击 “Replace Checked”。

特别注意:否则,将不应该被替换的字符串,也替换了。导致错误!

参考:Kate  一款功能丰富的文本编辑器(可能是目前最好的开源跨平台轻量编辑器 之一)

https://blog.csdn.net/ken2232/article/details/129605167

 参考:

kate 跨平台KDE文本编辑器使用方法 汇集
kate 跨平台KDE文本编辑器使用方法 汇集_kate编辑器_ken2232的博客-CSDN博客

Kate 20.12 导出:官方默认的全部快捷键

http://t.csdn.cn/lKLpG

------------

Qt creator 最常用的快捷键 和书签功能 (**
https://blog.csdn.net/ken2232/article/details/130010588

官方默认:Qt Creator 所有的快捷键。及常用快捷键 (***)
https://blog.csdn.net/ken2232/article/details/131608520

Qt Creator常用快捷键及技巧提升编码效率
https://blog.csdn.net/luoyayun361/article/details/105431913

==============================================

The Kate Handbook

https://docs.kde.org/stable5/en/kate/kate/

Using Sessions (会话):这是一个方便的常用功能

https://docs.kde.org/stable5/en/kate/kate//fundamentals-using-sessions.html

使用要点

  1. 直接打开src目录下所有的所需文件;或者,以后再批量、或个别添加,也行。
  2. Sessions -- Manage Sessions -- 保存会话(或/会话另存为)-- -- // OK
  • 注意:在多种编辑器同时打开一个文件都在进行修改时,注意使用 “Reload All”功能。<< 不建议这样做(在多种编辑器同时打开一个文件都在进行修改,最好只有一个编辑器在修改,其他的为只读;但有时难以避免。),因为一不小心,就会导致修改恢复原样。
  • 直接执行 “新建会话”,似乎没有反应?或者是操作有问题的原因?// NG ?
  • Sessions 的保存目录:估计是 kate默认的,并不再用户的 src目录下?(没有/不必深究)

Sessions is how Kate lets you keep more than one list of files and GUI configuration around. You can have as many named sessions as you want, and you can use unnamed or anonymous sessions for files you want to use only once.

Currently Kate can save the list of open files, and the general window configuration in the session; future versions of Kate may add more features that can be saved in sessions.

With the introduction of sessions, Kate also allows you to open any number of instances of the application instead of just one as it used to do as the default behavior.

Sessions are supported in three areas:

When starting a new session, the GUI configuration of Default Session is loaded.

To save window configuration in the default session, you need to enable saving window configuration in the sessions configuration page of the configuration dialog and then load the default session, set up the window as desired and save the session again.

快捷键设置

Reload All: 这是一个常用的功能,为其设置快捷键。

按下 F2键,就可将 F2设置为其快捷键。

注意:如有快捷键冲突,会自动出现错误提示。

Auto Reload Document:

好像只能当次有效?重新打开 kate,不能保存这个选项?::>>

参考:Reload /Reload All /Auto Reload Document 的区别 (*)

下面的 2张图,"Auto Reload Document" 和 “Enable Auto Reload”是同一个功能,在不同菜单位置的展现。

功能:当 kate被激活为当前窗口时,会发生 “Auto Reload”操作。

kate作为辅助的编辑器IDE中的作为主要编辑器时:使用 "Auto Reload Document",似乎很好?

下图:只能启动 Auto Reload

下图,可以设置:启动/关闭 Auto Reload 功能

kate 打开的 “Reload All”

kate 打开多个文件时,在其他编辑器中修改,在 kate中提示 “Reload”的只是当前窗口的文件,因此,仍然需要执行 “Reload All”。

Reload /Reload All /Auto Reload Document 的区别 (*)

注意: 所谓的区别:目前只是估计,还没有经过验证??????

区别:

Reload:重装当前 项目文件。

Reload:重装当前 所有的项目文件。在同时打开几个项目的场景。

Auto Reload Document:只是设置 重装当前激活的文件。也就是说:只能一个一个文件,单独地来设置该功能。

特别注意:即使设置了“Auto Reload Document”,但是,“Reload” F2 的操作,还是必须的。

原因:没有被设置成“Auto Reload Document”,并且不是处在当前激活窗口的场景下,这些文件被外部编辑器更新之后,在 kate中不会自动提示文件的更新信息。

重装整个项目的操作:只能手动完成??

Save As 快捷键修改注意:

1. 需要与日常所用 IDE,或其他编辑软件的快捷键相一致;这样才方便自己使用。

2. 不同的 IDE,或编辑软件,其默认快捷键的定义是不一样的。

Qt creator 默认为:Save All >> Ctrl + Shift + S;

Notepad++ 默认为: Save All >> Ctrl + Shift + S;

VScode 默认为:Save As >> Ctrl + Shift + S;

书签

注意:

1. IDE中的编辑器,有些功能并不强大,有时需要使用更加强大的外部编辑器来辅助。

2. 内部编辑器和外部编辑器同时使用时。会导致一些私有数据异常。比如:书签的行号错乱,但这种错乱有些是可以接受的。

注释(注释嵌套)、等快捷键

注释:Ctrl + D:适用注释代码块中,已经 包含有注释符号“//”的场景。

Ctrl + /:适用注释代码块中,不 包含有注释符号“//”的场景。

连续不断取消,直到没有注释符号Ctrl + / ,连续多次有效的按压 。

Ctrl +Shift +D:似乎效果 ? 等效于 Ctrl + / 。

/*...*/ 注释风格:选择的代码块,包含顶部一个空行:Ctrl + /

注释嵌套:

1. 先用 //注释:实现内层的注释。执行:Ctrl + / 或 Ctrl + D

2. 再用 /*...*/注释:实现外层的注释。必须是执行:Ctrl + D 注意:不能是执行:Ctrl + /

关键操作:需要包含 代码块 顶部至少 1个空行

技巧:将 Find窗口 1当成临时的剪切板来使用

运用于下面的 2个窗口中,简单方便。

 ==================================

显示/自动限制代码的宽度

以下是 Qt Creator IDE的功能:只能显示代码宽度

 ==================================

删除与关闭的区别

delect: 删除文件:

文件没有了。

x号:将由 sessions管理的文件,关闭掉

文件还存在;只是在 session中没有显示了。

如果要在 sessions中显示,则需要重新添加文件。

删除空白行,删除行末空白

https://www.lostsaloon.com/technology/how-to-remove-empty-lines-from-text-file-in-linux/

要点:

1. tools--切换到命令行(F7);

2. 运行命令:

rtrim 

rmblank

Kate Editor

Kate is another graphical editor. It is more or less the default text editor for KDE. You can of course delete the blank lines manually one after another as in any text editor, but Kate does provide some easy to use commands to let you do this.

Kate supports a Editor Component Command Line feature that you can access from View->Switch to Command Line in the menu bar or by using the shortcut F7.

rmblank: In the command line, type in the command rmblank to remove all empty lines in the current document. This will not however remove any lines with blanks or white spaces in them.

rtrim: This will trim the lines and get rid of any trailing spaces from the end of the lines. Doing a rtrim before rmblank will allow you to remove both the empty lines as well as the blank lines.

Many other advanced text editors such as UltraEdit support search and replace functionality using regular expressions. It is very likely that you can do this replacement using regex expressions as well in these editors.

Using command line utilities

Although using text editor is a good option, using a command line utility is faster and easier. It is also very useful if you many different files to process. There are several utilities in Linux that can be used to remove empty lines in text files. The most popular and commonly used ones are awk, sed, and grep.

awk

bash$ awk '/./' filename.txt > newfile.txt

awk is a very versatile command. The above command removes all the empty lines in a file and prints the result out to the standard output. You can redirect the output to a file to save the result as a new file. The above command will remove all the empty lines in a file named filename.txt and saves it to newfile.txt.

The above command will not remove lines that has white spaces in them such as spaces or other non-printable characters. If you want to remove both the empty lines as well as the lines with spaces, then try the following command.

bash$ awk NF filename.txt > newfile.txt

sed

sed is another popular utility for processing text. This follows a similar pattern to what was mentioned earlier in the vi editor section. The expressions used are very similar, mostly because as with most Linux commands it uses the regular expressions to match the input text.

bash$ sed '/^$/d' filename.txt > newfile.txt

The above command will remove empty lines but not the lines that may contain spaces or other non-printable characters. In order to remove the empty lines as well as the blank lines use the following sed command.

bash$ sed '/^\s*$/d' filename.txt > newfile.txt

The following command is actually just a negation of the first sed command. This will not remove (notice the !d) any lines that matches the regular expression, which matches all lines with any character in them.

bash$ sed '/./!d' filename.txt > newfile.txt

grep

grep is more of a matcher utility compared to the sed command mentioned earlier. Both will take similar regular expressions to match the empty and blank lines in a file. You will need to use the -v option with grep to negate the expression and print out the non-matching lines.

The example below will delete all the empty lines in text file filename.txt, but not the ones with whitespaces.

bash$ grep '.' filename.txt > newfile.txt

In order to remove empty lines and as well all the lines with just white spaces in them, use the following grep command.

bash$ grep -v '^\s*$' filename.txt > newfile.txt

All of the above utilities gets the job done pretty much the same way by using very similar expressions to match the empty or blank lines in the file. You can now extend these to remove any matching lines not just the empty lines.  For example, if you wish to remove all comments in a script file, you can use the following variation.

Assuming that the comments in the script file always occur in a single line by itself and starts  with a # (hash or pound), the following command will remove all of those lines.

bash$ sed '/^\s*#/d' filename.txt > newfile.txt

You may further modify the expression to suit your needs.

已经安装的默认插件(用户没有更改勾选项)

只要勾选,即可。

 外部工具:需要用户安装

参考:

Qtcreator保存IDE上一次退出前的状态 Sessions (*)
https://blog.csdn.net/ken2232/article/details/130009144

qt creator : Managing Sessions (****) session sessions
https://blog.csdn.net/ken2232/article/details/130019802

kate 跨平台KDE文本编辑器使用方法 汇集: Using Sessions
https://blog.csdn.net/ken2232/article/details/130167973

kate 跨平台KDE文本编辑器使用方法 汇集
https://blog.csdn.net/ken2232/article/details/130167973

Kate  一款功能丰富的文本编辑器(可能是目前最好的开源跨平台轻量编辑器 之一)
https://blog.csdn.net/ken2232/article/details/129605167

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值