nodejs vim 설정
22146 단어 vim
https://github.com/tlhunter/vimrc
cd ~
git clone git://github.com/tlhunter/vimrc.git .vim
ln -s ~/.vim/vimrc ~/.vimrc # Optional, needed for some VIM installations
tab 키 자동 완성
cd ~
.vimrc
let g:ycm_min_num_of_chars_for_completion = 3
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_complete_in_comments = 1
let g:ycm_key_list_select_completion = ['' , '' ]
let g:ycm_key_list_previous_completion = ['' , '' ]
function! MyTabFunction ()
let line = getline('.')
let substr = strpart(line, -1, col('.')+1)
let substr = matchstr(substr, "[^ \t]*$")
if strlen(substr) == 0
return "\"
endif
return pumvisible() ? "\" : "\\"
endfunction
inoremap =MyTabFunction()
설치 ternfor_vim
apt - vim 설치
1. Install python 2.7.x or python 3
2. git clone https://github.com/egalpin/apt-vim.git
3. cd apt-vim
4. ./apt-vim init
5. Add ~/.vimpkg/bin to your PATH (export PATH=$PATH:~/.vimpkg/bin)
6. .vimrc execute pathogen#infect()
8. Run apt-vim install -y
9. apt-vim install -y https://github.com/marijnh/tern_for_vim.git
tern_for_vim ternjs vim , javascript omnifunc, tern#Complete。
,vim omnifunc。
tern_for_vim omnifunc, vim omni completion。
vim tern_for_vim , .tern-project, echarts , :
{
"libs": [
"browser"
],
"plugins": {
"requirejs": {
"baseUrl": "./src",
"paths": {
"zrender": "bower_components/zrender/src"
}
}
}
}
libs ,tern :
browser
chai
ecma5,
ecma6
jquery
underscore
나의 설정
call pathogen#infect()
let mapleader = "."
set nocompatible
set viminfo='1000,f1,:1000,/1000
set history=1000
let pair_program_mode = 0
"------ Visual Options ------
syntax on
set number
set nowrap
set vb
set ruler
set statusline=%14.(%l,%c%V%)\ %P
let g:buftabs_only_basename=1
let g:buftabs_marker_modified = "+"
" Toggle whitespace visibility with ,s
nmap s :set list!
set listchars=tab:▸\ ,trail:·,extends:❯,precedes:❮,nbsp:×
:set list " Enable by default
" L = Toggle line numbers
map L :set invnumber
" New splits open to right and bottom
set splitbelow
set splitright
"------ Generic Behavior ------
set tabstop=4
set shiftwidth=4
set hidden
filetype indent on
filetype plugin on
set autoindent
"set expandtab
set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,node_modules/*
"allow deletion of previously entered data in insert mode
set backspace=indent,eol,start
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! %!sudo tee > /dev/null %
" F2 = Paste Toggle (in insert mode, pasting indented text behavior changes)
set pastetoggle=
" The search for the perfect color scheme...
map x :RandomColorScheme
" v = Paste
map v " +gP
" c = Copy
map c " +y
" Accidentally pressing Shift K will no longer open stupid man entry
noremap K
" Edit and Reload .vimrc files
nmap ev :e $MYVIMRC
nmap es :so $MYVIMRC
" When pressing cd switch to the directory of the open buffer
map ,cd :cd %:p:h
" Wtf is Ex Mode anyways?
nnoremap Q
" Annoying window
map q: :q
"------ Text Navigation ------
" Prevent cursor from moving to beginning of line when switching buffers
set nostartofline
" Keep the cursor in place while joining lines
nnoremap J mzJ`z
" H = Home, L = End
noremap H ^
noremap L $
vnoremap L g_
"------ Window Navigation ------
" hljk = Move between windows
nnoremap h h
nnoremap l l
nnoremap j j
nnoremap k k
" ------ Buffer Navigation ------
" Ctrl Left/h & Right/l cycle between buffers
noremap :bprev
noremap :bprev
noremap :bnext
noremap :bnext
" q Closes the current buffer
nnoremap q :Bclose
" Q Closes the current window
nnoremap Q c
" Ctrl+q Force Closes the current buffer
nnoremap :Bclose!
"------ Searching ------
set incsearch
set ignorecase
set smartcase
set hlsearch
" Clear search highlights when pressing b
nnoremap b :nohlsearch
" http://www.vim.org/scripts/script.php?script_id=2572
" a will open a prmompt for a term to search for
noremap a :Ack
" A will close the new window created for that ack search
noremap A jcl
let g:ackprg=" ack -H --nocolor --nogroup --column"
" When searching for words with * and navigating with N/n, keep line centered vertically
"nnoremap n nzz
"nnoremap N Nzz
"nnoremap * *zz
"nnoremap # #zz
"nnoremap g* g*zz
"nnoremap g# g#zz
" CtrlP will load from the CWD, makes it easier with all these nested repos
let g:ctrlp_working_path_mode = ''
" CtrlP won't show results from node_modules
let g:ctrlp_custom_ignore = '\v[\/](node_modules|coverage|target|dist)|(\.(swp|ico|git|svn))$'
"type S, then type what you're looking for, a /, and what to replace it with
nmap S :%s//g
vmap S :s//g
" ------ NERDTree Options ------
let NERDTreeIgnore=['CVS','\.dSYM$']
"setting root dir in NT also sets VIM's cd
let NERDTreeChDirMode=2
" Toggle visibility using n
noremap n :NERDTreeToggle
" Focus on NERDTree using m
noremap m :NERDTreeFocus
" These prevent accidentally loading files while focused on NERDTree
autocmd FileType nerdtree noremap left>
autocmd FileType nerdtree noremap
autocmd FileType nerdtree noremap right>
autocmd FileType nerdtree noremap
" Open NERDTree if we're executing vim without specifying a file to open
autocmd vimenter * if !argc() | NERDTree | endif
" Close if only NERDTree open
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Hides "Press ? for help"
let NERDTreeMinimalUI=1
"------ Fugitive Plugin Options ------
"https://github.com/tpope/vim-fugitive
nnoremap gs :Gstatus
nnoremap gr :Gremove
nnoremap gl :Glog
nnoremap gb :Gblame
nnoremap gm :Gmove
nnoremap gp :Ggrep
nnoremap gR :Gread
nnoremap gg :Git
nnoremap gd :Gdiff
"------ Text Editing Utilities ------
" T = Delete all Trailing space in file
map T :%s/\s\+$//
" U = Deletes Unwanted empty lines
map U :g/^$/d
" R = Converts tabs to spaces in document
map R :retab
" Deletes trailing space in file upon write
" autocmd BufWritePre * :%s/\s\+$//e
"------ JSON Filetype Settings ------
au BufRead,BufNewFile *.json set filetype=json
let g:vim_json_syntax_conceal = 0
nmap =j :%!python -m json.tool:setfiletype json
autocmd BufNewFile,BufRead *.webapp set filetype=json
autocmd BufNewFile,BufRead *.jshintrc set filetype=json
" ------ CoffeeScript Filetype Settings ------
au BufNewFile,BufReadPost *.coffee set shiftwidth=2 softtabstop=2 expandtab
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
au BufWritePost *.coffee silent make!
autocmd QuickFixCmdPost * nested cwindow | redraw!
"------ JSX Filetype Settings ------
autocmd! BufEnter *.jsx let b:syntastic_checkers=['jsxhint']
"------ EJS Filetype Settings ------
au BufNewFile,BufRead *.ejs set filetype=html
"------ SCSS Filetype Settings ------
autocmd FileType scss set iskeyword+=-
"------ Airline Settings ------
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = ' '
"------ GUI Options ------
if has("gui_running")
" Hides toolbar and scrollbars and File menu
set guioptions=egt
" Highlights the current line background
set cursorline
colorscheme gotham
"autocmd VimEnter * TagbarOpen
" Open VIM in fullscreen window
set lines=200 columns=500
" Build all help tags (slower launch, but I run GUI vim like once per day)
call pathogen#helptags()
if has("gui_macvim") " OS X
"set guifont=Monaco:h14
set guifont=Monaco:h10
set noantialias
"set transparency=15
" Swipe to move between bufers :D
map :bprev
map :bnext
" Cmd+Shift+N = new buffer
map :enew
" Cmd+P = CtrlP
" TODO: This doesn't actually work, still opens Print dialog
macmenu File.Print key=
nnoremap :CtrlP
" Cmd+t = new tab
nnoremap :tabnew
" Cmd+w = close tab (this should happen by default)
nnoremap :tabclose
" Cmd+1...9 = go to that tab
map 1> 1gt
map 2> 2gt
map 3> 3gt
map 4> 4gt
map 5> 5gt
map 6> 6gt
map 7> 7gt
map 8> 8gt
map 9> 9gt
" OS X probably has ctags in a weird place
let g:tagbar_ctags_bin='/usr/local/bin/ctags'
" Pair Program mode, so that my coworkers can read my screen ;)
nnoremap p :call PairProgramMode()
function! PairProgramMode()
if g:pair_program_mode
let g:pair_program_mode = 0
set guifont=Monaco:h10
set noantialias
set lines=200 columns=500
else
set guifont=Monaco:h15
set antialias
set lines=200 columns=500
let g:pair_program_mode = 1
endif
endfunction
elseif has("gui_gtk2") " Linux
set guifont=monospace\ 9
" Alt+n = new buffer
map :enew
" Alt+t = new tab
nnoremap :tabnew
" Alt+w = close tab
nnoremap :tabclose
" Alt+1...9 = go to that tab
map 1gt
map 2gt
map 3gt
map 4gt
map 5gt
map 6gt
map 7gt
map 8gt
map 9gt
elseif has(" gui_win32") " Windows
" WHAT ARE YOU DOING WITH YOUR LIFE?!
endif
else
set t_Co=256
colorscheme Mustang
set mouse=a
endif
"------ Local Overrides ------
if filereadable($HOME.'/.vimrc_local')
source $HOME/.vimrc_local
endif
let g:ycm_min_num_of_chars_for_completion = 3
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_complete_in_comments = 1
let g:ycm_key_list_select_completion = ['', '']
let g:ycm_key_list_previous_completion = ['', '']
function! MyTabFunction ()
let line = getline('.')
let substr = strpart(line, -1, col('.')+1)
let substr = matchstr(substr, "[^ \t]*$")
if strlen(substr) == 0
return "\"
endif
return pumvisible() ? "\" : "\\"
endfunction
inoremap =MyTabFunction()
if !has('python') && !has('python3')
echo 'tern requires python support'
finish
endif
execute pathogen#infect()
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Lua에서 neovim 플러그인용 UI를 만드는 방법마지막 에서는 부동 창을 사용하여 Lua에서 플러그인을 만드는 기본 사항을 살펴보았습니다. 편리한 측면 탐색에서 마지막으로 연 파일을 표시하는 간단한 플러그인을 만들어 봅시다. 인터페이스 학습에 집중하면서 이러한 목...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.