码迷,mamicode.com
首页 > 编程语言 > 详细

VSCode-python 进阶配置

时间:2017-12-11 18:40:07      阅读:539      评论:0      收藏:0      [点我收藏+]

标签:vim   内容   default   识别   ike   icons   乱码   system   last   

VSCode-python 进阶配置

中文乱码

中文乱码,网上一堆解决方法,但是根本没有有效起作用的。
在python脚本的前面添加:

# -*- coding:utf-8 -*-

并不能在控制台输出时是的print输出中文不乱码。但是此时os.system()的输出却是正常的,
如果使用调试进行输出得到相反的结果:print输出正常,但是终端输出乱码。

解决方法:尽量不要用中文
好吧,确实没卵用!哪位小伙伴有解决方法,请不吝赐教。

自动添加文首注释

此时需要安装vscode-fileheader
安装后需要进行相关配置:
文件 ——> 首选项 ——> 设置
打开setting.json,搜索fileheader,找到以下设置:

  // By default, create file  username
  "fileheader.Author": "mikey.zhaopeng",

  // By default, common template. Do not modify it!!!!!
  "fileheader.tpl": "/*\r\n * @Author: {author} \r\n * @Date: {createTime} \r\n * @Last Modified by:   {lastModifiedBy} \r\n * @Last Modified time: {updateTime} \r\n */\r\n",

  // By default, update file  username.
  "fileheader.LastModifiedBy": "mikey.zhaopeng",

然后进行更改:

    // By default, create file  username 此处更改为你的用户名
    "fileheader.Author": "Yanta", 

    // By default, common template. Do not modify it!!!!! 
     "fileheader.tpl": "#!/usr/bin/env python \r\n# -*- coding:utf-8 -*- \r\n‘‘‘\r\n * @Author: {author} \r\n * @Date: {createTime} \r\n * @Last Modified by:   {lastModifiedBy} \r\n * @Last Modified time: {updateTime} \r\n * @Desc: \r\n‘‘‘\r\n",
  
    // By default, update file  username. 此处更改为你的用户名
    "fileheader.LastModifiedBy": "Yanta",
    "workbench.iconTheme": "vscode-icons"

更改过上述配置之后需要重启vscode,否则不会应用更改。
重启后新建立文件,按下快捷键:Ctrl+Alt+i,就会在脚本开头自动填入注释内容。

不足

file-header目前无法自动添加注释部分,而且无法想vim一样可以自动识别脚本类型,然后自动插入对应的文首注释。
注释只能针对所有的脚本文件一视同仁。

文件图标

增加文件图标插件,实际上就是为了好看。
直接搜索:vscode-icons安装即可。

VSCode-python 进阶配置

标签:vim   内容   default   识别   ike   icons   乱码   system   last   

原文地址:http://www.cnblogs.com/iskylite/p/8024020.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!