首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏MasiMaro 的技术博文

    从零开始配置 vim(7)——自动命令

    定义一个自动命令的格式如下 autocmd type pattern cmd autocmd: 自动命令以 autocmd 关键字开始,它的作用类似与 js 中定义函数时使用的 function 关键字 分组一个是为了划分模块,第二个原因就是我们可以使用 autocmd! 来清除同一组之前的命令。 例如我们将上述命令修改为 :augroup testgrp : autocmd! : autocmd BufWrite * echom "hello3" :augroup END 我们发现在保存之后,它还是会打印3条语句 autocmd! :augroup NVIMRC : autocmd! : autocmd BufWritePost init.vim source % :augroup END 这里我们先使用 autocmd!清除之前的加载操作。

    1.7K20编辑于 2022-08-10
  • 来自专栏MasiMaro 的技术博文

    从零开始配置 vim(11)——插件管理

    之前我们介绍自动命令的时候已经给出了如何自动加载配置 augroup NVIMRC autocmd! nvim_create_autocmd,第一个参数是一个或者多个事件字符串组成的 table,它的含义与 autocmd 中的事件相同,用的字符串也相同。第二个参数是一个表示属性的 table。 autocmd BufWritePost init.lua source % autocmd BufReadPost init.lua set path+=**/* augroup END autocmd BufWritePost init.lua source % autocmd BufReadPost init.lua set path+=**/* augroup END ]] end 我将这段代码放到了 lua/autocmd.lua 中。

    1.4K30编辑于 2022-09-21
  • 来自专栏python3

    ubuntu16.04打造vim和pyt

    pydiction_location = '/usr/share/vim/vim74/pydiction/complete-dict'  let g:pydiction_menu_height = 20 autocmd  FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascrīpt set omnifunc=javascriptcomplete #CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc =csscomplete#CompleteCSS autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags autocmd FileType  php set omnifunc=phpcomplete#CompletePHP autocmd FileType c set omnifunc=ccomplete#Complete autocmd FileType

    86740发布于 2020-01-03
  • 来自专栏python3

    Gvim入门(3)——简易配置pytho

    "配置python解释器 autocmd BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout ;\ py_compile.compile(r'%')\" autocmd BufRead *.py set efm=%C\ %. %#,%Z%[%^\ ]%\\@=%m autocmd BufRead *.py nmap <F5> :! python %<CR> autocmd BufRead *.py nmap <F6> :make<CR> autocmd BufRead *.py copen "如果是py文件

    1K10发布于 2020-01-07
  • 来自专栏python3

    将vim配置成python编辑器

    FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascrīpt set omnifunc=javascriptcomplete #CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc =csscomplete#CompleteCSS autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType c set omnifunc=ccomplete#Complete let g:pydiction_location colorscheme zenburn endif map <C-n> :NERDTreeToggle<CR> hi MatchParen ctermbg=DarkRed guibg=lightblue autocmd

    1.1K20发布于 2020-01-03
  • 来自专栏米扑专栏

    VIM配置文件vimrc

    CopyFromZ() autocmd! [ch] :call DeleteTrailingWS() "autocmd BufWrite *.cc :call DeleteTrailingWS() "autocmd BufWrite *.txt    autocmd FileType tex inoremap $* \cdot    autocmd FileType tex inoremap $i \item    autocmd FileType script_id=850 autocmd FileType python set complete+=k~/.vim/tools/pydiction autocmd FileType python set *.py 0r ~/.vim/template/simple.py autocmd FileType html set shiftwidth=4 tabstop=4 expandtab  autocmd

    3.2K10发布于 2019-02-19
  • 来自专栏程序员小助手

    Cygwin环境下vim配置

    ") autocmd FileType xml,html,c,cs,java,perl,shell,bash,cpp,python,vim,php,ruby set number autocmd FileType --<ESC>o<ESC>'>o--> autocmd FileType java,c,cpp,cs vmap <C-o> <ESC>'<o autocmd FileType html,text,php ,vim,c,java,xml,bash,shell,perl,python setlocal textwidth=100 autocmd Filetype html,xml,xsl source $ ") autocmd FileType xml,html,c,cs,java,perl,shell,bash,cpp,python,vim,php,ruby set number autocmd FileType --<ESC>o<ESC>'>o--> autocmd FileType java,c,cpp,cs vmap <C-o> <ESC>'<o autocmd FileType html,text,php

    4.2K10发布于 2020-04-08
  • 来自专栏XINDOO的专栏

    Vim的配置说明

    color ron " 设置背景主题 "color torte " 设置背景主题 "set guifont=Courier_New:h10:cANSI " 设置字体 "autocmd InsertLeave * se nocul " 用浅色高亮当前行 autocmd InsertEnter * se cul " 用浅色高亮当前行 set ruler """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "新建.c,.h,.sh,.java文件,自动插入文件头 autocmd ") autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif endif "当打开vim且没有文件时自动打开NERDTree autocmd vimenter * if !

    1.5K10发布于 2021-01-21
  • 来自专栏用户9604369的专栏

    极简 Vim

    我们需要一个自己完全理解,并且足够简单的 ~/.vimrc autocmd Filetype c,cpp,hpp,python set nu " 只在打开特定格式文件时开启行号 autocmd Filetype c,cpp,hpp,python set numberwidth=1 " 当行数为个位数时,只占用一个字符位显示行号 syntax on " 打开语法高亮 autocmd FileType markdown """"""" """""""""""""""""""""""python"""""""""""""""""""""""""""""" set shiftwidth=4 set tabstop=4 autocmd FileType python set expandtab autocmd Filetype gitcommit setlocal spell textwidth=100 " for git commit Filetype c,cpp,hpp,python set nu " 只在打开特定格式文件时开启行号 autocmd Filetype c,cpp,hpp,python set numberwidth

    1.8K40编辑于 2022-03-29
  • 来自专栏Python七号

    这个方法,让 Vim 输入中文成为一种享受

    smartim 插件依靠 Vim 的 autocmd 机制,就是进入命令模式时先把正在使用的输入法保存起来,然后切换到默认的输入法,进入插入模式时再切换为之前的输入法: augroup smartim autocmd! autocmd VimLeavePre * call Smartim_SelectDefault() autocmd InsertLeave * call Smartim_SelectDefault set timeoutlen=0 autocmd VimLeavePre * call Smartim_SelectDefault() autocmd InsertLeave * call Smartim_SelectDefault () autocmd InsertEnter * call Smartim_SelectSaved() augroup end 这样问题解决。

    5.9K20发布于 2021-09-14
  • 来自专栏Yunfeng's Simple Blog

    NeoVim 代码格式化教程

    augroup fmt autocmd! autocmd BufWritePre * Neoformat augroup END 这段代码创建了一个自动化组并命名为fmt,用于将一组命令放在一起,方便管理。 我们首先使用autocmd! 然后用autocmd BufWritePre * Neoformat来完成在写buffer之前,对所有类型的文件都执行Neoformat命令。autocmd表示这是一条自动化命令。 " code format augroup fmt autocmd! " autocmd BufWritePre * undojoin | Neoformat autocmd BufWritePre * Neoformat augroup END " format

    1.4K20编辑于 2023-10-23
  • 来自专栏大猪的笔记

    同步工具

    客户端 main.py import lib import autocmd lib.make_remote_dict() lib.scp_dict() lib.filedict.clear() compare_result_dict) lib.scp(compare_result_dict) lib.py #coding:utf-8 import hashlib import os import autocmd         expect_list = ["yes", "assword"]         expect_func = [input_yes,input_password]         autocmd.Cmd remote_pwd)     expect_list = ["yes", "assword"]     expect_func = [input_yes, input_password]     autocmd.Cmd             print("time out")             pobj.close()             return 服务器端 main.py import lib import autocmd

    87120发布于 2019-11-22
  • 来自专栏算法微时光

    vim之IDE功能配置

    NERDTreeShowBookmarks=1 let NERDTreeWinPos="left" " Automatically open a NERDTree if no files where specified autocmd argc() | NERDTree | endif " Close vim if the only window left open is a NERDTree autocmd bufenter * if completeopt=longest,menu "让Vim的补全菜单行为与一般IDE一致(参考VimTip1228)" set runtimepath+=~/.vim/bundle/YouCompleteMe autocmd argc() | NERDTree | endif " Close vim if the only window left open is a NERDTree autocmd bufenter * if completeopt=longest,menu "让Vim的补全菜单行为与一般IDE一致(参考VimTip1228)" set runtimepath+=~/.vim/bundle/YouCompleteMe autocmd

    1.2K40发布于 2020-04-24
  • 留存vim配置

    " Python文件 autocmd FileType python setlocal tabstop=4 shiftwidth=4 expandtab softtabstop=4 autocmd FileType python setlocal foldmethod=indent " Markdown文件 autocmd FileType markdown setlocal tabstop= 2 shiftwidth=2 expandtab softtabstop=2 autocmd FileType markdown setlocal wrap linebreak " JSON文件 autocmd FileType json setlocal tabstop=2 shiftwidth=2 expandtab softtabstop=2 autocmd FileType json call s:MkdirIfNotExists(expand('<afile>:p:h'))" 自动切换工作目录(方便 CtrlP 搜索项目文件)autocmd BufEnter * silent!

    30610编辑于 2025-12-11
  • 来自专栏python3

    面向web前端及node开发人员的vi

    to let g:user_emmet_mode='a' "enable all function in all mode. let g:user_emmet_install_global=0 autocmd FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr> autocmd FileType json noremap <buffer > <c-f> :call JsonBeautify()<cr> autocmd FileType jsx noremap <buffer> <c-f> :call JsxBeautify()<cr> autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr> autocmd FileType css noremap <buffer > <c-f> :call CSSBeautify()<cr> "vimCSS3syntsx augroup VimCSS3Syntax autocmd!

    62610发布于 2020-01-06
  • 来自专栏悟空被FFmpeg玩

    vim+cscope+ctags源码安装

    syntax on    set hlsearchendif" Only do this part when compiled with support for autocommands.if has("autocmd filetype plugin indent on    " Put these in an autocmd group, so that we can delete them easily.     autocmd FileType text setlocal textwidth=78        " When editing a file, always jump to the last known autocmd BufReadPost *                    \ if line("'\"") > 1 && line("'\"") <= line("$") |                                         \ endif    augroup ENDelse    set autoindent " always set autoindenting onendif " has("autocmd

    1.6K20发布于 2019-03-05
  • 来自专栏Golang语言社区

    Golang 语言--linux 下 go语言 vim设置

    syntax on set hlsearch endif" Only do this part when compiled with support for autocommands. if has("autocmd filetype plugin indent on " Put these in an autocmd group, so that we can delete them easily. autocmd FileType text setlocal textwidth=78 " When editing a file, always jump to the last known cursor autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! \ endif augroup ENDelse set autoindent " always set autoindenting on endif " has("autocmd

    3K90发布于 2018-03-21
  • 来自专栏python3

    python vimrc设置

        call append(5, "__author__ = 'Jiwen Zheng'")     normal G     normal o     normal o endf "tab=4空格 autocmd strftime('%Y-%m-%d %T', localtime()))     call append(2, "# author: 郑集文")     normal G     normal o endf autocmd

    1.1K20发布于 2020-01-13
  • 来自专栏全栈程序员必看

    vim常用设置—(.vimrc详细配置)[通俗易懂]

    ””””””””””””””””””””””””””””””””””””””””””””””””””””””” ” 只在下列文件类型被侦测到的时候显示行号,普通文本文件不显示 if has(“autocmd ”) autocmd FileType xml,html,c,cs,java,perl,shell,bash,cpp,python,vim,php,ruby set number autocmd FileType –<ESC>o<ESC>’>o–> autocmd FileType java,c,cpp,cs vmap <C-o> <ESC>'<o autocmd FileType html,text,php,vim ,c,java,xml,bash,shell,perl,python setlocal textwidth=100 ” autocmd Filetype html,xml,xsl source ” F5

    4.4K10编辑于 2022-08-23
  • 来自专栏python3

    vim-python环境配置

    set guioptions-=m   "不显示菜单     set guioptions-=T   "不显示工具栏     set guifont=consolas\ 10 endif if has("autocmd     "自动检测文件类型,并载入相关的规则文件     filetype plugin on     filetype indent on     "智能缩进,使用4空格,使用全局的了     "autocmd FileType python setlocal et | setlocal sta | setlocal sw=4     "autocmd FileType c setlocal et | setlocal sta | setlocal sw=4     "autocmd FileType h setlocal et | setlocal sta | setlocal sw=4 endif 二、vim python

    1.7K11发布于 2020-01-09
领券