zoukankan      html  css  js  c++  java
  • golang之vim和vscode开发环境

    VIM配置

    Ubuntu16下vim配置golang语言环境需要高版本VIM(8.0以上)。

    1. 可直接源码编译安装最新版vim。

    yum remove -y vim-enhanced
    
    git clone https://github.com/vim/vim.git
    git checkout -b v8.2.0340 v8.0.0340
    make 
    make install

    2. 参考vim-go文档,通过vim包管理工具vim-plug安装vim-go。

    curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    git clone https://github.com/fatih/vim-go.git ~/.vim/plugged/vim-go

    在~/.vimrc中添加:

    call plug#begin()
    Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
    call plug#end()

    3. vim颜色配置。

    默认安装后,可能出现错误后颜色会覆盖代码,导致不能阅读,可修改vim的colorscheme。

    根据https://github.com/fatih/vim-go/wiki/Tutorial推荐使用https://github.com/fatih/molokai。

    直接复制https://github.com/fatih/molokai/colors到~/.vim目录下。

    并在~/.vimrc中添加:

    let g:rehash256 = 1
    let g:molokai_original = 1
    colorscheme molokai

    4. 其他配置。

    ~/.vimrc

    call plug#begin()
    Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
    call plug#end()
    
    let g:rehash256=1
    let g:molokai_original=1
    colorscheme molokai
    
    set tabstop=4
    set softtabstop=4
    set shiftwidth=4
    set autoindent
    set nu
    
    let &termencoding=&encoding
    set fileencodings=utf-8,gbk
    
    map <F5> <ESC>:tp<CR>
    map <F6> <ESC>:tn<CR>
    $ tree ~/.vim -L 3
    /home/wang/.vim
    ├── autoload
    │   └── plug.vim
    ├── colors
    │   └── molokai.vim
    └── plugged
        ├── molokai
        │   ├── colors
        │   ├── LICENSE.md
        │   └── README.md
        └── vim-go
            ├── addon-info.json
            ├── assets
            ├── autoload
            ├── CHANGELOG.md
            ├── compiler
            ├── doc
            ├── Dockerfile
            ├── ftdetect
            ├── ftplugin
            ├── gosnippets
            ├── indent
            ├── LICENSE
            ├── Makefile
            ├── plugin
            ├── README.md
            ├── rplugin
            ├── scripts
            ├── syntax
            ├── templates
            └── test

    5. 使用说明参考:https://github.com/fatih/vim-go/wiki/Tutorial

    参考:

    1. https://gitee.com/yuxio/vim-go.git  https://github.com/fatih/vim-go/wiki/Tutorial

    2. vim安装go插件vim-go和gocode,支持代码高亮、代码提示和语法检查等功能

    3. vim如何配置go语言环境

    4. VS code golang 开发环境搭建

    5. vim 配置golang环境

  • 相关阅读:
    excel转换为dta格式
    移动pdf
    豆瓣爬虫
    python给证件照换底色
    OS模块
    决策树参数
    Pandas数据连接
    Sklearn用法
    numpy.loadtxt()用法
    单片机基础(五):定时/计数器的工作原理及工作方式
  • 原文地址:https://www.cnblogs.com/embedded-linux/p/12907472.html
Copyright © 2011-2022 走看看