Skip to content

Instantly share code, notes, and snippets.

@mkaraki
Last active October 4, 2023 02:32
Show Gist options
  • Save mkaraki/371f7c7f37362821c45a16a4d106a1bd to your computer and use it in GitHub Desktop.
Save mkaraki/371f7c7f37362821c45a16a4d106a1bd to your computer and use it in GitHub Desktop.
""" Windows Vim Settings
if &term =~ '^xterm'
" solid underscore
let &t_SI .= "\<Esc>[4 q"
" solid block
let &t_EI .= "\<Esc>[2 q"
" 1 or 0 -> blinking block
" 3 -> blinking underscore
" Recent versions of xterm (282 or above) also support
" 5 -> blinking vertical bar
" 6 -> solid vertical bar
endif
set t_Co=256
set t_ut=
set mouse=
""" Insert mode settings
set backspace=indent,eol,start
""" Coding
set number
"" Indent
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set autoindent
set smartindent
""" Search
set hlsearch
set incsearch
""" Editor
set laststatus=2
""" Per language configs
"" Makefile
autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=0
" Encoding
set encoding=utf-8
set fileformat=unix
" netrw
let g:netrw_liststyle=3
let g:netrw_banner=0
let g:netrw_preview = 1
let g:netrw_winsize = 15
autocmd VimEnter * if !argc() | Explore | endif
autocmd VimEnter * if isdirectory(expand('<afile>')) | Explore | endif
augroup netrw_mapping
autocmd!
autocmd filetype netrw call NetrwMapping()
augroup END
function! NetrwMapping()
" noremap <buffer> <Return> <NOP>
endfunction
""" Dein.vim Install
let $CACHE = expand('~/.cache')
if !($CACHE->isdirectory())
call mkdir($CACHE, 'p')
endif
if &runtimepath !~# '/dein.vim'
let s:dir = 'dein.vim'->fnamemodify(':p')
if !(s:dir->isdirectory())
let s:dir = $CACHE .. '/dein/repos/github.com/Shougo/dein.vim'
if !(s:dir->isdirectory())
execute '!git clone https://github.com/Shougo/dein.vim' s:dir
endif
endif
execute 'set runtimepath^='
\ .. s:dir->fnamemodify(':p')->substitute('[/\\]$', '', '')
endif
" Ward off unexpected things that your distro might have made, as
" well as sanely reset options when re-sourcing .vimrc
set nocompatible
" Set dein base path (required)
let s:dein_base = '~/.cache/dein/'
" Set dein source path (required)
let s:dein_src = '~/.cache/dein/repos/github.com/Shougo/dein.vim'
" Set dein runtime path (required)
execute 'set runtimepath+=' .. s:dein_src
" Call dein initialization (required)
call dein#begin(s:dein_base)
call dein#add(s:dein_src)
call dein#add('Shougo/ddc.vim')
call dein#add('vim-denops/denops.vim')
" Install your UIs
" call dein#add('Shougo/ddc-ui-native')
call dein#add('Shougo/ddc-ui-pum')
call dein#add('Shougo/pum.vim')
" Install your sources
call dein#add('Shougo/ddc-source-around')
call dein#add('LumaKernel/ddc-source-file')
call dein#add('Shougo/ddc-matcher_head')
call dein#add('Shougo/ddc-sorter_rank')
call dein#add('Shougo/ddc-converter_remove_overlap')
call dein#add('gelguy/wilder.nvim')
if !has('nvim')
call dein#add('roxma/nvim-yarp')
call dein#add('roxma/vim-hug-neovim-rpc')
endif
call dein#add('sonph/onehalf', { 'rtp': 'vim' })
call dein#end()
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
filetype indent plugin on
" Enable syntax highlighting
if has('syntax')
syntax on
endif
" Uncomment if you want to install not-installed plugins on startup.
if dein#check_install()
call dein#install()
endif
call ddc#custom#patch_global('ui', 'pum')
"call ddc#custom#patch_global('ui', 'native')
call ddc#custom#patch_global('sources', ['around', 'file'])
call ddc#custom#patch_global('sourceParams', #{
\ around: #{ maxSize: 500 },
\ })
call ddc#custom#patch_global('sourceOptions', {
\ '_': {
\ 'matchers': ['matcher_head'],
\ 'sorters': ['sorter_rank'],
\ 'converters': ['converter_remove_overlap'],
\ },
\ 'file': {
\ 'mark': 'F',
\ 'isVolatile': v:true,
\ 'forceCompletionPattern': '\S/\S*',
\ },
\ 'around': #{ mark: 'A' },
\ })
call ddc#custom#patch_filetype(
\ ['ps1', 'dosbatch', 'autohotkey', 'registry'], {
\ 'sourceOptions': {
\ 'file': {
\ 'forceCompletionPattern': '\S\\\S*',
\ },
\ },
\ 'sourceParams': {
\ 'file': {
\ 'mode': 'win32',
\ },
\ }})
call ddc#enable()
inoremap <silent><expr> <TAB>
\ pum#visible() ? '<Cmd>call pum#map#insert_relative(+1)<CR>' :
\ (col('.') <= 1 <Bar><Bar> getline('.')[col('.') - 2] =~# '\s') ?
\ '<TAB>' : ddc#map#manual_complete()
inoremap <S-Tab> <Cmd>call pum#map#insert_relative(-1)<CR>
inoremap <C-n> <Cmd>call pum#map#select_relative(+1)<CR>
inoremap <C-p> <Cmd>call pum#map#select_relative(-1)<CR>
inoremap <C-y> <Cmd>call pum#map#confirm()<CR>
inoremap <C-e> <Cmd>call pum#map#cancel()<CR>
call wilder#setup({'modes': [':', '/', '?']})
set wildoptions+=pum
colorscheme onehalflight
let g:airline_theme='onehalflight'
let g:denops_disable_version_check=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment