vicode
介绍
- 基于vim9.1打造的终端环境下编辑器,主要用于主流代码开发与阅读.
软件架构
-
部署结构
/usr/local/vicode/ ├── bin │ ├── 2to3 -> 2to3-3.10 │ ├── 2to3-3.10 │ ├── c_rehash │ ├── ex -> vim │ ├── idle3 -> idle3.10 │ ├── idle3.10 │ ├── openssl │ ├── pip3 │ ├── pip3.10 │ ├── pydoc3 -> pydoc3.10 │ ├── pydoc3.10 │ ├── python3 -> python3.10 │ ├── python3.10 │ ├── python3.10-config │ ├── python3-config -> python3.10-config │ ├── rview -> vim │ ├── rvim -> vim │ ├── view -> vim │ ├── vim │ ├── vimdiff -> vim │ ├── vimtutor │ └── xxd ├── include │ ├── openssl/* │ └── python3.10/* ├── install-openssl ├── install-python ├── install-vim91 ├── lib │ ├── libcrypto.a │ ├── libcrypto.so -> libcrypto.so.1.1 │ ├── libcrypto.so.1.1 │ ├── libpython3.10.so -> libpython3.10.so.1.0 │ ├── libpython3.10.so.1.0 │ ├── libpython3.so │ ├── libssl.a │ ├── libssl.so -> libssl.so.1.1 │ ├── libssl.so.1.1 │ └── python3.10 ├── README.md ├── README.en.md └── share ├── man/* └── vim/ ├── vicode.vimrc ├── vim91/ │ ├── *.vim │ ├── autoload/* │ └── **/* └── vimrcs/ └── *.vimrc
-
注: 安装完成才能正常使用,因为安装会将部署结构中的相关文件链接到运行环境中
安装教程
-
准备
主要适用于ubuntu/linux,尤其是ubuntu-16.04.
通过git下载软件包进行部署, 需要有git命令环境 -
软件包部署
将vicode包拷贝到 /usr/local/ 目录下
cd /usr/local/ git clone https://gitee.com/jllim/vicode.git vicode
必须拷贝到 /usr/local/ 目录下,原因是自定义的openssl库在python3.x需在 /usr/local/目录下才能正常被识别到; vim9.1依赖的python3.10,而python3.10需要ssl模块支持,即openssl,如果不支持ssl模块, vim9.1的插件jedi,youcompleteme等都将无法正常工作;
-
安装步骤
cd /usr/local/vicode/ ./install-openssl ./install-python ./install-vim91
使用说明
-
本质上是vim, 与vim一致的使用方法, 通过vim打开文件编辑即是vicode打开文件编辑
-
验证vicode工具版本信息
一般是9.1版本,feature有+python3vim --version
-
python代码的自动补全
打开.py后缀的python源文件, 关键字后输入点会自动弹出补全菜单让用户选择.vim test.py
import sys sys.
-
python代码的跳转,跳转快捷键是jedi插件默认定义,比较通用
\ g 跳转到函数 \ d 跳转到定义 \ s 跳转到键入 \ n 定义和引用
将光标焦点于某个关键字上,参考上述快捷键触发进行跳转
vim test.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- ''' Created on 2024-03-22 @author: JLLim processing log will have two space indent at the head of line ''' import os import sys import getopt import logging import ctypes import time import calendar import datetime def setLoggerLevel(_logger, _level): _logger.setLevel(_level) for _h in _logger.handlers: _h.setLevel(_level) def setLoggerPath(_logger, _pathfile): if _pathfile != None and len(_pathfile) > 0: try: if not os.path.exists(os.path.dirname(_pathfile)): os.makedirs(os.path.dirname(_pathfile)) except OSError as e: _logger.debug("OSError: " + str(e)) return if not os.path.isdir(_pathfile): _file = logging.FileHandler(_pathfile) _file.setLevel(logging.INFO) _fmt = logging.Formatter('%(levelname)s %(asctime)s [%(filename)s:%(lineno)d] %(message)s') _file.setFormatter(_fmt) _logger.addHandler(_file) else: _logger.debug("logging is not writen to file") def getLogger(_level=logging.INFO, _pathfile=None): _logger = logging.getLogger(__name__) _logger.setLevel(_level) _stream = logging.StreamHandler() _stream.setLevel(_level) _logger.addHandler(_stream) setLoggerPath(_logger, _pathfile) _logger.debug('logging init done') return _logger if __name__=='__main__': logfile_en = False #not save log to file logdebug_en = False #default log level is info, rather than debug pwd = os.getcwd() #today = str(datetime.date.today()) today = time.strftime("%Y%m%d", time.localtime()) logfilename = time.strftime("%H.%M", time.localtime()) + ".log" logpath = None logger = getLogger(logging.INFO, logpath) logger.debug("Checking args: {len}".format(len=len(sys.argv))) if len(sys.argv) > 1: #exist arguments logger.debug("Checking args") try: opts, args = getopt.getopt(sys.argv[1:], 'h', ['help']) for opt, arg in opts: if opt in ('-h', '--help'): logger.info("argument {opt}".format(opt=opt)) sys.exit(0) else: logger.info("Invalid argument {opt}".format(opt=opt)) sys.exit(-1) except getopt.GetoptError as e: logger.info('opt error: {err}\n'.format(err=e)) sys.exit(-1)
参与贡献
- r1.0
- 发布时间: 2024-05-10
- Features && BugFix:
- 支持关键字语法着色,多种颜色的关键字高亮,airline风格,光标十字线等;
- 支持python编码开发,包括自动补全,符号跳转;
- 贡献者: jielong.lin@qq.com
- 文档变更:
- 撰写初稿,包括
- 介绍
- 软件架构
- 安装教程
- 使用说明
- 参考贡献
- 撰写初稿,包括