这是我的.virc
call plug#begin('~/.vim/plugged')
Plug 'dart-lang/dart-vim-plugin'
Plug 'natebosch/vim-lsc'
Plug 'natebosch/vim-lsc-dart'
Plug 'tpope/vim-sensible'
Plug 'vim-airline/vim-airline'
Plug 'w0rp/ale'
Plug 'pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh' }
Plug 'ncm2/ncm'
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
Plug 'codota/tabnine-vim'
Plug 'Chiel92/vim-autoformat'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'jiangmiao/auto-pairs'
Plug 'autozimu/LanguageClient-neovim', {
'branch': 'next',
'do': 'bash install.sh',
}
" Plug 'valloric/youcompleteme'
let g:lsc_server_commands = {'dart': 'dart_language_server'}
call plug#end()
let g:ale_fixers = {
'javascript': ['eslint']
}
let g:ale_sign_error = '❌'
let g:ale_sign_warning = '⚠️'
let g:lsc_enable_autocomplete = v:true
let g:lsc_auto_map = v:true
let g:ale_fix_on_save = 1
let g:ale_javascript_prettier_use_local_config = 1
let g:ale_javascript_eslint_options = '-c ~/.eslintrc'
let g:ale_lint_on_enter = 0
let g:ansible_unindent_after_newline = 1
autocmd BufEnter * call ncm2#enable_for_buffer()
set completeopt=noinsert,menuone,noselect
" set softtabstop=2
" set shiftwidth=2
" set expandtab
set expandtab
" show existing tab with 2 spaces width
set tabstop=2
set softtabstop=2
" when indenting with '>', use 2 spaces width
set shiftwidth=2
nnoremap <A-Down> :m .+1<CR>==
nnoremap <A-Up> :m .-2<CR>==
inoremap <A-Down> <Esc>:m .+1<CR>==gi
inoremap <A-Up> <Esc>:m .-2<CR>==gi
vnoremap <A-Down> :m '>+1<CR>gv=gv
vnoremap <A-Up> :m '<-2<CR>gv=gv
set statusline=%<%f %h%m%r%{kite#statusline()}%=%-14.(%l,%c%V%) %P
set laststatus=2
let g:python3_host_prog='/home/thebozzkg/anaconda3/bin/python3'
au BufWrite * :Autoformat
let g:airline#extensions#tabline#enabled = 1
let g:airline_detect_spell=1
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = '☰'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.dirty='⚡'
nnoremap <ALT-Left> :tabprevious<CR>
nnoremap <ALT-Right> :tabnext<CR>
关于我的一些笔记:
- 我不使用hjkl我使用箭头键(请不要侮辱我(
- 我写Javascript,Dart,Markdown,YAML,JSON,C,&neovim中的C++(到目前为止((我正在从VSCode切换(
- 我拥有的大部分东西都是从GitHub和一些Vim维基上复制的
- 我安装了蟒蛇
- 我使用的是Ubuntu Linux 20.04(如果这很重要的话(
由于某种原因,我不知道是哪些插件在做这件事,但我的自动完成一直把我的文件搞砸(编辑YAML文件并保存它们绝对是一种折磨,几乎所有文件都会丢失一些缩进(,还崩溃了(TabNine(
有人能帮我解决这个烂摊子吗?
欢迎使用Vim!
我想大多数vim新用户都去过那里。我当然有!我想要一个"vim as python IDE",并从安装vim后,sun几乎立即进入我的vimrc。
在花了一些时间与所有的设置,插件和重制版斗争之后,我不明白,我决定一行一行地浏览我的vimrc并发表评论找出我不明白的东西(几乎全部(。
然后我用了一段时间这种更简单的vim,每当我决定我有一个需要某个功能,我查看了大量评论的vimrc看起来是相关的,和/或在谷歌上搜索仅用于该特定功能。经常你会发现有一个内置的方法可以通过核心vim命令来实现这一点,如果没有,那么这个问题有很多解决方案(通常,你发现有一种更强大的方式是你没有想到的——这些是好日子(。
但关键是不要试图在一夜之间强迫vim进入一个巨大的IDE!顺其自然事情会逐渐发生,事情会变得更有意义,你最终会得到你理解的vimrc,因此可以添加到它中并进行调整
我要说的最后一件事是推荐以下书籍:
Steve Losh的《艰难的生活》
Drew Neil的《现实的生活》,以及他伴随而来的电影系列
(还有The Primagean,他做高质量的youtube教程(
说了这么多,并承认无法给出客观的答案对于您的问题,这里有一个最小的vimrc,它有一些插件和设置做一些简单但非常有用的事情(但一定要仔细阅读,了解如何他们工作!(:
"==== PLUGINS =================================================================
set nocompatible " don't try to be compatible with Vi
filetype plugin indent on " use default plugins
call plug#begin('~/.vim/plugged')
" plugins I would put in a new vimrc
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'vim-scripts/ReplaceWithRegister'
Plug 'flazz/vim-colorschemes'
"==== CUSTOM CONFIGURATIONS ===================================================
"- general settings -----------------------------------------------------------
set encoding=utf-8
set linebreak " wrap long lines at char in 'breakat' (default " ^I!@*-+;:,./?")
set nowrap " don't wrap lines by default
set expandtab " expand tabs into spaces
set tabstop=4 " a tab is the same as 4 spaces
set softtabstop=4 " when I hit <tab> in insert mode, put 4 spaces
set shiftwidth=4 " when auto-indenting, use 4 spaces per tab
set autoindent " when creating a new line, copy indent from line above
set incsearch " show matches for patterns while they are being typed
set smartcase " with both on, searches with no capitals are case insensitive...
set ignorecase " ...while searches with capital characters are case sensitive.
set spell spelllang=en
set nospell " don't hightlight misspellings unles I say so
set lazyredraw " don't redraw screen during macros (let them complete faster)
set t_Co=256 " use full colours
syntax enable " highlight special words to aid readability
colorscheme zenburn
" THIS NEXT BIT I DEBATED INCLUDING - IT'S MY PERSONAL PREFERENCE AND BY
NO MEANS 'NECESSARY' AND COULD SAFELY BE EXCLUDED... BUT I JUST HATED THE
BLOCK CURSOR IN INSERT MODE SO MUCH...
"- cursor behaviour (make cursor blink for insert mode, block for normal mode)
augroup cursor_behaviour
autocmd!
" reset cursor on start:
autocmd VimEnter * silent !echo -ne "e[2 q"
" cursor blinking bar on insert mode
let &t_SI = "e[5 q"
" cursor steady block on command mode
let &t_EI = "e[2 q"
" highlight current line when in insert mode
autocmd InsertEnter * set cursorline
" turn off current line hightlighting when leaving insert mode
autocmd InsertLeave * set nocursorline
augroup END
祝你好运!