Skip to content

Instantly share code, notes, and snippets.

@5kr1p7
Created April 28, 2022 14:17
Show Gist options
  • Save 5kr1p7/66a6aaf3ef998449eedd4c2daacffc0b to your computer and use it in GitHub Desktop.
Save 5kr1p7/66a6aaf3ef998449eedd4c2daacffc0b to your computer and use it in GitHub Desktop.
VIM on kubernetes
"let g:lightline = {
" \ 'colorscheme': 'onedark',
" \ }
"colorscheme onedark
if !1 | finish | endif
augroup vimrc
autocmd!
augroup END
let using_neovim = has('nvim')
let using_vim = !using_neovim
let fancy_symbols_enabled = 1
let vim_plug_just_installed = 0
if using_neovim
let vim_plug_path = expand('~/.config/nvim/autoload/plug.vim')
else
let vim_plug_path = expand('~/.vim/autoload/plug.vim')
endif
if !filereadable(vim_plug_path)
echo "Installing Vim-plug..."
echo ""
if using_neovim
silent !mkdir -p ~/.config/nvim/autoload
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
else
silent !mkdir -p ~/.vim/autoload
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
let vim_plug_just_installed = 1
endif
" manually load vim-plug the first time
if vim_plug_just_installed
:execute 'source '.fnameescape(vim_plug_path)
endif
syntax on
autocmd FileType php setlocal omnifunc=phpcomplete_extended#CompletePHP
call plug#begin('~/nvim/plugged')
Plug 'tpope/vim-fugitive'
call plug#end()
call plug#begin()
Plug 'phpactor/phpactor' , {'do': 'composer install', 'for': 'php'}
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'phpactor/ncm2-phpactor'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
Plug 'preservim/nerdtree' | Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | Plug 'ryanoasis/vim-devicons'
Plug 'itchyny/lightline.vim'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'StanAngeloff/php.vim', {'for': 'php'}
Plug 'stephpy/vim-php-cs-fixer', {'for': 'php'}
Plug 'nishigori/vim-php-dictionary', {'for': 'php'}
Plug 'adoy/vim-php-refactoring-toolbox', {'for': 'php'} " php refactoring options
Plug '2072/php-indenting-for-vim', {'for': 'php'}
Plug 'tobyS/vmustache' | Plug 'tobyS/pdv', {'for': 'php'} " php doc autocompletion
Plug 'scrooloose/nerdcommenter'
Plug 'vim-scripts/IndexedSearch'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'roxma/vim-hug-neovim-rpc'
if using_neovim && vim_plug_just_installed
Plug 'Shougo/deoplete.nvim', {'do': ':autocmd VimEnter * UpdateRemotePlugins'}
else
Plug 'Shougo/deoplete.nvim'
endif
Plug 'deoplete-plugins/deoplete-jedi'
Plug 'Shougo/context_filetype.vim'
Plug 'davidhalter/jedi-vim'
Plug 'Townk/vim-autoclose'
Plug 'tpope/vim-surround'
Plug 'michaeljsmith/vim-indent-object'
Plug 'jeetsukumaran/vim-indentwise'
Plug 'sheerun/vim-polyglot'
Plug 'mileszs/ack.vim'
Plug 'lilydjwg/colorizer'
Plug 'fisadev/vim-isort'
Plug 'valloric/MatchTagAlways'
Plug 'mattn/emmet-vim'
Plug 'tpope/vim-fugitive'
Plug 'mhinz/vim-signify'
Plug 'neomake/neomake'
Plug 'chrisbra/csv.vim'
Plug 'honza/vim-snippets' " snippets
Plug 'AndrewRadev/splitjoin.vim' " Split arrays in PHP / struct in Go / other things
" set g:NERDTreeExtensionHighlightColor if you want a custom color instead of the default one
let g:NERDTreeSyntaxEnabledExtensions = ['hbs', 'lhs'] " enable highlight to .hbs and .lhs files with default colors
let g:NERDTreeSyntaxEnabledExactMatches = ['dropbox', 'node_modules', 'favicon.ico'] " enable highlight for dropbox and node_modules folders, and favicon.ico files with default colors
let g:NERDTreeSyntaxEnabledExtensions = ['c', 'h', 'c++', 'cpp', 'php', 'rb', 'js', 'css', 'html'] " enabled extensions with default colors
let g:NERDTreeSyntaxEnabledExactMatches = ['node_modules', 'favicon.ico'] " enabled exact matches with default colors
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
let g:netrw_winsize = 25
set noswapfile
set number
set autoindent
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set shiftround
set ignorecase
set smartcase
autocmd vimrc BufWrite *.php,*.js,*.jsx,*.vue,*.twig,*.html,*.sh,*.yaml,*.yml,*.clj,*.cljs,*.cljc call general#DeleteTrailingWS()
nmap <F6> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
if !has('nvim') " Vim 8 only
pythonx import pynvim
endif
set encoding=utf-8
let g:airline_section_x = ''
" set list
set list listchars=tab:\┆\ ,trail:·,nbsp:±
" doesn't prompt a warning when opening a file and the current file was modified but not saved
set hidden
augroup nerdtree
autocmd!
autocmd FileType nerdtree syntax clear NERDTreeFlags
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=ALL
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=ALL
autocmd FileType nerdtree setlocal conceallevel=3
autocmd FileType nerdtree setlocal concealcursor=nvic
augroup END
"Tagbar######################################################
"Set the distribution of the two here
let g:tagbar_vertical = 25
"Remove the first line of help information
let g:tagbar_compact = 1
"When editing the code, inTagbarAutomatically track variables
let g:tagbar_autoshowtag = 1
"Personal hobbies, expand and close the folder icon
let g:tagbar_iconchars = ['▸', '▾']
"<F3>as toggle
nmap <F3> :TagbarToggle<CR>
"Automatically open when opening vim
"autocmd VimEnter * nested :TagbarOpen
wincmd l
"If you don’
map <Leader>n <plug>NERDTreeTabsToggle<CR>
let g:nerdtree_tabs_open_on_console_startup=1
map <F2> :w! <CR>
map <F10> :q <CR>
map <F5> :Buffers <CR>
let NERDTreeStatusline="%{matchstr(getline('.'), '\\s\\zs\\w\\(.*\\)')}"
augroup filetype_nerdtree
au!
au FileType nerdtree call s:disable_lightline_on_nerdtree()
au WinEnter,BufWinEnter,TabEnter * call s:disable_lightline_on_nerdtree()
augroup END
fu s:disable_lightline_on_nerdtree() abort
let nerdtree_winnr = index(map(range(1, winnr('$')), {_,v -> getbufvar(winbufnr(v), '&ft')}), 'nerdtree') + 1
call timer_start(0, {-> nerdtree_winnr && setwinvar(nerdtree_winnr, '&stl', '%#Normal#')})
endfu
if !has('nvim') " Vim 8 only
pythonx import pynvim
endif
filetype plugin on
filetype indent on
set ls=2
set incsearch
set hlsearch
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set nu
set fillchars+=vert:\│
if &filetype == "nerdtree"
silent exe substitute(mapcheck("R"), "<CR>", "", "")
endif
endfunction
autocmd BufEnter * call NERDTreeRefresh()
" use 256 colors when possible
if has('gui_running') || using_neovim || (&term =~? 'mlterm\|xterm\|xterm-256\|screen-256')
if !has('gui_running')
let &t_Co = 256
endif
let g:vim_monokai_tasty_italic = 1
colorscheme vim-monokai-tasty
let g:airline_theme='monokai_tasty'
let g:lightline = { 'colorscheme': 'monokai_tasty' } " lightline theme
else
colorscheme delek
endif
" Fzf ------------------------------
" file finder mapping
nmap ,e :Files<CR>
" tags (symbols) in current file finder mapping
nmap ,g :BTag<CR>
" the same, but with the word under the cursor pre filled
nmap ,wg :execute ":BTag " . expand('<cword>')<CR>
" tags (symbols) in all files finder mapping
nmap ,G :Tags<CR>
" the same, but with the word under the cursor pre filled
nmap ,wG :execute ":Tags " . expand('<cword>')<CR>
" general code finder in current file mapping
nmap ,f :BLines<CR>
" the same, but with the word under the cursor pre filled
nmap ,wf :execute ":BLines " . expand('
" this first setting decides in which order try to guess your current vcs
" UPDATE it to reflect your preferences, it will speed up opening files
let g:signify_vcs_list = ['git', 'hg']
" mappings to jump to changed blocks
nmap <leader>sn <plug>(signify-next-hunk)
nmap <leader>sp <plug>(signify-prev-hunk)
" nicer colors
highlight DiffAdd cterm=bold ctermbg=none ctermfg=119
highlight DiffDelete cterm=bold ctermbg=none ctermfg=167
highlight DiffChange cterm=bold ctermbg=none ctermfg=227
highlight SignifySignAdd cterm=bold ctermbg=237 ctermfg=119
highlight SignifySignDelete cterm=bold ctermbg=237 ctermfg=167
highlight SignifySignChange cterm=bold ctermbg=237 ctermfg=227
" Autoclose ------------------------------
" Fix to let ESC work as espected with Autoclose plugin
" (without this, when showing an autocompletion window, ESC won't leave insert
" mode)
let g:AutoClosePumvisible = {"ENTER": "\<C-Y>", "ESC": "\<ESC>"}
" Airline ------------------------------
let g:airline_powerline_fonts = 1
let g:airline_theme = 'bubblegum'
let g:airline#extensions#whitespace#enabled = 0
" Fancy Symbols!!
if fancy_symbols_enabled
let g:webdevicons_enable = 1
" custom airline symbols
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
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 = '⭡'
else
let g:webdevicons_enable = 0
endif
map <C-t><up> :tabr<cr>
map <C-t><down> :tabl<cr>
map <C-t><left> :tabp<cr>
map <C-t><right> :tabn<cr>
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|runtime\|runtime_'
" let g:python3_host_prog = expand('/usr/bin/python3.6')
" let g:syntastic_python_python_exec = 'python3.6'
let g:deoplete#enable_at_startup = 1
let g:deoplete#auto_complete = 1
" Start NERDTree
autocmd VimEnter * NERDTree
" Go to previous (last accessed) window.
" autocmd VimEnter * wincmd p
highlight CursorLineNr gui=bold guifg=DarkRed guibg=#c0d0e0
hi! EndOfBuffer ctermbg=bg ctermfg=bg guibg=bg guifg=bg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment