一个用Go编写的WIP最小文本编辑器

phi

Phi is a minimal code editor designed to look pretty, run fast, and be easy to configure and use. It's primary function is for editing code.

The editor is still a work in progress. There is a chance it will eat up your battery, run quite slowly, and probably crash frequently.

**Do not edit your precious files with this editor!**

Here's a screenshot of Phi in action:

-----

goals

The editor must:

  • run fast;
  • load and edit large files with ease;
  • look pretty; and finally
  • be easy to use

non-goals

The editor probably wont:

  • have any plugin support;
  • be very customizable in terms of layout;
  • support many non utf8 encodings;
  • support non true-type-fonts;
  • support right-to-left languages;

Perhaps in the future if I have time to get round to some of these I may. Avoiding most of these is to avoid complexity in the code-base and general architecture of the editor.

why?

The editor does not exist as a serious replacement to Sublime Text/Atom/Emacs/[editor name here].

Though one of my big goals for the project is to possibly replace sublime text for my own personal use. Thus the editor is somewhat optimized for my own work-flow.

The code is up purely for people to look at and maybe use or contribute or whatever. Sharing is caring!

reporting bugs/troubleshooting

Note the editor is still unstable. Please report any bugs you find so I can squash them! It is appreciated if you skim the issue handler to make sure you aren't reporting duplicate bugs.

before filing an issue

Just to make sure it's an issue with the editor currently and not due to a broken change, please:

  • make sure the repository is up to date
  • make sure all the dependencies are updated, especially "github.com/felixangell/strife"
  • try removing the ~/.phi-config folder manually and letting the editor re-load it

building

requirements

You will need the go compiler installed with the GOPATH/GOBIN/etc setup. In addition you will need the following libraries:

  • sdl2
  • sdl2_image
  • sdl2_ttf

If you're on Linux, you will need:

  • xsel
  • xclip

Either works. This is for copying/pasting.

linux

Here's an example for Ubuntu:

1$ sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev xclip
2$ go get github.com/felixangell/phi
3$ cd $GOPATH/src/github.com/felixangell/phi
4$ go build
5$ ./phi

macOS

If you're on macOS, you can do something like this, using homebrew:

1$ brew install sdl2 sdl2_image sdl2_ttf pkg-config
2$ go get github.com/felixangell/phi
3$ cd $GOPATH/src/github.com/felixangell/phi
4$ go build
5$ ./phi

windows

Building on Windows is a bit more involved. It's the same process, though you will need a bit more software:

  • Install mingw-w64 from mingw-builds
    • Version: latest (e.g. 7.3.0);
    • Architecture: x86_64;
    • Threads: win32;
    • Exceptions: seh;
    • Build Revision: latest;
    • Destination folder: any folder your user owns, e.g. C:/Users/yourname/documents
  • Install SDL2, SDL2_img, and SDL2_ttf from here: sdl2, sdl2_image, sdl2_ttf
    • Extract these zip files;
    • Copy the x86_64-w64-mingw32 into your mingw folder specified when installing mingw-w64.
  • Add the mingw bin folder to the PATH

Once this is complete, open up a terminal and type the following:

1$ go get github.com/felixangell/phi
2$ cd $GOPATH/src/github.com/felixangell/phi
3$ go build
4$ ./phi

Note that you should run go install so that the dependencies aren't being rebuilt for faster compile times.

configuration

Configuration files are stored in $HOME/.phi-editor/config.toml. Note that this directory is created on first startup by the editor, as well as the configuration files in the 'cfg/' directory are pre-loaded dependening on platform: see 'cfg/linuxconfig.go', for example.

Below is an incomplete configuration file to give you an idea of what the config files are like:

 1[editor]
 2tab_size = 4
 3hungry_backspace = true
 4tabs_are_spaces = true
 5match_braces = false
 6maintain_indentation = true
 7highlight_line = true
 8
 9[render]
10aliased = true
11accelerated = true
12throttle_cpu_usage = true
13always_render = true
14
15[theme]
16background = 0x002649
17foreground = 0xf2f4f6
18cursor = 0xf2f4f6
19cursor_invert = 0x000000
20
21[cursor]
22flash_rate = 400
23reset_delay = 400
24draw = true
25flash = true
26
27[commands]
28[commands.save]
29shortcut = "super+s"
30
31[commands.delete_line]
32shortcut = "super+d"

2018年5月24日社区内部分享,晚上21:00 ,Go协程调度讲解 YY频道:15288615 时 间:2018年5月24日 晚上21:00

版权申明:内容来源网络,版权归原创者所有。除非无法确认,我们都会标明作者及出处,如有侵权烦请告知,我们会立即删除并表示歉意。谢谢。

原文发布于微信公众号 - Golang语言社区(Golangweb)

原文发表时间:2018-05-24

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏一个会写诗的程序员的博客

Spring Boot 集成 WebFlux 开发 Reactive Web 应用Spring Boot 集成 WebFlux 开发 Reactive Web 应用

IBM的研究称,整个人类文明所获得的全部数据中,有90%是过去两年内产生的。在此背景下,包括NoSQL,Hadoop, Spark, Storm, Kylin在...

1462
来自专栏bboysoul

使用永恒之蓝(MS17-010)漏洞入侵windows7

前几天,被勒索病毒(Wannacry)刷屏了,这个病毒是大家知道了备份文件的重要性,当然,我是不怕什么病毒的,因为我是一天备份一次文件,而且微云一份,坚果云,移...

2.2K4
来自专栏Samego开发资源

It can make your ssh login simply as well as efficiently on Mac or Linux

It can make your ssh login simply as well as efficiently on Mac or LInux. 点我翻译 ...

952
来自专栏流柯技术学院

Python WMI获取Windows系统信息

1243
来自专栏Ryan Miao

Spring-AOP实践 - 统计访问时间

公司的项目有的页面超级慢,20s以上,不知道用户会不会疯掉,于是老大说这个页面要性能优化。于是,首先就要搞清楚究竟是哪一步耗时太多。 我采用spring aop...

5128
来自专栏程序员与猫

Log system architecture

Keywords: Collector, Processor, Aggregator

1771
来自专栏Android中高级开发

Android开发之漫漫长途 IX——彻底掌握Binder

该文章是一个系列文章,是本人在Android开发的漫漫长途上的一点感想和记录,我会尽量按照先易后难的顺序进行编写该系列。该系列引用了《Android开发艺术探索...

1162
来自专栏Objective-C

iOS-安装和使用 CocoaPods

4797
来自专栏黑泽君的专栏

常用的 default.properties 文件 + 常用的 struts-default.xml 文件 + 常用的 struts-plugin.xml 文件 + 常用的 struts.xml 文件

常用的 default.properties 文件,所在位置:\struts-2.3.15.3-all\struts-2.3.15.3\apps\struts2...

934
来自专栏ImportSource

Spring5以来注册Bean的各种姿势,特别最后的纯编码注册值得尝试

各位好,今天我们的内容是有关Spring 5以来有关注册bean的几种方式。前面两三个是比较常用的方式,最后两种是只有在特殊的场合下才会被用到和想到。我们会分别...

1.6K7

扫码关注云+社区

领取腾讯云代金券