Skip to content

Instantly share code, notes, and snippets.

@ffTsuzuku

ffTsuzuku/vimrc Secret

Created July 4, 2024 01:02
Show Gist options
  • Save ffTsuzuku/1522900bd8547a0727f79fcb316e2358 to your computer and use it in GitHub Desktop.
Save ffTsuzuku/1522900bd8547a0727f79fcb316e2358 to your computer and use it in GitHub Desktop.
" set filetypes as typescriptreact
" autocmd BufNewFile,BufRead *.tsx,*.jsx set filetype=typescriptreact
autocmd VimResized * wincmd =
set relativenumber
set number
set colorcolumn=80
set wildmenu
set ts=4 sw=4
set shiftwidth=4
set softtabstop=4
set ignorecase
set nowrap
set encoding=UTF-8
set cursorline
highlight CursorLine ctermbg=132
let mapleader = " " " map leader to Space
nnoremap <leader>t :NERDTreeToggle<CR>
nnoremap <leader>to :tabnew<CR>
nnoremap <leader>tp :tabp<CR>
nnoremap <leader>tn :tabn<CR>
nnoremap <leader>tx :tabn<CR>
nnoremap <leader>tc :tabc<CR>
nnoremap <leader>nh :nohl<CR>
nnoremap <leader>ff :Files<CR>
nnoremap <leader>fs :Rg<CR>
nnoremap <leader>sh :sv<CR>:wincmd j<CR>
nnoremap <leader>sv :vs<CR>:wincmd l<CR>
nnoremap <leader>gs :Git status<CR>
nnoremap <leader>gg :Git<CR>
nnoremap <leader>gd :Git diff<CR>
nnoremap <leader>gc :Git commit<CR>
noremap <leader>1 1gt
noremap <leader>2 2gt
noremap <leader>3 3gt
noremap <leader>4 4gt
noremap <leader>5 5gt
noremap <leader>6 6gt
noremap <leader>7 7gt
noremap <leader>8 8gt
noremap <leader>9 9gt
noremap <leader>0 :tablast<cr>
noremap <leader>fn :echo @%<CR>
nnoremap <leader>fr :NERDTreeFind<CR> m
nmap <silent> <c-k> :wincmd k<CR>
nmap <silent> <c-j> :wincmd j<CR>
nmap <silent> <c-h> :wincmd h<CR>
nmap <silent> <c-l> :wincmd l<CR>
nnoremap <leader>+ :vertical resize -10<CR>
nnoremap <leader>- :vertical resize +10<CR>
set clipboard+=unnamed " use the clipboards of vim and win
set paste " Paste from a windows or from vim
set go+=a " Visual selection automatically copied to the clipboard
call plug#begin()
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'wincent/command-t'
Plug 'liuchengxu/space-vim-dark'
Plug 'StanAngeloff/php.vim'
Plug 'ryanoasis/vim-devicons'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'maxmellon/vim-jsx-pretty'
Plug 'TysonAndre/php-vim-syntax'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'sainnhe/everforest'
Plug 'SWilson4/valerie'
Plug 'Melon-Bread/10grans-vim'
Plug 'vim-airline/vim-airline'
Plug 'romainl/Disciple'
Plug 'safv12/andromeda.vim'
Plug 'vim-scripts/ashen.vim'
Plug 'rayes0/blossom.vim'
Plug 'sonjapeterson/1989.vim'
call plug#end()
" Plug 'neoclide/coc-tsserver', {'do': 'npm install --frozen-lockfile'}
" Plug 'pangloss/vim-javascript'
" Plug 'leafgarland/typescript-vim'
" Plug 'peitalin/vim-jsx-typescript'
" let g:coc_global_extensions = ['coc-tsserver', 'coc-git', 'coc-phpls']
let g:coc_global_extensions = [
\ 'coc-snippets',
\ 'coc-pairs',
\ 'coc-tsserver',
\ 'coc-eslint',
\ 'coc-prettier',
\ 'coc-json',
\ ]
colorscheme space-vim-dark
colorscheme everforest
let &fillchars ..= ',eob:'
set fillchars=eob:\
set showtabline=1 " 1 to show tabline only when more than one tab is present
set tabline=%!MyTabLine() " custom tab pages line
function! MyTabLine() " acclamation to avoid conflict
let s = '' " complete tabline goes here
" loop through each tab page
for t in range(tabpagenr('$'))
" set highlight
if t + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
" set the tab page number (for mouse clicks)
let s .= '%' . (t + 1) . 'T'
let s .= ' '
" set page number string
let s .= t + 1 . ' '
" get buffer names and statuses
let n = '' " temp string for buffer names while we loop and check buftype
let m = 0 " &modified counter
let bc = len(tabpagebuflist(t + 1)) " counter to avoid last ' '
" loop through each buffer in a tab
for b in tabpagebuflist(t + 1)
" buffer types: quickfix gets a [Q], help gets [H]{base fname}
" others get 1dir/2dir/3dir/fname shortened to 1/2/3/fname
if getbufvar( b, "&buftype" ) == 'help'
let n .= '[H]' . fnamemodify( bufname(b), ':t:s/.txt$//' )
elseif getbufvar( b, "&buftype" ) == 'quickfix'
let n .= '[Q]'
else
let n .= pathshorten(bufname(b))
" let n .= bufname(b)
endif
" check and ++ tab's &modified count
if getbufvar( b, "&modified" )
let m += 1
endif
" no final ' ' added...formatting looks better done later
if bc > 1
let n .= ' '
endif
let bc -= 1
endfor
" add modified label [n+] where n pages in tab are modified
if m > 0
let s .= '[' . m . '+]'
endif
" select the highlighting for the buffer names
" my default highlighting only underlines the active tab
" buffer names.
if t + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
" add buffer names
if n == ''
let s.= '[New]'
else
let s .= n
endif
" switch to no underlining and add final space to buffer list
let s .= ' '
endfor
" after the last tab fill with TabLineFill and reset tab page nr
let s .= '%#TabLineFill#%T'
" right-align the label to close the current tab page
if tabpagenr('$') > 1
let s .= '%=%#TabLineFill#%999Xclose'
endif
return s
endfunction
" call wilder#setup({'modes': [':', '/', '?']})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment