my vscode in ubuntu

做最好的自己🌱

settings.json

{
    // =============================== 通用设置 =============================
    "editor.tabSize": 2,    //tab 格数
    "editor.fontSize": 18,  // 编辑区字体大小
    "explorer.autoReveal": false, // 关闭打开文件查看器时文件夹自动展开

    // =============================== git设置 =============================
    // "git.ignoreMissingGitWarning": true,

    // =================================== vim =============================
    // 光标经过代码折叠出不自动展开
    "vim.foldfix": true,
    "vim.easymotion": true,
    "vim.incsearch": true,
    "vim.useSystemClipboard": true,
    "vim.useCtrlKeys": true,
    "vim.hlsearch": true,
    "vim.insertModeKeyBindings": [
        {
            "before": ["j", "k"],
            "after": ["<Esc>"]
        },
    ],
    "vim.visualModeKeyBindings": [
        // 复制后 寄存器0 存一份 并且不会被 剪切等操作覆盖
        {
            "before": ["<leader>", "p"],
            "after": ["\"", "0", "p"]
        },
        // 从ide外界copy的默认存储器是*
        {
            "before": ["<leader>", "8"],
            "after": ["\"", "*", "p"]
        }
    ],
    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["<leader>", "n"],
            "commands": [":nohl"]
        },
        {
            "before": ["<leader>", "w"],
            "commands": [":w"]
        },
        {
            "before": ["<leader>", "q"],
            "commands": [":q"]
        },
        {
            "before": ["K"],
            "after": ["g", "t"]
        },
        {
            "before": ["J"],
            "after": ["g", "T"]
        },
        {
            "before": ["<leader>", "j"],
            "after": ["J"]
        },
        {
            "before": ["<leader>", "'", "'"],
            "after": ["y", "i", "'"]
        },
        // 从ide外界copy的默认存储器是*
        {
            "before": ["<leader>", "8"],
            "after": ["\"", "*", "p"]
        },
        {
            "before": [","],
            "after": ["s"]
        },
        {
            "before": ["<"],
            "after": ["S"]
        },
        // 移动到当前行末尾
        {
            "before": ["0"],
            "after": ["g", "_"]
        },
        // 移动到当前行前
        {
            "before": ["9"],
            "after": ["0"]
        },
    ],
    "vim.leader": "<space>",
    "vim.handleKeys": {
        "<C-a>": false,
        "<C-f>": false,
        "<C-b>": false,
        "<C-e>": false,
    },
    "update.mode": "none",
    "extensions.ignoreRecommendations": true,
    "workbench.editorAssociations": [
        {
            "viewType": "jupyter.notebook.ipynb",
            "filenamePattern": "*.ipynb"
        }
    ],


    // ======================== vim ibus im-select =====================
    // "vim.autoSwitchInputMethod.enable": true,
    // "vim.autoSwitchInputMethod.defaultIM": "xkb:us::eng",
    // "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/bin/ibus engine",
    // "vim.autoSwitchInputMethod.switchIMCmd": "/usr/bin/ibus engine {im}"
    // ================================ python ========================

    // python代码提示的一些配置
    "python.linting.flake8Enabled": true,
    "python.formatting.provider": "yapf",
    "python.linting.flake8Args":[
        "--max-line-length=99"
    ],
    
    "python.linting.pylintEnabled": false,

    "python.linting.pylintArgs": [
      "--load-plugins=pylint_django"
    ],

    // ================================ django ========================
    // 能识别djnago鸭子模型的html
    "emmet.includeLanguages": {
        "django-html": "html"
    },

    "files.associations": {
        "**/*.html": "html",
        "**/templates/**/*.html": "django-html",
        "**/templates/**/*": "django-txt",
        "**/requirements{/**,*}.{txt,in}": "pip-requirements"
    },

    // ===============================eslint====================
    //autoFixedOnSave 设置已废弃,采用如下新的设置
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": true
    },
    "eslint.format.enable": true,
    "editor.accessibilitySupport": "off",
    "typescript.updateImportsOnFileMove.enabled": "always",

    // // 自动添加 兼容性前缀
    // "liveSassCompile.settings.autoprefix": [
    //     "> 1%",
    //     "last 3 versions"
    // ],


    // =================== auto close tag ====================
    "auto-close-tag.excludedTags": [
        "xml",
        "php",
        "blade",
        "ejs",
        "jinja",
        "javascript",
        "plaintext",
        "markdown",
        "vue",
        "liquid",
        "erb",
        "lang-cfml",
        "cfml",
        "HTML (Eex)"
    ],
    "auto-close-tag.disableOnLanguage": [
        "php",
        "python",
        "typescript"
    ]
}


vue settings.json

{
  "editor.tabSize": 2,
  // ===============================eslint====================
  // 保存后自动修复格式
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  // "editor.formatOnSave": true, // 保存自动格式  化
  // 添加vue支持
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "vue"
  ],
  // ================================ sass ==============================
}

vscode snippet

文件注释(下面是h5的例子)
{
    "Print to console": {
        "prefix": "h5_header",
        "body": [
            "<!--",
            " * @Author: zhangyu",
            " * @Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
            " * @LastEditors: Please set LastEditors",
            " * @Description: $0",
            " * @FilePath: $RELATIVE_FILEPATH",
            "-->",
        ],
        "description": "Log output to console"
    }

}
vue2 files
{
    "Print to console": {
        "prefix": "vue",
        "body": [
            "<!--",
            " * @Author: zhangyu",
            " * @Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
            " * @LastEditors: Please set LastEditors",
            " * @Description: $0",
            " * @FilePath: $RELATIVE_FILEPATH",
            "-->",
            "<template>",
            "    <div class=\"$1\">$2</div>",
            "</template>",
            "",
            "<script>",
            "",
            "export default {",
            "    components: {},",
            "    filters: {},",
            "    data() {",
            "        return {",
            "",
            "        };",
            "    },",
            "    computed: {},",
            "    watch: {},",
            "    created() {},",
            "    mounted() {},",
            "    methods: {}",
            //"    beforeCreate() {},",
            //"    beforeMount() {},",
            //"    beforeUpdate() {},",
            //"    updated() {},",
            //"    beforeDestroy() {},",
            //"    destroyed() {},",
            //"    activated() {},",
            "    };",
            "</script>",
            "<style lang='scss' scoped>",
            "//@import url(); 引入公共css类",
            "",
            "</style>",
            ""
        ],
        "description": "Log output to console"
    }
}

vue3 files

{
    "Print to console": {
        "prefix": "vue3",
        "body": [
            "<!--",
            " * @Author: zhangyu",
            " * @Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
            " * @LastEditors: Please set LastEditors",
            " * @Description: $0",
            " * @FilePath: $RELATIVE_FILEPATH",
            "-->",
            "<template>",
            "  <div class=\"$1\">$2</div>",
            "</template>",
            "",
            "<script>",
            "",
                        "import { reactive, onMounted, toRefs } from 'vue'",
            "",
            "export default {",
                        "  name: '$TM_FILENAME_BASE',",
                        "  components: {},",
                        "  setup() {",
                        "    const staticData = reactive({",
                        "",
                        "    })",
                        "    const tempData = reactive({",
                        "",
                        "    })",
                        "    onMounted(async () => {",
            "    // onMounted area",
            "    })",
                        "    return {",
                        "      ...toRefs(staticData),",
                        "      ...toRefs(tempData)",
                        "    }",
                        "  }",
            //"    computed: {},",
            //"    watch: {},",
            //"    mounted() {},",
            //"    beforeCreate() {},",
            //"    beforeMount() {},",
            //"    beforeUpdate() {},",
            //"    updated() {},",
            //"    beforeDestroy() {},",
            //"    destroyed() {},",
            //"    activated() {},",
                        "}",
            "</script>",
            "<style lang='scss' scoped>",
            "",
            "</style>",
            ""
        ],
        "description": "Log output to console"
    }
}

vscode-extends

image.png
image.png
image.png
image.png

esymotion and surround in vscode/vim

esaymotion使用方法
surround部分使用方法

vimrc

"----------------- vundle ------------------"
set nocompatible              " required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=/home/ascrew/.vim/bundle/Vundle.vim
call vundle#begin()

" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
" Plugin 'gmarik/Vundle.vim'"
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-airline/vim-airline' 
Plugin 'vim-airline/vim-airline-themes' 
Plugin 'lifepillar/vim-solarized8' " solarized8主题
Plugin 'scrooloose/nerdtree'

" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)


" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required


" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below.  If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.

runtime! debian.vim

" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
" This happens after /etc/vim/vimrc(.local) are loaded, so it will override
" any settings in these files.
" If you don't want that to happen, uncomment the below line to prevent
" defaults.vim from being loaded.
" let g:skip_defaults_vim = 1

" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
  syntax on
endif

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"filetype plugin indent on

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd            " Show (partial) command in status line.
"set showmatch          " Show matching brackets.
"set ignorecase         " Do case insensitive matching
"set smartcase          " Do smart case matching
"set incsearch          " Incremental search
"set autowrite          " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
"set mouse=a            " Enable mouse usage (all modes)

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif


"----------------- basic ------------------"
let mapleader="\<space>"
:set number
:syntax on
:set showmode
:set showcmd
:set mouse=a
:set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
:set fileencoding=utf-8
:set encoding=utf-8
:set autoindent
:set tabstop=4
:set expandtab
:set softtabstop=4
:set ruler
:set laststatus=2
:set softtabstop=4
:set shiftwidth=4


"----------------- key map ------------------"
imap jk <Esc>
:noremap <C-n> :noh


"----------------- program ------------------"
if has("autocmd")
  au VimEnter,InsertLeave * silent execute '!echo -ne "\e[2 q"' | redraw!
  au InsertEnter,InsertChange *
    \ if v:insertmode == 'i' | 
    \   silent execute '!echo -ne "\e[6 q"' | redraw! |
    \ elseif v:insertmode == 'r' |
    \   silent execute '!echo -ne "\e[4 q"' | redraw! |
    \ endif
  au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw!
endif 

"----------------- vim-airline ------------------"
" Vim 在与屏幕/键盘交互时使用的编码(取决于实际的终端的设定)        
set encoding=utf-8
set langmenu=zh_CN.UTF-8
" 设置打开文件的编码格式  
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 
set fileencoding=utf-8
" 解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" 解决consle输出乱码
"set termencoding = cp936  
" 设置中文提示
language messages zh_CN.utf-8 
" 设置中文帮助
set helplang=cn
" 设置为双字宽显示,否则无法完整显示如:☆
set ambiwidth=double
" 总是显示状态栏 
let laststatus = 2
let g:airline_powerline_fonts = 1   " 使用powerline打过补丁的字体
let g:airline_theme="dark"      " 设置主题
" 开启tabline
let g:airline#extensions#tabline#enabled = 1      "tabline中当前buffer两端的分隔字符
let g:airline#extensions#tabline#left_sep = ' '   "tabline中未激活buffer两端的分隔字符
let g:airline#extensions#tabline#left_alt_sep = '|'      "tabline中buffer显示编号
let g:airline#extensions#tabline#buffer_nr_show = 1      

" 映射切换buffer的键位
"nnoremap [b :bp<CR>
"nnoremap ]b :bn<CR>

" 设置字体 
set guifont=Powerline_Consolas:h14:cANSI
阅读 268
10 声望
1 粉丝
0 条评论
你知道吗?

10 声望
1 粉丝
文章目录
宣传栏