Compare commits
85 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
eadc5b4c75
|
|||
|
d07f8f78e1
|
|||
| b8e13b4e34 | |||
| 005a3f1c1f | |||
| 0e66131107 | |||
| 6aa7e10b54 | |||
| adac7168bc | |||
| f559e8b242 | |||
| 65013e1ac5 | |||
| 97875214fa | |||
| efc29ec3b9 | |||
| 6f5ba10aa6 | |||
| 58dae500af | |||
| 8350566c14 | |||
| 8143c60b21 | |||
| 2c6ffd02e5 | |||
| 8853388dea | |||
| a070eccaf4 | |||
| cc39580382 | |||
| 523dd1ad3a | |||
| 08d59860f5 | |||
| 0eea46beae | |||
| bf7c114395 | |||
| 34abb66cc9 | |||
| f99343ca6e | |||
| d30df125c5 | |||
| 1c2e0fccc3 | |||
| 6e62775c1d | |||
| c403eb2e73 | |||
| e99f6129db | |||
| e2505ecfc8 | |||
| 3dac35b6cf | |||
| 5d64f2d58a | |||
| e94bbdb593 | |||
| 31ad2f7f7a | |||
|
|
3ff7565a49 | ||
|
|
4b5bc96115 | ||
|
|
1ce2e893f4 | ||
|
|
ab04e82f56 | ||
|
|
0432585de0 | ||
|
|
98657d610b | ||
|
|
0361e83857 | ||
|
|
e463bb7846 | ||
|
|
4bc374c640 | ||
|
|
d5490493af | ||
|
|
2fa24865db | ||
|
|
2ac0658755 | ||
|
|
d32bc4751b | ||
|
|
7efad8aba1 | ||
|
|
353281ff32 | ||
|
|
649f4db641 | ||
|
|
275a07bf4e | ||
|
|
3adeb5e04e | ||
|
|
77a5eb5742 | ||
|
|
e7c9a509c6 | ||
|
|
fcf39e4352 | ||
|
|
4eca702e94 | ||
|
|
8ca26b851d | ||
|
|
841afeb278 | ||
|
|
056d16651d | ||
| 0b2a3aa3fc | |||
| 60ea3da091 | |||
| 5f149871f7 | |||
| 7a8a1f425f | |||
| ea4275de9c | |||
| 728fc1cc94 | |||
| cb32e85d5c | |||
| fd0ec0ec30 | |||
| 2f8ea2f5bc | |||
| aa30843b94 | |||
| 9347f35352 | |||
| 6fb310f1f4 | |||
| 37f6c79332 | |||
| 7e7201f6d7 | |||
| 2f0190fad6 | |||
| c58eab1c0e | |||
| c5c5364205 | |||
| 23e2f09a8b | |||
| 901d336d82 | |||
| 6b6c3628bb | |||
| 635cc5748c | |||
| cf05781c02 | |||
| 23abdd12ac | |||
| b1e614cddc | |||
| 47a0889a7d |
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/.VimballRecord
|
||||
/.mypy_cache/
|
||||
/.netrwbook
|
||||
/.netrwhist
|
||||
/.ycm_extra_conf.pyc
|
||||
/doc/tags
|
||||
/haskellmode.config
|
||||
/hotkeys
|
||||
/log.vim
|
||||
/plugged/
|
||||
154
.ycm_extra_conf.py
Executable file
154
.ycm_extra_conf.py
Executable file
@@ -0,0 +1,154 @@
|
||||
# This file is NOT licensed under the GPLv3, which is the license for the rest
|
||||
# of YouCompleteMe.
|
||||
#
|
||||
# Here's the license text for this file:
|
||||
#
|
||||
# This is free and unencumbered software released into the public domain.
|
||||
#
|
||||
# Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
# distribute this software, either in source code form or as a compiled
|
||||
# binary, for any purpose, commercial or non-commercial, and by any
|
||||
# means.
|
||||
#
|
||||
# In jurisdictions that recognize copyright laws, the author or authors
|
||||
# of this software dedicate any and all copyright interest in the
|
||||
# software to the public domain. We make this dedication for the benefit
|
||||
# of the public at large and to the detriment of our heirs and
|
||||
# successors. We intend this dedication to be an overt act of
|
||||
# relinquishment in perpetuity of all present and future rights to this
|
||||
# software under copyright law.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
import os
|
||||
import ycm_core
|
||||
|
||||
# These are the compilation flags that will be used in case there's no
|
||||
# compilation database set (by default, one is not set).
|
||||
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
|
||||
flags = [
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Werror',
|
||||
'-Wc++98-compat',
|
||||
'-Wno-long-long',
|
||||
'-Wno-variadic-macros',
|
||||
'-fexceptions',
|
||||
'-DNDEBUG',
|
||||
'-DUSE_CLANG_COMPLETER',
|
||||
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
|
||||
# language to use when compiling headers. So it will guess. Badly. So C++
|
||||
# headers will be compiled as C headers. You don't want that so ALWAYS specify
|
||||
# a "-std=<something>".
|
||||
# For a C project, you would set this to something like 'c99' instead of
|
||||
# 'c++11'.
|
||||
'-std=c99',
|
||||
# ...and the same thing goes for the magic -x option which specifies the
|
||||
# language that the files to be compiled are written in. This is mostly
|
||||
# relevant for c++ headers.
|
||||
# For a C project, you would set this to 'c' instead of 'c++'.
|
||||
'-x',
|
||||
'c',
|
||||
'-isystem',
|
||||
'../BoostParts',
|
||||
'-isystem',
|
||||
# This path will only work on OS X, but extra paths that don't exist are not
|
||||
# harmful
|
||||
'/System/Library/Frameworks/Python.framework/Headers',
|
||||
'-isystem',
|
||||
'../llvm/include',
|
||||
'-isystem',
|
||||
'../llvm/tools/clang/include',
|
||||
'-I',
|
||||
'.',
|
||||
'-I',
|
||||
'./ClangCompleter',
|
||||
'-isystem',
|
||||
'./tests/gmock/gtest',
|
||||
'-isystem',
|
||||
'./tests/gmock/gtest/include',
|
||||
'-isystem',
|
||||
'./tests/gmock',
|
||||
'-isystem',
|
||||
'./tests/gmock/include'
|
||||
]
|
||||
|
||||
# Set this to the absolute path to the folder (NOT the file!) containing the
|
||||
# compile_commands.json file to use that instead of 'flags'. See here for
|
||||
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
|
||||
#
|
||||
# Most projects will NOT need to set this to anything; you can just change the
|
||||
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
|
||||
compilation_database_folder = ''
|
||||
|
||||
if compilation_database_folder:
|
||||
database = ycm_core.CompilationDatabase( compilation_database_folder )
|
||||
else:
|
||||
database = None
|
||||
|
||||
|
||||
def DirectoryOfThisScript():
|
||||
return os.path.dirname( os.path.abspath( __file__ ) )
|
||||
|
||||
|
||||
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
|
||||
if not working_directory:
|
||||
return list( flags )
|
||||
new_flags = []
|
||||
make_next_absolute = False
|
||||
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
|
||||
for flag in flags:
|
||||
new_flag = flag
|
||||
|
||||
if make_next_absolute:
|
||||
make_next_absolute = False
|
||||
if not flag.startswith( '/' ):
|
||||
new_flag = os.path.join( working_directory, flag )
|
||||
|
||||
for path_flag in path_flags:
|
||||
if flag == path_flag:
|
||||
make_next_absolute = True
|
||||
break
|
||||
|
||||
if flag.startswith( path_flag ):
|
||||
path = flag[ len( path_flag ): ]
|
||||
new_flag = path_flag + os.path.join( working_directory, path )
|
||||
break
|
||||
|
||||
if new_flag:
|
||||
new_flags.append( new_flag )
|
||||
return new_flags
|
||||
|
||||
|
||||
def FlagsForFile( filename ):
|
||||
if database:
|
||||
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
|
||||
# python list, but a "list-like" StringVec object
|
||||
compilation_info = database.GetCompilationInfoForFile( filename )
|
||||
final_flags = MakeRelativePathsInFlagsAbsolute(
|
||||
compilation_info.compiler_flags_,
|
||||
compilation_info.compiler_working_dir_ )
|
||||
|
||||
# NOTE: This is just for YouCompleteMe; it's highly likely that your project
|
||||
# does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
|
||||
# ycm_extra_conf IF YOU'RE NOT 100% YOU NEED IT.
|
||||
try:
|
||||
final_flags.remove( '-stdlib=libc++' )
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
relative_to = DirectoryOfThisScript()
|
||||
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
|
||||
|
||||
return {
|
||||
'flags': final_flags,
|
||||
'do_cache': True
|
||||
}
|
||||
25
after/ftplugin/c.vim
Normal file
25
after/ftplugin/c.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
let g:ale_linters = {'c':['clang', 'clangtidy', 'cppcheck']}
|
||||
" let g:ale_linters = {'c':['clang']}
|
||||
"let g:ale_fixers = {
|
||||
" \ 'c': ['clang-format'],
|
||||
" \}
|
||||
let g:ale_c_clangformat_options = '-style=file'
|
||||
|
||||
let g:ycm_goto_buffer_command = 'same-buffer'
|
||||
|
||||
nnoremap <F3> :call LanguageClient_contextMenu()<CR>
|
||||
nnoremap <silent> <F4> :call LanguageClient#textDocument_definition()<CR>
|
||||
nnoremap <silent> <F7> :call LanguageClient#textDocument_hover()<CR>
|
||||
nnoremap <silent> <F6> :call LanguageClient#textDocument_rename()<CR>
|
||||
|
||||
let g:LanguageClient_autoStart = 1
|
||||
|
||||
let g:LanguageClient_serverCommands = {
|
||||
\ 'c': ['cquery', '--language-server', '--log-file=/tmp/cq.log'],
|
||||
\ }
|
||||
|
||||
let g:LanguageClient_rootMarkers = {
|
||||
\ 'c': ['.cquery', 'compile_commands.json', 'build'],
|
||||
\ }
|
||||
|
||||
let g:LanguageClient_settingsPath = $HOME.'/.vim/cquery.json'
|
||||
1
after/ftplugin/cabal.vim
Normal file
1
after/ftplugin/cabal.vim
Normal file
@@ -0,0 +1 @@
|
||||
setlocal expandtab
|
||||
10
after/ftplugin/clojure.vim
Normal file
10
after/ftplugin/clojure.vim
Normal file
@@ -0,0 +1,10 @@
|
||||
call CmdAlias('Piggie','Piggieback (figwheel-sidecar.repl-api/repl-env)')
|
||||
|
||||
let g:rainbow_active = 1
|
||||
|
||||
|
||||
let g:ScreenImpl = 'Tmux'
|
||||
let g:sexp_enable_insert_mode_mappings = 0
|
||||
|
||||
" cljfmt
|
||||
let g:clj_fmt_autosave = 0
|
||||
67
after/ftplugin/go.vim
Normal file
67
after/ftplugin/go.vim
Normal file
@@ -0,0 +1,67 @@
|
||||
let g:tagbar_type_go = {
|
||||
\ 'ctagstype' : 'go',
|
||||
\ 'kinds' : [
|
||||
\ 'p:package',
|
||||
\ 'i:imports:1',
|
||||
\ 'c:constants',
|
||||
\ 'v:variables',
|
||||
\ 't:types',
|
||||
\ 'n:interfaces',
|
||||
\ 'w:fields',
|
||||
\ 'e:embedded',
|
||||
\ 'm:methods',
|
||||
\ 'r:constructor',
|
||||
\ 'f:functions'
|
||||
\ ],
|
||||
\ 'sro' : '.',
|
||||
\ 'kind2scope' : {
|
||||
\ 't' : 'ctype',
|
||||
\ 'n' : 'ntype'
|
||||
\ },
|
||||
\ 'scope2kind' : {
|
||||
\ 'ctype' : 't',
|
||||
\ 'ntype' : 'n'
|
||||
\ },
|
||||
\ 'ctagsbin' : 'gotags',
|
||||
\ 'ctagsargs' : '-sort -silent'
|
||||
\ }
|
||||
|
||||
|
||||
let g:go_auto_type_info = 0
|
||||
|
||||
|
||||
" mappings
|
||||
noremap <C-B> :TagbarToggle<CR>
|
||||
inoremap <C-B> <C-O>:TagbarToggle<CR>
|
||||
nmap <F3> :GoInfo<CR>
|
||||
|
||||
|
||||
function! MakePublic()
|
||||
let l:wordUnderCursor = expand('<cword>')
|
||||
let l:upperCaseWord = substitute(l:wordUnderCursor, '[A-Za-z]', '\\U&', '')
|
||||
execute 'GoRename ' l:upperCaseWord
|
||||
endfunction
|
||||
|
||||
|
||||
nmap <F6> :GoDocBrowser<CR><CR>
|
||||
nmap <F7> :GoDoc<CR>
|
||||
nmap <F8> :call MakePublic()<CR><CR>
|
||||
|
||||
|
||||
" ALE
|
||||
" let g:ale_linters = {'go':['gofmt', "go build"], 'c':['clang']}
|
||||
let g:ale_linters = {'go':['go build', 'gometalinter', 'gofmt'], 'c':['clang']}
|
||||
let g:ale_fixers = {
|
||||
\ 'go': ['gofmt', 'goimports'],
|
||||
\ 'c': ['clang-format'],
|
||||
\ 'cpp': ['clang-format'],
|
||||
\ 'js': ['eslint'],
|
||||
\ 'python': ['yapf'],
|
||||
\}
|
||||
let g:ale_go_gobuild_options = "-gcflags='-e'"
|
||||
let g:ale_go_gometalinter_options = '--fast'
|
||||
|
||||
" vim-go
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_space_tab_error = 1
|
||||
let g:go_highlight_chan_whitespace_error = 1
|
||||
48
after/ftplugin/haskell.vim
Normal file
48
after/ftplugin/haskell.vim
Normal file
@@ -0,0 +1,48 @@
|
||||
setlocal ts=2 sw=2 expandtab
|
||||
|
||||
" tags
|
||||
call CmdAlias('hasktags', '!hasktags -c .<CR>')
|
||||
|
||||
" from
|
||||
" https://raw.githubusercontent.com/begriffs/haskell-vim-now/master/git-hscope
|
||||
call CmdAlias('codex', 'call system("haskell-ctags")<CR><CR>call LoadHscope()<CR>')
|
||||
call CmdAlias('Cc', 'Clap commits<CR>')
|
||||
|
||||
|
||||
map <leader>ctg :codex<CR>
|
||||
set tags=tags;/,codex.tags;/
|
||||
|
||||
" nnoremap <silent> <leader>cgd :cs find g <C-R>=expand("<cword>")<CR><CR>
|
||||
nnoremap <silent> <C-\> :cs find c <C-R>=expand("<cword>")<CR><CR>
|
||||
|
||||
" set cscopeprg=do_at_stack_root\ hscope
|
||||
set csre
|
||||
set csto=1 " search codex tags first
|
||||
set nocst
|
||||
" set cscopequickfix=s-,c-,d-,i-,t-,e-,a-
|
||||
|
||||
function! LoadHscope()
|
||||
set nocscopeverbose " suppress 'duplicate connection' error
|
||||
let hsf = findfile("hscope.out", ".;")
|
||||
if filereadable(hsf)
|
||||
exe "cs add " . hsf
|
||||
elseif $HSCOPE_DB != ""
|
||||
cs add $HSCOPE_DB
|
||||
endif
|
||||
set cscopeverbose
|
||||
endfunction
|
||||
" au BufEnter /*.hs call LoadHscope()
|
||||
|
||||
|
||||
call deoplete#enable()
|
||||
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
|
||||
|
||||
|
||||
" vim-lsp
|
||||
if executable('haskell-language-server-wrapper')
|
||||
au User lsp_setup call lsp#register_server({
|
||||
\ 'name': 'hls',
|
||||
\ 'cmd': {server_info->['haskell-language-server-wrapper', '--lsp']},
|
||||
\ 'allowlist': ['haskell'],
|
||||
\ })
|
||||
endif
|
||||
16
after/ftplugin/python.vim
Normal file
16
after/ftplugin/python.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" let g:ale_linters = {'python':['mypy']}
|
||||
|
||||
" let g:ale_python_mypy_options = '--no-warn-incomplete-stub --ignore-missing-imports'
|
||||
|
||||
" let g:ale_python_pycodestyle_options = '--ignore=W391'
|
||||
|
||||
let g:neoformat_enabled_python = ['autopep8']
|
||||
|
||||
augroup fmt
|
||||
autocmd!
|
||||
autocmd BufWritePre * undojoin | Neoformat
|
||||
augroup END
|
||||
|
||||
let g:jedi#completions_enabled = 0
|
||||
|
||||
|
||||
53
after/ftplugin/rust.vim
Normal file
53
after/ftplugin/rust.vim
Normal file
@@ -0,0 +1,53 @@
|
||||
let g:rust_doc#define_map_K = 0
|
||||
let g:rust_doc#downloaded_rust_doc_dir = '~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu'
|
||||
|
||||
function! s:search_under_cursor(query) range
|
||||
if a:query ==# ''
|
||||
echomsg "rust-doc: No identifier is found under the cursor"
|
||||
return
|
||||
endif
|
||||
|
||||
call rust_doc#open_fuzzy(a:query)
|
||||
endfunction
|
||||
|
||||
" keys
|
||||
nnoremap <buffer><silent><F7> :<C-u>call <SID>search_under_cursor(expand('<cword>'))<CR>
|
||||
vnoremap <buffer><silent><F7> "gy:call <SID>search_under_cursor(getreg('g'))<CR>
|
||||
|
||||
" rusty-tags
|
||||
autocmd BufRead *.rs :setlocal tags=./rusty-tags.vi;/
|
||||
autocmd BufWritePost *.rs :silent! exec "!rusty-tags vi --quiet --start-dir=" . expand('%:p:h') . "&" | redraw!
|
||||
|
||||
let g:tagbar_ctags_bin = '/usr/bin/exuberant-ctags'
|
||||
|
||||
|
||||
" nnoremap <F3> :call LanguageClient_contextMenu()<CR>
|
||||
" nnoremap <silent> <F4> :call LanguageClient#textDocument_definition()<CR>
|
||||
" nnoremap <silent> <F6> :call LanguageClient#textDocument_hover()<CR>
|
||||
" nnoremap <silent> <F8> :call LanguageClient#textDocument_rename()<CR>
|
||||
|
||||
|
||||
" let g:LanguageClient_autoStart = 1
|
||||
|
||||
" let g:LanguageClient_serverCommands = {
|
||||
" \ 'rust': ['rustup', 'run', 'nightly', 'rls'] }
|
||||
|
||||
" let g:LanguageClient_diagnosticsEnable = 0
|
||||
|
||||
" let g:ale_linters = {'rust': ['rls']}
|
||||
" let g:ale_fixers = { 'rust': ['rustfmt'] }
|
||||
|
||||
" let g:ale_fix_on_save = 0
|
||||
" let g:autofmt_autosave = 0
|
||||
|
||||
" deoplete
|
||||
" call deoplete#custom#option('sources',{
|
||||
" \ '_': ['buffer'],
|
||||
" \ 'rust': ['ultisnips', 'buffer', 'file', 'LanguageClient']
|
||||
" \ })
|
||||
" inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
|
||||
" call deoplete#enable()
|
||||
|
||||
let g:LanguageClient_serverCommands = {
|
||||
\ 'rust': ['~/.cargo/bin/ra_lsp_server'],
|
||||
\ }
|
||||
8
after/ftplugin/sh.vim
Normal file
8
after/ftplugin/sh.vim
Normal file
@@ -0,0 +1,8 @@
|
||||
if (expand("%:e") == "exheres-0")
|
||||
finish
|
||||
endif
|
||||
|
||||
if (expand("%:e") == "exlib")
|
||||
finish
|
||||
endif
|
||||
|
||||
18
after/ftplugin/typescript.vim
Normal file
18
after/ftplugin/typescript.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
nnoremap <leader>gd <C-]>
|
||||
|
||||
|
||||
let g:tsuquyomi_disable_quickfix = 1
|
||||
|
||||
let g:ale_linters = {
|
||||
\ 'typescript': ['tsserver'],
|
||||
\}
|
||||
|
||||
call deoplete#custom#option('sources', {
|
||||
\ 'typescript': ['ale', 'buffer', 'file', 'around'],
|
||||
\})
|
||||
|
||||
|
||||
call deoplete#custom#source('ale', 'rank', 999)
|
||||
call deoplete#custom#source('ale', 'input_pattern', '[^. *\t]\.\w*')
|
||||
|
||||
" autocmd FileType typescript setlocal balloonexpr=tsuquyomi#balloonexpr()
|
||||
2
after/ftplugin/vim.vim
Normal file
2
after/ftplugin/vim.vim
Normal file
@@ -0,0 +1,2 @@
|
||||
let g:ale_linters = {'vim':['vint']}
|
||||
|
||||
54
after/plugin/plugin_settings.vim
Normal file
54
after/plugin/plugin_settings.vim
Normal file
@@ -0,0 +1,54 @@
|
||||
if has('nvim') && !exists("g:vscode")
|
||||
lua << EOF
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = false,
|
||||
})
|
||||
|
||||
vim.o.updatetime = 300
|
||||
|
||||
-- Show all diagnostics on current line in floating window
|
||||
--vim.api.nvim_set_keymap(
|
||||
-- 'n', '<Leader>d', ':lua vim.diagnostic.open_float()<CR>',
|
||||
-- { noremap = true, silent = true }
|
||||
--)
|
||||
-- Go to next diagnostic (if there are multiple on the same line, only shows
|
||||
-- one at a time in the floating window)
|
||||
--vim.api.nvim_set_keymap(
|
||||
-- 'n', '<Leader>n', ':lua vim.diagnostic.goto_next()<CR>',
|
||||
-- { noremap = true, silent = true }
|
||||
--)
|
||||
-- Go to prev diagnostic (if there are multiple on the same line, only shows
|
||||
-- one at a time in the floating window)
|
||||
--vim.api.nvim_set_keymap(
|
||||
-- 'n', '<Leader>p', ':lua vim.diagnostic.goto_prev()<CR>',
|
||||
-- { noremap = true, silent = true }
|
||||
--)
|
||||
|
||||
-- IMPORTANT!: this is only a showcase of how you can set default options!
|
||||
require("telescope").setup {
|
||||
extensions = {
|
||||
file_browser = {
|
||||
grouped = true,
|
||||
theme = "ivy",
|
||||
mappings = {
|
||||
["i"] = {
|
||||
-- your custom insert mode mappings
|
||||
},
|
||||
["n"] = {
|
||||
-- your custom normal mode mappings
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
-- To get telescope-file-browser loaded and working with telescope,
|
||||
-- you need to call load_extension, somewhere after setup function:
|
||||
require("telescope").load_extension "file_browser"
|
||||
|
||||
EOF
|
||||
endif
|
||||
|
||||
119
autoload/log-autocmds.vim
Normal file
119
autoload/log-autocmds.vim
Normal file
@@ -0,0 +1,119 @@
|
||||
command! LogAutocmds call s:log_autocmds_toggle()
|
||||
|
||||
function! s:log_autocmds_toggle()
|
||||
augroup LogAutocmd
|
||||
autocmd!
|
||||
augroup END
|
||||
|
||||
let l:date = strftime('%F', localtime())
|
||||
let s:activate = get(s:, 'activate', 0) ? 0 : 1
|
||||
if !s:activate
|
||||
call s:log('Stopped autocmd log (' . l:date . ')')
|
||||
return
|
||||
endif
|
||||
|
||||
call s:log('Started autocmd log (' . l:date . ')')
|
||||
augroup LogAutocmd
|
||||
for l:au in s:aulist
|
||||
silent execute 'autocmd' l:au '* call s:log(''' . l:au . ''')'
|
||||
endfor
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:log(message)
|
||||
silent execute '!echo "'
|
||||
\ . strftime('%T', localtime()) . ' - ' . a:message . '"'
|
||||
\ '>> /tmp/vim_log_autocommands'
|
||||
endfunction
|
||||
|
||||
" These are deliberately left out due to side effects
|
||||
" - SourceCmd
|
||||
" - FileAppendCmd
|
||||
" - FileWriteCmd
|
||||
" - BufWriteCmd
|
||||
" - FileReadCmd
|
||||
" - BufReadCmd
|
||||
" - FuncUndefined
|
||||
|
||||
let s:aulist = [
|
||||
\ 'BufNewFile',
|
||||
\ 'BufReadPre',
|
||||
\ 'BufRead',
|
||||
\ 'BufReadPost',
|
||||
\ 'FileReadPre',
|
||||
\ 'FileReadPost',
|
||||
\ 'FilterReadPre',
|
||||
\ 'FilterReadPost',
|
||||
\ 'StdinReadPre',
|
||||
\ 'StdinReadPost',
|
||||
\ 'BufWrite',
|
||||
\ 'BufWritePre',
|
||||
\ 'BufWritePost',
|
||||
\ 'FileWritePre',
|
||||
\ 'FileWritePost',
|
||||
\ 'FileAppendPre',
|
||||
\ 'FileAppendPost',
|
||||
\ 'FilterWritePre',
|
||||
\ 'FilterWritePost',
|
||||
\ 'BufAdd',
|
||||
\ 'BufCreate',
|
||||
\ 'BufDelete',
|
||||
\ 'BufWipeout',
|
||||
\ 'BufFilePre',
|
||||
\ 'BufFilePost',
|
||||
\ 'BufEnter',
|
||||
\ 'BufLeave',
|
||||
\ 'BufWinEnter',
|
||||
\ 'BufWinLeave',
|
||||
\ 'BufUnload',
|
||||
\ 'BufHidden',
|
||||
\ 'BufNew',
|
||||
\ 'SwapExists',
|
||||
\ 'FileType',
|
||||
\ 'Syntax',
|
||||
\ 'EncodingChanged',
|
||||
\ 'TermChanged',
|
||||
\ 'VimEnter',
|
||||
\ 'GUIEnter',
|
||||
\ 'GUIFailed',
|
||||
\ 'TermResponse',
|
||||
\ 'QuitPre',
|
||||
\ 'VimLeavePre',
|
||||
\ 'VimLeave',
|
||||
\ 'FileChangedShell',
|
||||
\ 'FileChangedShellPost',
|
||||
\ 'FileChangedRO',
|
||||
\ 'ShellCmdPost',
|
||||
\ 'ShellFilterPost',
|
||||
\ 'CmdUndefined',
|
||||
\ 'SpellFileMissing',
|
||||
\ 'SourcePre',
|
||||
\ 'VimResized',
|
||||
\ 'FocusGained',
|
||||
\ 'FocusLost',
|
||||
\ 'CursorHold',
|
||||
\ 'CursorHoldI',
|
||||
\ 'CursorMoved',
|
||||
\ 'CursorMovedI',
|
||||
\ 'WinEnter',
|
||||
\ 'WinLeave',
|
||||
\ 'TabEnter',
|
||||
\ 'TabLeave',
|
||||
\ 'CmdwinEnter',
|
||||
\ 'CmdwinLeave',
|
||||
\ 'InsertEnter',
|
||||
\ 'InsertChange',
|
||||
\ 'InsertLeave',
|
||||
\ 'InsertCharPre',
|
||||
\ 'TextChanged',
|
||||
\ 'TextChangedI',
|
||||
\ 'ColorScheme',
|
||||
\ 'RemoteReply',
|
||||
\ 'QuickFixCmdPre',
|
||||
\ 'QuickFixCmdPost',
|
||||
\ 'SessionLoadPost',
|
||||
\ 'MenuPopup',
|
||||
\ 'CompleteDone',
|
||||
\ 'User',
|
||||
\ ]
|
||||
|
||||
2504
autoload/plug.vim
2504
autoload/plug.vim
File diff suppressed because it is too large
Load Diff
551
autoload/submode.vim
Normal file
551
autoload/submode.vim
Normal file
@@ -0,0 +1,551 @@
|
||||
" submode - Create your own submodes
|
||||
" Version: 0.3.1
|
||||
" Copyright (C) 2008-2014 kana <http://whileimautomaton.net/>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
" Concept "{{{1
|
||||
"
|
||||
" In the following pseudo code, :MAP means :map or :noremap, and it depends on
|
||||
" user's specification.
|
||||
"
|
||||
" map {key-to-enter}
|
||||
" \ <Plug>(submode-before-entering:{submode}:with:{key-to-enter})
|
||||
" \<Plug>(submode-before-entering:{submode})
|
||||
" \<Plug>(submode-enter:{submode})
|
||||
"
|
||||
" MAP <Plug>(submode-before-entering:{submode}:with:{key-to-enter})
|
||||
" \ {anything}
|
||||
" noremap <Plug>(submode-before-entering:{submode})
|
||||
" \ {tweaking 'timeout' and others}
|
||||
" map <Plug>(submode-enter:{submode})
|
||||
" \ <Plug>(submode-before-action:{submode})
|
||||
" \<Plug>(submode-prefix:{submode})
|
||||
"
|
||||
" map <Plug>(submode-prefix:{submode})
|
||||
" \ <Plug>(submode-leave:{submode})
|
||||
" map <Plug>(submode-prefix:{submode}){the first N keys in {lhs}}
|
||||
" \ <Plug>(submode-leave:{submode})
|
||||
" map <Plug>(submode-prefix:{submode}){lhs}
|
||||
" \ <Plug>(submode-rhs:{submode}:for:{lhs})
|
||||
" \<Plug>(submode-enter:{submode})
|
||||
" MAP <Plug>(submode-rhs:{submode}:for:{lhs})
|
||||
" \ {rhs}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
" Variables "{{{1
|
||||
|
||||
if !exists('g:submode_always_show_submode')
|
||||
let g:submode_always_show_submode = 0
|
||||
endif
|
||||
|
||||
if !exists('g:submode_keep_leaving_key')
|
||||
let g:submode_keep_leaving_key = 0
|
||||
endif
|
||||
|
||||
if !exists('g:submode_keyseqs_to_leave')
|
||||
let g:submode_keyseqs_to_leave = ['<Esc>']
|
||||
endif
|
||||
|
||||
if !exists('g:submode_timeout')
|
||||
let g:submode_timeout = &timeout
|
||||
endif
|
||||
|
||||
if !exists('g:submode_timeoutlen')
|
||||
let g:submode_timeoutlen = &timeoutlen
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
"" See s:set_up_options() and s:restore_options().
|
||||
"
|
||||
" let s:original_showcmd = &showcmd
|
||||
" let s:original_showmode = &showmode
|
||||
" let s:original_timeout = &timeout
|
||||
" let s:original_timeoutlen = &timeoutlen
|
||||
" let s:original_ttimeout = &ttimeout
|
||||
" let s:original_ttimeoutlen = &ttimeoutlen
|
||||
|
||||
if !exists('s:options_overridden_p')
|
||||
let s:options_overridden_p = 0
|
||||
endif
|
||||
|
||||
" A padding string to wipe out internal key mappings in 'showcmd' area. (gh-3)
|
||||
"
|
||||
" We use no-break spaces (U+00A0) or dots, depending of the current 'encoding'.
|
||||
" Because
|
||||
"
|
||||
" * A normal space (U+0020) is rendered as "<20>" since Vim 7.4.116.
|
||||
" * U+00A0 is rendered as an invisible glyph if 'encoding' is set to one of
|
||||
" Unicode encodings. Otherwise "| " is rendered instead.
|
||||
let s:STEALTH_TYPEAHEAD =
|
||||
\ &g:encoding =~# '^u'
|
||||
\ ? repeat("\<Char-0xa0>", 5)
|
||||
\ : repeat('.', 10)
|
||||
|
||||
let s:current_submode = ''
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
" Interface "{{{1
|
||||
" :SubmodeRestoreOptions "{{{2
|
||||
|
||||
command! -bar -nargs=0 SubmodeRestoreOptions call submode#restore_options()
|
||||
|
||||
|
||||
|
||||
|
||||
function! submode#current() "{{{2
|
||||
return s:current_submode
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! submode#enter_with(submode, modes, options, lhs, ...) "{{{2
|
||||
let rhs = 0 < a:0 ? a:1 : '<Nop>'
|
||||
for mode in s:each_char(a:modes)
|
||||
call s:define_entering_mapping(a:submode, mode, a:options, a:lhs, rhs)
|
||||
endfor
|
||||
return
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! submode#leave_with(submode, modes, options, lhs) "{{{2
|
||||
let options = substitute(a:modes, 'e', '', 'g') " <Nop> is not expression.
|
||||
return submode#map(a:submode, a:modes, options . 'x', a:lhs, '<Nop>')
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! submode#map(submode, modes, options, lhs, rhs) "{{{2
|
||||
for mode in s:each_char(a:modes)
|
||||
call s:define_submode_mapping(a:submode, mode, a:options, a:lhs, a:rhs)
|
||||
endfor
|
||||
return
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! submode#restore_options() "{{{2
|
||||
call s:restore_options()
|
||||
return
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! submode#unmap(submode, modes, options, lhs) "{{{2
|
||||
for mode in s:each_char(a:modes)
|
||||
call s:undefine_submode_mapping(a:submode, mode, a:options, a:lhs)
|
||||
endfor
|
||||
return
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
" Core "{{{1
|
||||
function! s:define_entering_mapping(submode, mode, options, lhs, rhs) "{{{2
|
||||
execute s:map_command(a:mode, 'r')
|
||||
\ s:map_options(s:filter_flags(a:options, 'bu'))
|
||||
\ (a:lhs)
|
||||
\ (s:named_key_before_entering_with(a:submode, a:lhs)
|
||||
\ . s:named_key_before_entering(a:submode)
|
||||
\ . s:named_key_enter(a:submode))
|
||||
|
||||
if !s:mapping_exists_p(s:named_key_enter(a:submode), a:mode)
|
||||
" When the given submode is not defined yet - define the default key
|
||||
" mappings to leave the submode.
|
||||
for keyseq in g:submode_keyseqs_to_leave
|
||||
call submode#leave_with(a:submode, a:mode, a:options, keyseq)
|
||||
endfor
|
||||
endif
|
||||
|
||||
execute s:map_command(a:mode, s:filter_flags(a:options, 'r'))
|
||||
\ s:map_options(s:filter_flags(a:options, 'besu'))
|
||||
\ s:named_key_before_entering_with(a:submode, a:lhs)
|
||||
\ a:rhs
|
||||
execute s:map_command(a:mode, '')
|
||||
\ s:map_options('e')
|
||||
\ s:named_key_before_entering(a:submode)
|
||||
\ printf('<SID>on_entering_submode(%s)', string(a:submode))
|
||||
execute s:map_command(a:mode, 'r')
|
||||
\ s:map_options('')
|
||||
\ s:named_key_enter(a:submode)
|
||||
\ (s:named_key_before_action(a:submode)
|
||||
\ . s:named_key_prefix(a:submode))
|
||||
|
||||
execute s:map_command(a:mode, '')
|
||||
\ s:map_options('e')
|
||||
\ s:named_key_before_action(a:submode)
|
||||
\ printf('<SID>on_executing_action(%s)', string(a:submode))
|
||||
execute s:map_command(a:mode, 'r')
|
||||
\ s:map_options('')
|
||||
\ s:named_key_prefix(a:submode)
|
||||
\ s:named_key_leave(a:submode)
|
||||
" NB: :map-<expr> cannot be used for s:on_leaving_submode(),
|
||||
" because it uses some commands not allowed in :map-<expr>.
|
||||
execute s:map_command(a:mode, '')
|
||||
\ s:map_options('s')
|
||||
\ s:named_key_leave(a:submode)
|
||||
\ printf('%s<SID>on_leaving_submode(%s)<Return>',
|
||||
\ a:mode =~# '[ic]' ? '<C-r>=' : '@=',
|
||||
\ string(a:submode))
|
||||
|
||||
return
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:define_submode_mapping(submode, mode, options, lhs, rhs) "{{{2
|
||||
execute s:map_command(a:mode, 'r')
|
||||
\ s:map_options(s:filter_flags(a:options, 'bu'))
|
||||
\ (s:named_key_prefix(a:submode) . a:lhs)
|
||||
\ (s:named_key_rhs(a:submode, a:lhs)
|
||||
\ . (s:has_flag_p(a:options, 'x')
|
||||
\ ? s:named_key_leave(a:submode)
|
||||
\ : s:named_key_enter(a:submode)))
|
||||
execute s:map_command(a:mode, s:filter_flags(a:options, 'r'))
|
||||
\ s:map_options(s:filter_flags(a:options, 'besu'))
|
||||
\ s:named_key_rhs(a:submode, a:lhs)
|
||||
\ a:rhs
|
||||
|
||||
let keys = s:split_keys(a:lhs)
|
||||
for n in range(1, len(keys) - 1)
|
||||
let first_n_keys = join(keys[:-(n+1)], '')
|
||||
silent! execute s:map_command(a:mode, 'r')
|
||||
\ s:map_options(s:filter_flags(a:options, 'bu'))
|
||||
\ (s:named_key_prefix(a:submode) . first_n_keys)
|
||||
\ s:named_key_leave(a:submode)
|
||||
endfor
|
||||
|
||||
return
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:undefine_submode_mapping(submode, mode, options, lhs) "{{{2
|
||||
execute s:map_command(a:mode, 'u')
|
||||
\ s:map_options(s:filter_flags(a:options, 'b'))
|
||||
\ s:named_key_rhs(a:submode, a:lhs)
|
||||
|
||||
let keys = s:split_keys(a:lhs)
|
||||
for n in range(len(keys), 1, -1)
|
||||
let first_n_keys = join(keys[:n-1], '')
|
||||
execute s:map_command(a:mode, 'u')
|
||||
\ s:map_options(s:filter_flags(a:options, 'b'))
|
||||
\ s:named_key_prefix(a:submode) . first_n_keys
|
||||
if s:longer_mapping_exists_p(s:named_key_prefix(a:submode), first_n_keys)
|
||||
execute s:map_command(a:mode, 'r')
|
||||
\ s:map_options(s:filter_flags(a:options, 'b'))
|
||||
\ s:named_key_prefix(a:submode) . first_n_keys
|
||||
\ s:named_key_leave(a:submode)
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
return
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
" Misc. "{{{1
|
||||
function! s:each_char(s) "{{{2
|
||||
return split(a:s, '.\zs')
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:filter_flags(s, cs) "{{{2
|
||||
return join(map(s:each_char(a:cs), 's:has_flag_p(a:s, v:val) ? v:val : ""'),
|
||||
\ '')
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:has_flag_p(s, c) "{{{2
|
||||
return 0 <= stridx(a:s, a:c)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:insert_mode_p(mode) "{{{2
|
||||
return a:mode =~# '^[iR]'
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:longer_mapping_exists_p(submode, lhs) "{{{2
|
||||
" FIXME: Implement the proper calculation.
|
||||
" Note that mapcheck() can't be used for this purpose because it may
|
||||
" act as s:shorter_mapping_exists_p() if there is such a mapping.
|
||||
return !0
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:map_command(mode, flags) "{{{2
|
||||
if s:has_flag_p(a:flags, 'u')
|
||||
return a:mode . 'unmap'
|
||||
else
|
||||
return a:mode . (s:has_flag_p(a:flags, 'r') ? 'map' : 'noremap')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:map_options(options) "{{{2
|
||||
let _ = {
|
||||
\ 'b': '<buffer>',
|
||||
\ 'e': '<expr>',
|
||||
\ 's': '<silent>',
|
||||
\ 'u': '<unique>',
|
||||
\ }
|
||||
return join(map(s:each_char(a:options), 'get(_, v:val, "")'))
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:mapping_exists_p(keyseq, mode) "{{{2
|
||||
return maparg(a:keyseq, a:mode) != ''
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:may_override_showmode_p(mode) "{{{2
|
||||
" Normal mode / Visual mode (& its variants) / Insert mode (& its variants)
|
||||
return a:mode =~# "^[nvV\<C-v>sS\<C-s>]" || s:insert_mode_p(a:mode)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:named_key_before_action(submode) "{{{2
|
||||
return printf('<Plug>(submode-before-action:%s)', a:submode)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:named_key_before_entering(submode) "{{{2
|
||||
return printf('<Plug>(submode-before-entering:%s)', a:submode)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:named_key_before_entering_with(submode, lhs) "{{{2
|
||||
return printf('<Plug>(submode-before-entering:%s:with:%s)', a:submode, a:lhs)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:named_key_enter(submode) "{{{2
|
||||
return printf('<Plug>(submode-enter:%s)', a:submode)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:named_key_leave(submode) "{{{2
|
||||
return printf('<Plug>(submode-leave:%s)', a:submode)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:named_key_prefix(submode) "{{{2
|
||||
return printf('<Plug>(submode-prefix:%s)%s', a:submode, s:STEALTH_TYPEAHEAD)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:named_key_rhs(submode, lhs) "{{{2
|
||||
return printf('<Plug>(submode-rhs:%s:for:%s)', a:submode, a:lhs)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:on_entering_submode(submode) "{{{2
|
||||
call s:set_up_options(a:submode)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:on_executing_action(submode) "{{{2
|
||||
if (s:original_showmode || g:submode_always_show_submode)
|
||||
\ && s:may_override_showmode_p(mode())
|
||||
echohl ModeMsg
|
||||
echo '-- Submode:' a:submode '--'
|
||||
echohl None
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:on_leaving_submode(submode) "{{{2
|
||||
if (s:original_showmode || g:submode_always_show_submode)
|
||||
\ && s:may_override_showmode_p(mode())
|
||||
if s:insert_mode_p(mode())
|
||||
let cursor_position = getpos('.')
|
||||
endif
|
||||
|
||||
" BUGS: :redraw! doesn't redraw 'showmode'.
|
||||
execute "normal! \<C-l>"
|
||||
|
||||
if s:insert_mode_p(mode())
|
||||
call setpos('.', cursor_position)
|
||||
endif
|
||||
endif
|
||||
if !g:submode_keep_leaving_key && getchar(1) isnot 0
|
||||
" To completely ignore unbound key sequences in a submode,
|
||||
" here we have to fetch and drop the last key in the key sequence.
|
||||
call getchar()
|
||||
endif
|
||||
call s:restore_options()
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:remove_flag(s, c) "{{{2
|
||||
" Assumption: a:c is not a meta character.
|
||||
return substitute(a:s, a:c, '', 'g')
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:restore_options() "{{{2
|
||||
if !s:options_overridden_p
|
||||
return
|
||||
endif
|
||||
let s:options_overridden_p = 0
|
||||
|
||||
let &showcmd = s:original_showcmd
|
||||
let &showmode = s:original_showmode
|
||||
let &timeout = s:original_timeout
|
||||
let &timeoutlen = s:original_timeoutlen
|
||||
let &ttimeout = s:original_ttimeout
|
||||
let &ttimeoutlen = s:original_ttimeoutlen
|
||||
|
||||
let s:current_submode = ''
|
||||
|
||||
return
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:set_up_options(submode) "{{{2
|
||||
if s:options_overridden_p
|
||||
return
|
||||
endif
|
||||
let s:options_overridden_p = !0
|
||||
|
||||
let s:original_showcmd = &showcmd
|
||||
let s:original_showmode = &showmode
|
||||
let s:original_timeout = &timeout
|
||||
let s:original_timeoutlen = &timeoutlen
|
||||
let s:original_ttimeout = &ttimeout
|
||||
let s:original_ttimeoutlen = &ttimeoutlen
|
||||
|
||||
" NB: 'showcmd' must be enabled to render the cursor properly.
|
||||
" If 'showcmd' is disabled and the current submode message is rendered, the
|
||||
" cursor is rendered at the end of the message, not the actual position in
|
||||
" the current window. (gh-9)
|
||||
set showcmd
|
||||
set noshowmode
|
||||
let &timeout = g:submode_timeout
|
||||
let &ttimeout = s:original_timeout ? !0 : s:original_ttimeout
|
||||
let &timeoutlen = g:submode_timeoutlen
|
||||
let &ttimeoutlen = s:original_ttimeoutlen < 0
|
||||
\ ? s:original_timeoutlen
|
||||
\ : s:original_ttimeoutlen
|
||||
|
||||
let s:current_submode = a:submode
|
||||
|
||||
return
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:split_keys(keyseq) "{{{2
|
||||
" Assumption: Special keys such as <C-u> are escaped with < and >, i.e.,
|
||||
" a:keyseq doesn't directly contain any escape sequences.
|
||||
return split(a:keyseq, '\(<[^<>]\+>\|.\)\zs')
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
" __END__ "{{{1
|
||||
" vim: foldmethod=marker
|
||||
|
||||
|
||||
5
cquery.json
Normal file
5
cquery.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"initializationOptions": {
|
||||
"cacheDirectory": "/tmp/cquery"
|
||||
}
|
||||
}
|
||||
4
custom-snippets/haskell.snippets
Normal file
4
custom-snippets/haskell.snippets
Normal file
@@ -0,0 +1,4 @@
|
||||
snippet docsec
|
||||
------------------------
|
||||
--[ ${0:DOCUMENT SECTION} ]--
|
||||
------------------------
|
||||
2
custom-snippets/markdown.snippets
Normal file
2
custom-snippets/markdown.snippets
Normal file
@@ -0,0 +1,2 @@
|
||||
snippet tc
|
||||
\textcolor{${1:red}}{${0}}
|
||||
14
plugin/ale.vim
Normal file
14
plugin/ale.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
let g:ale_open_list = 0
|
||||
let g:ale_set_quickfix = 0
|
||||
let g:ale_set_loclist = 1
|
||||
let g:ale_fix_on_save = 1
|
||||
let g:ale_lint_delay = 100
|
||||
highlight clear ALEWarningSign
|
||||
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
||||
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
||||
let g:ale_sign_column_always = 1
|
||||
let g:ale_quiet_messages = { 'sub_type': 'style' }
|
||||
"Lint only on save
|
||||
let g:ale_lint_on_text_changed = 'never'
|
||||
let g:ale_lint_on_enter = 1
|
||||
|
||||
2
plugin/filetype.vim
Normal file
2
plugin/filetype.vim
Normal file
@@ -0,0 +1,2 @@
|
||||
au BufNewFile,BufRead *.log setf log
|
||||
|
||||
452
plugin/keys.vim
Normal file
452
plugin/keys.vim
Normal file
@@ -0,0 +1,452 @@
|
||||
nnoremap <SPACE> <Nop>
|
||||
let g:mapleader = ' '
|
||||
|
||||
inoremap <C-u> <Esc>
|
||||
|
||||
nnoremap <C-,> :tabprevious<CR>
|
||||
nnoremap <C-.> :tabnext<CR>
|
||||
|
||||
noremap <C-PageUp> gT
|
||||
noremap <C-PageDown> gt
|
||||
|
||||
"
|
||||
nnoremap <Leader>tk <C-w><C-]><C-w>T
|
||||
|
||||
" Quickly insert an empty new line without entering insert mode
|
||||
nnoremap <Leader>o o<Esc>
|
||||
nnoremap <Leader>O O<Esc>
|
||||
|
||||
" nnoremap <kPageUp> <PageUp>
|
||||
" nnoremap <kPageDown> <PageDown>
|
||||
" inoremap <kPageUp> <PageUp>
|
||||
" inoremap <kPageDown> <PageDown>
|
||||
|
||||
" workman
|
||||
noremap <C-K> <C-O>
|
||||
noremap <Tab> <C-I>
|
||||
|
||||
noremap e j
|
||||
noremap o k
|
||||
noremap n h
|
||||
noremap i l
|
||||
vnoremap i l
|
||||
noremap k n
|
||||
noremap h e
|
||||
noremap l o
|
||||
noremap f u
|
||||
noremap u i
|
||||
|
||||
noremap E J
|
||||
noremap O K
|
||||
noremap N H
|
||||
noremap I L
|
||||
noremap K N
|
||||
noremap H E
|
||||
noremap L O
|
||||
noremap F U
|
||||
noremap U I
|
||||
|
||||
noremap ge gj
|
||||
noremap go gk
|
||||
noremap gn gh
|
||||
noremap gl go
|
||||
noremap gk gn
|
||||
noremap gh ge
|
||||
|
||||
noremap gE gJ
|
||||
noremap gN gH
|
||||
noremap gK gN
|
||||
noremap gH gE
|
||||
noremap gL gO
|
||||
|
||||
nnoremap <silent> <c-w>e :wincmd j<cr>
|
||||
nnoremap <silent> <c-w>o :wincmd k<cr>
|
||||
nnoremap <silent> <c-w>n :wincmd h<cr>
|
||||
nnoremap <silent> <c-w>i :wincmd l<cr>
|
||||
nnoremap <silent> <c-w>k :wincmd n<cr>
|
||||
nnoremap <silent> <c-w>l :wincmd o<cr>
|
||||
|
||||
vnoremap <c-n> B
|
||||
vnoremap <c-i> W
|
||||
nnoremap <c-n> B
|
||||
nnoremap <c-i> W
|
||||
|
||||
vnoremap <A-n> b
|
||||
vnoremap <A-i> w
|
||||
nnoremap <A-n> b
|
||||
nnoremap <A-i> w
|
||||
" nnoremap <c-n>i e
|
||||
|
||||
" get control-j back, so switch it with ctrl-n at qwerty position of j
|
||||
" imap <c-n> <cr>
|
||||
" cmap <c-n> <cr>
|
||||
inoremap <c-j> <c-n>
|
||||
cnoremap <c-j> <c-n>
|
||||
|
||||
" jump word in visual mode -- TODO
|
||||
|
||||
" In insert or command mode, move normally by using Ctrl
|
||||
inoremap <C-n> <Left>
|
||||
inoremap <C-e> <Down>
|
||||
inoremap <C-o> <Up>
|
||||
inoremap <C-i> <Right>
|
||||
cnoremap <C-n> <Left>
|
||||
cnoremap <C-e> <Down>
|
||||
cnoremap <C-o> <Up>
|
||||
cnoremap <C-i> <Right>
|
||||
|
||||
inoremap <C-A-n> <C-Left>
|
||||
inoremap <C-A-i> <C-Right>
|
||||
|
||||
inoremap <C-A-e> <Esc>:+3<CR>i
|
||||
inoremap <C-A-o> <Esc>:-3<CR>i
|
||||
|
||||
" easy config
|
||||
nmap <S-F9> :e $HOME/.vimrc<CR>
|
||||
nmap <S-F10> :so $HOME/.vimrc<CR>
|
||||
|
||||
" Force saving files that require root permission
|
||||
command! SUDOwrite :execute 'w !sudo tee > /dev/null %' | edit!
|
||||
|
||||
" TODO: C-S-o etc does not work
|
||||
" Bubble single lines
|
||||
nmap <silent> <C-S-Up> :m-2<CR>==
|
||||
nmap <silent> <C-S-o> :m-2<CR>==
|
||||
nmap <silent> <C-S-Down> :m+<CR>==
|
||||
nmap <silent> <C-S-e> :m+<CR>==
|
||||
imap <silent> <C-S-Up> <Esc>:m-2<CR>==gi
|
||||
imap <silent> <C-S-o> <Esc>:m-2<CR>==gi
|
||||
imap <silent> <C-S-Down> <Esc>:m+<CR>==gi
|
||||
imap <silent> <C-S-e> <Esc>:m+<CR>==gi
|
||||
|
||||
" Bubble multiple lines
|
||||
vmap <silent> <C-S-Up> :m-2<CR>gv=gv
|
||||
vmap <silent> <C-S-o> :m-2<CR>gv=gv
|
||||
vmap <silent> <C-S-Down> :m'>+<CR>gv=gv
|
||||
vmap <silent> <C-S-e> :m'>+<CR>gv=gv
|
||||
|
||||
" Indent lines using <Left> and <Right>
|
||||
vmap <C-S-Right> >gv
|
||||
nmap <C-S-Right> >>
|
||||
imap <C-S-Right> <Esc>>>i
|
||||
vmap <C-S-Left> <gv
|
||||
nmap <C-S-Left> <<
|
||||
imap <C-S-Left> <Esc><<i
|
||||
|
||||
" moving through location list items
|
||||
" noremap <S-Up> :lprevious<CR>
|
||||
" noremap <S-Down> :lnext<CR>
|
||||
|
||||
" moving through buffers
|
||||
" noremap <S-Left> :bn<CR>
|
||||
" noremap <S-Right> :bp<CR>
|
||||
noremap <leader>bd <Esc>:bd<CR>
|
||||
noremap <leader>wc <Esc>:bd<CR>
|
||||
noremap <leader>bo <Esc>:Bufonly<CR>
|
||||
|
||||
" close preview
|
||||
nmap <leader>pc <Esc>:pc<CR>
|
||||
|
||||
" Remap window commands
|
||||
" map <leader>ws <Esc>:wincmd s<CR>
|
||||
" map <leader>wv <Esc>:wincmd v<CR>
|
||||
" map <leader>wc <Esc>:wincmd c<CR>
|
||||
" map <leader>wn <Esc>:wincmd n<CR>
|
||||
" map <leader>wo <Esc>:wincmd o<CR>
|
||||
" map <leader>w+ <Esc>:wincmd _<CR>
|
||||
" map <leader>w- <Esc>:wincmd <Bar><CR>
|
||||
" map <leader>w= <Esc>:wincmd =<CR>
|
||||
" nmap + :vertical resize +20<CR>
|
||||
" nmap - :vertical resize -20<CR>
|
||||
" map <C-S--> <Esc>:wincmd ><CR>
|
||||
" map <C-Down> <Esc>:wincmd j<CR>
|
||||
" map <C-j> <Esc>:wincmd j<CR>
|
||||
" map <C-Up> <Esc>:wincmd k<CR>
|
||||
" map <C-k> <Esc>:wincmd k<CR>
|
||||
" map <C-Left> <Esc>:wincmd h<CR>
|
||||
" map <C-h> <Esc>:wincmd h<CR>
|
||||
" map <C-Right> <Esc>:wincmd l<CR>
|
||||
" map <C-l> <Esc>:wincmd l<CR>
|
||||
"
|
||||
" nnoremap <silent> <A-o> :wincmd k<CR>
|
||||
" nnoremap <silent> <A-e> :wincmd j<CR>
|
||||
" nnoremap <silent> <A-n> :wincmd h<CR>
|
||||
" nnoremap <silent> <A-i> :wincmd l<CR>
|
||||
" inoremap <silent> <A-o> <Esc>:wincmd k<CR>
|
||||
" inoremap <silent> <A-e> <Esc>:wincmd j<CR>
|
||||
" inoremap <silent> <A-n> <Esc>:wincmd h<CR>
|
||||
" inoremap <silent> <A-i> <Esc>:wincmd l<CR>
|
||||
nnoremap <silent> <C-A-o> :wincmd k<CR>
|
||||
nnoremap <silent> <C-A-e> :wincmd j<CR>
|
||||
nnoremap <silent> <C-A-n> :wincmd h<CR>
|
||||
nnoremap <silent> <C-A-i> :wincmd l<CR>
|
||||
nnoremap <silent> <A-Up> :wincmd k<CR>
|
||||
nnoremap <silent> <A-Down> :wincmd j<CR>
|
||||
nnoremap <silent> <A-Left> :wincmd h<CR>
|
||||
nnoremap <silent> <A-Right> :wincmd l<CR>
|
||||
inoremap <silent> <A-Up> <Esc>:wincmd k<CR>
|
||||
inoremap <silent> <A-Down> <Esc>:wincmd j<CR>
|
||||
inoremap <silent> <A-Left> <Esc>:wincmd h<CR>
|
||||
inoremap <silent> <A-Right> <Esc>:wincmd l<CR>
|
||||
nnoremap <silent> <C-A-Up> :wincmd K<CR>
|
||||
nnoremap <silent> <C-A-Down> :wincmd J<CR>
|
||||
nnoremap <silent> <C-A-Left> :wincmd H<CR>
|
||||
nnoremap <silent> <C-A-Right> :wincmd L<CR>
|
||||
inoremap <silent> <C-A-Up> <Esc>:wincmd K<CR>
|
||||
inoremap <silent> <C-A-Down> <Esc>:wincmd J<CR>
|
||||
inoremap <silent> <C-A-Left> <Esc>:wincmd H<CR>
|
||||
inoremap <silent> <C-A-Right> <Esc>:wincmd L<CR>
|
||||
|
||||
" tags
|
||||
nmap <S-F3> :exec("tjump ".expand("<cword>"))<CR>
|
||||
nmap <S-F4> :split<CR>:exec("tjump ".expand("<cword>"))<CR>
|
||||
|
||||
" trigger NERDTree, Tagbar $ Co.
|
||||
" nmap <leader>n <Esc>:NERDTreeToggle<CR>
|
||||
" nmap <leader>t <Esc>:TagbarToggle<CR>
|
||||
" nmap <leader>f "zyaw :exe ":Ack ".@z.""<CR>
|
||||
|
||||
" grep word under cursor
|
||||
nnoremap <silent><leader>f :lgr! "\b<C-R><C-W>\b"<CR>:cw<CR>
|
||||
|
||||
" paste from system clipboard
|
||||
inoremap <silent> <S-Insert> <ESC>:set paste<CR>"+p :set nopaste<CR>
|
||||
|
||||
" toggle spellcheck
|
||||
nmap <silent> <S-F7> :setlocal spell! spelllang=en_us<CR>
|
||||
|
||||
" cursor jump
|
||||
" nnoremap <A-Up> 3k
|
||||
" inoremap <A-Up> <Esc>:-3<CR>i
|
||||
" vnoremap <A-Up> 3k
|
||||
" nnoremap <A-Down> 3j
|
||||
" inoremap <A-Down> <Esc>:+3<CR>i
|
||||
" vnoremap <A-Down> 3j
|
||||
" nnoremap <C-Up> 6k
|
||||
" inoremap <C-Up> <Esc>:-6<CR>i
|
||||
" vnoremap <C-Up> 6k
|
||||
" nnoremap <C-Down> 6j
|
||||
" inoremap <C-Down> <Esc>:+6<CR>i
|
||||
" vnoremap <C-Down> 6j
|
||||
|
||||
nnoremap <A-o> 3k
|
||||
vnoremap <A-o> 3k
|
||||
nnoremap <A-e> 3j
|
||||
vnoremap <A-e> 3j
|
||||
nnoremap <C-o> 6k
|
||||
vnoremap <C-o> 6k
|
||||
nnoremap <C-e> 6j
|
||||
vnoremap <C-e> 6j
|
||||
|
||||
" scrolling
|
||||
nnoremap <S-PageUp> 10<C-Y>
|
||||
" inoremap <S-PageUp> <Esc>10<C-Y>i
|
||||
vnoremap <S-PageUp> 10<C-Y>
|
||||
nnoremap <S-PageDown> 10<C-E>
|
||||
" inoremap <S-PageDown> <Esc>10<C-E>i
|
||||
vnoremap <S-PageDown> 10<C-E>
|
||||
|
||||
nnoremap <A-p> 10<C-Y>
|
||||
" inoremap <A-p> <Esc>10<C-Y>i
|
||||
vnoremap <A-p> 10<C-Y>
|
||||
nnoremap <A-u> 10<C-E>
|
||||
" inoremap <A-u> <Esc>10<C-E>i
|
||||
vnoremap <A-u> 10<C-E>
|
||||
|
||||
nnoremap <C-p> <C-u>
|
||||
" inoremap <C-p> <Esc><C-u>i
|
||||
vnoremap <C-p> <C-u>
|
||||
nnoremap <C-u> <C-d>
|
||||
" inoremap <C-u> <Esc><C-d>i
|
||||
vnoremap <C-u> <C-d>
|
||||
|
||||
" half scroll up and down
|
||||
noremap <C-A-p> <C-b>
|
||||
noremap <C-A-u> <C-f>
|
||||
map <C-d> <Nop>
|
||||
|
||||
" F keys
|
||||
" nmap <F2> :noh<CR>
|
||||
" imap <F2> <C-O>:noh<CR>
|
||||
noremap <F5> :FufBuffer<CR>
|
||||
nmap <F7> :call ManCurrentWord()<CR><CR>
|
||||
" nmap <F8> :call DevHelpCurrentWord()<CR><CR>
|
||||
" nmap <F4> <C-]>
|
||||
|
||||
" remap visual block
|
||||
nnoremap <S-C> <c-v>
|
||||
|
||||
" write
|
||||
noremap <C-s> :w<CR>
|
||||
inoremap <C-s> <Esc>:w<CR>
|
||||
|
||||
" exit
|
||||
noremap <C-q> :qa!<CR>
|
||||
inoremap <C-q> <C-O>:qa!<CR>
|
||||
|
||||
" paste
|
||||
nnoremap <C-V> "+gPl
|
||||
vnoremap <C-V> :<C-U>call Paste("v")<CR>
|
||||
inoremap <C-V> <C-O>:call Paste("i")<CR>
|
||||
|
||||
" select all
|
||||
nnoremap <C-A> ggVG<CR>
|
||||
inoremap <C-A> <C-O>:call Select()<CR>
|
||||
|
||||
nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
|
||||
|
||||
nnoremap <Leader>cc :call ToggleQuickFix()<CR>
|
||||
|
||||
function! ToggleQuickFix()
|
||||
if empty(filter(getwininfo(), 'v:val.quickfix'))
|
||||
copen
|
||||
else
|
||||
cclose
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ToggleLocList()
|
||||
if empty(filter(getwininfo(), 'v:val.loclist'))
|
||||
lopen
|
||||
else
|
||||
lclose
|
||||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <F3> :call ToggleQuickFix()<CR>
|
||||
nnoremap <silent> <F4> :call ToggleLocList()<CR>
|
||||
|
||||
|
||||
|
||||
|
||||
" PLUGINS
|
||||
|
||||
|
||||
" NERDTree
|
||||
if !exists('g:vscode')
|
||||
" noremap <C-j> :Telescope file_browser<CR>
|
||||
noremap <C-j> :NERDTreeToggle<CR>
|
||||
" noremap <C-B> :TagbarToggle<CR>
|
||||
inoremap <C-B> <C-O>:TagbarToggle<CR>
|
||||
endif
|
||||
|
||||
" vista
|
||||
nmap <F8> :Vista!!<CR>
|
||||
|
||||
" NERDComment
|
||||
if !exists('g:vscode')
|
||||
nnoremap <silent> <F10> :call NERDComment("n", "Toggle")<cr>
|
||||
vnoremap <silent> <F10> <ESC>:call NERDComment("v", "Toggle")<cr>
|
||||
endif
|
||||
|
||||
" YCM
|
||||
if !exists('g:vscode')
|
||||
nmap <C-F4> :YcmCompleter GoTo<CR>:wincmd o<CR>
|
||||
endif
|
||||
|
||||
" vim-clap
|
||||
if !exists('g:vscode')
|
||||
if has('nvim')
|
||||
nnoremap <leader>ag <cmd>lua require('telescope.builtin').live_grep({ default_text = vim.fn.expand("<cword>") })<cr>
|
||||
nnoremap <silent> <leader>tg <cmd>lua require('telescope.builtin').tags({ default_text = vim.fn.expand("<cword>") })<cr>
|
||||
nmap <silent> <C-f> :call ComIfGit('lua require("telescope.builtin").git_files()', 'lua require("telescope.builtin").find_files()')<CR>
|
||||
nmap <F1> <cmd>lua require('telescope.builtin').tags()<cr>
|
||||
nmap <C-b> <cmd>lua require('telescope.builtin').buffers()<cr>
|
||||
nmap <C-d> <cmd>lua require('telescope.builtin').diagnostics()<cr>
|
||||
nmap <C-l> <cmd>lua require('telescope.builtin').lsp_document_symbols()<cr>
|
||||
nnoremap <leader>ls <cmd>lua require('telescope.builtin').lsp_document_symbols({ default_text = vim.fn.expand("<cword>") })<cr>
|
||||
else
|
||||
nnoremap <leader>ag :Clap grep ++query=<cword><CR>
|
||||
nnoremap <leader>dg :Clap dumb_jump ++query=<cword><CR>
|
||||
" nnoremap <silent> <leader>tg :Clap proj_tags ++query=<cword><CR>
|
||||
nmap <silent> <C-f> :call ComIfGit('Clap gfiles', 'Clap files')<CR>
|
||||
nmap <F1> :Clap tags<CR>
|
||||
nmap <F2> :Clap proj_tags<CR>
|
||||
nmap <C-b> :Clap buffers<CR>
|
||||
nnoremap <silent> <leader>tb :Clap proj_tags ++query=<cword><CR>
|
||||
endif
|
||||
endif
|
||||
|
||||
" tags
|
||||
nnoremap <silent> <leader>tg :tag <C-R>=expand("<cword>")<CR><CR>
|
||||
nnoremap <silent> <leader>tp :ptag <C-R>=expand("<cword>")<CR><CR>
|
||||
nnoremap <silent> <leader>ts :ts <C-R>=expand("<cword>")<CR><CR>
|
||||
|
||||
" gitgutter
|
||||
if !exists('g:vscode')
|
||||
nmap <leader>ggt <Esc>:GitGutterToggle<CR>
|
||||
nmap <leader>nh <Plug>(GitGutterNextHunk)
|
||||
nmap <leader>bh <Plug>(GitGutterPrevHunk)
|
||||
|
||||
" tig
|
||||
" let g:tig_explorer_keymap_edit = '<C-x>'
|
||||
" let g:tig_explorer_keymap_tabedit = '<C-t>'
|
||||
" let g:tig_explorer_keymap_split = '<C-s>'
|
||||
" let g:tig_explorer_keymap_vsplit = '<C-v>'
|
||||
" nnoremap <Leader>T :TigOpenCurrentFile<CR>
|
||||
" nnoremap <Leader>t :TigOpenProjectRootDir<CR>
|
||||
" nnoremap <Leader>g :TigGrep<CR>
|
||||
" nnoremap <Leader>r :TigGrepResume<CR>
|
||||
" vnoremap <Leader>g y:TigGrep<Space><C-R>"<CR>
|
||||
" nnoremap <Leader>cg :<C-u>:TigGrep<Space><C-R><C-W><CR>
|
||||
" nnoremap <Leader>b :TigBlame<CR>
|
||||
|
||||
" ghcup
|
||||
" nnoremap <Leader>ghc :GHCup<CR>
|
||||
|
||||
" git gutter
|
||||
omap <leader>ic <Plug>(GitGutterTextObjectInnerPending)
|
||||
omap <leader>ac <Plug>(GitGutterTextObjectOuterPending)
|
||||
xmap <leader>ic <Plug>(GitGutterTextObjectInnerVisual)
|
||||
xmap <leader>ac <Plug>(GitGutterTextObjectOuterVisual)
|
||||
endif
|
||||
|
||||
" fastfold
|
||||
nmap zuz <Plug>(FastFoldUpdate)
|
||||
|
||||
if exists('g:vscode')
|
||||
nnoremap <silent> T :call VSCodeNotify('editor.action.showHover')<CR>
|
||||
nnoremap <silent> gd :call VSCodeNotify('editor.action.revealDefinition')<CR>
|
||||
|
||||
else
|
||||
if has('nvim')
|
||||
nnoremap <silent> T :lua vim.lsp.buf.hover()<CR>
|
||||
nnoremap <silent> gd :lua vim.lsp.buf.definition()<CR>
|
||||
nnoremap <leader>la :lua vim.lsp.buf.code_action()<CR>
|
||||
nnoremap <leader>rn :lua vim.lsp.buf.rename()<CR>
|
||||
|
||||
nnoremap <leader>ci :lua vim.lsp.buf.incoming_calls()<CR>
|
||||
nnoremap <leader>co :lua vim.lsp.buf.outgoing_calls()<CR>
|
||||
|
||||
" Vim Script
|
||||
nnoremap <leader>xx <cmd>TroubleToggle<cr>
|
||||
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
|
||||
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
|
||||
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
|
||||
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
|
||||
nnoremap gR <cmd>TroubleToggle lsp_references<cr>
|
||||
|
||||
else
|
||||
"LanguageClient-neovim
|
||||
" Required for operations modifying multiple buffers like rename.
|
||||
set hidden
|
||||
nnoremap <leader>lc :call LanguageClient_contextMenu()<CR>
|
||||
" Or map each action separately
|
||||
nnoremap <silent> T :call LanguageClient#textDocument_hover()<CR>
|
||||
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
|
||||
" nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
|
||||
" nnoremap <leader>ld :call LanguageClient#textDocument_definition()<CR>
|
||||
" nnoremap <leader>lr :call LanguageClient#textDocument_rename()<CR>
|
||||
" nnoremap <leader>lf :call LanguageClient#textDocument_formatting()<CR>
|
||||
" nnoremap <leader>lt :call LanguageClient#textDocument_typeDefinition()<CR>
|
||||
" nnoremap <leader>lx :call LanguageClient#textDocument_references()<CR>
|
||||
" nnoremap <leader>la :call LanguageClient_workspace_applyEdit()<CR>
|
||||
" nnoremap <leader>lc :call LanguageClient#textDocument_completion()<CR>
|
||||
" nnoremap <leader>lh :call LanguageClient#textDocument_hover()<CR>
|
||||
nnoremap <leader>la :call LanguageClient#textDocument_codeAction()<CR>
|
||||
nnoremap <leader>rn :call LanguageClient#textDocument_rename()<CR>
|
||||
|
||||
nnoremap <leader>ln <Plug>(lcn-diagnostics-next)
|
||||
nnoremap <leader>lp <Plug>(lcn-diagnostics-prev)
|
||||
endif
|
||||
endif
|
||||
848
plugins.toml
Normal file
848
plugins.toml
Normal file
@@ -0,0 +1,848 @@
|
||||
[[plugins]]
|
||||
repo = 'dstein64/nvim-scrollview'
|
||||
hook_add = '''
|
||||
lua require('scrollview').setup({ excluded_filetypes = {'nerdtree'}, current_only = true, winblend = 75, base = 'right', column = 1 })
|
||||
'''
|
||||
on_if = 'has("nvim") && !exists("g:vscode")'
|
||||
lazy = false
|
||||
[[plugins]]
|
||||
repo = 'romgrk/fzy-lua-native'
|
||||
[[plugins]]
|
||||
repo = 'gelguy/wilder.nvim'
|
||||
on_event = 'CmdlineEnter'
|
||||
hook_post_source = '''
|
||||
call wilder#setup({
|
||||
\ 'modes': [':', '/', '?'],
|
||||
\ 'enable_cmdline_enter': 0,
|
||||
\ })
|
||||
|
||||
call wilder#set_option('noselect', 0)
|
||||
|
||||
call wilder#set_option('pipeline', [
|
||||
\ wilder#branch(
|
||||
\ wilder#python_file_finder_pipeline({
|
||||
\ 'file_command': {_, arg -> stridx(arg, '.') != -1 ? ['fd', '-tf', '-H'] : ['fd', '-tf']},
|
||||
\ 'dir_command': ['fd', '-td'],
|
||||
\ 'filters': ['cpsm_filter'],
|
||||
\ }),
|
||||
\ wilder#substitute_pipeline({
|
||||
\ 'pipeline': wilder#python_search_pipeline({
|
||||
\ 'skip_cmdtype_check': 1,
|
||||
\ 'pattern': wilder#python_fuzzy_pattern({
|
||||
\ 'start_at_boundary': 0,
|
||||
\ }),
|
||||
\ }),
|
||||
\ }),
|
||||
\ wilder#cmdline_pipeline({
|
||||
\ 'fuzzy': 2,
|
||||
\ 'fuzzy_filter': has('nvim') ? wilder#lua_fzy_filter() : wilder#vim_fuzzy_filter(),
|
||||
\ }),
|
||||
\ [
|
||||
\ wilder#check({_, x -> empty(x)}),
|
||||
\ wilder#history(),
|
||||
\ ],
|
||||
\ wilder#python_search_pipeline({
|
||||
\ 'pattern': wilder#python_fuzzy_pattern({
|
||||
\ 'start_at_boundary': 0,
|
||||
\ }),
|
||||
\ }),
|
||||
\ ),
|
||||
\ ])
|
||||
|
||||
let s:highlighters = [
|
||||
\ wilder#pcre2_highlighter(),
|
||||
\ has('nvim') ? wilder#lua_fzy_highlighter() : wilder#cpsm_highlighter(),
|
||||
\ ]
|
||||
|
||||
let s:popupmenu_renderer = wilder#popupmenu_renderer(wilder#popupmenu_border_theme({
|
||||
\ 'border': 'rounded',
|
||||
\ 'empty_message': wilder#popupmenu_empty_message_with_spinner(),
|
||||
\ 'highlighter': s:highlighters,
|
||||
\ 'left': [
|
||||
\ ' ',
|
||||
\ wilder#popupmenu_devicons(),
|
||||
\ wilder#popupmenu_buffer_flags({
|
||||
\ 'flags': ' a + ',
|
||||
\ 'icons': {'+': '', 'a': '', 'h': ''},
|
||||
\ }),
|
||||
\ ],
|
||||
\ 'right': [
|
||||
\ ' ',
|
||||
\ wilder#popupmenu_scrollbar(),
|
||||
\ ],
|
||||
\ }))
|
||||
|
||||
let s:wildmenu_renderer = wilder#wildmenu_renderer({
|
||||
\ 'highlighter': s:highlighters,
|
||||
\ 'separator': ' · ',
|
||||
\ 'left': [' ', wilder#wildmenu_spinner(), ' '],
|
||||
\ 'right': [' ', wilder#wildmenu_index()],
|
||||
\ })
|
||||
|
||||
call wilder#set_option('renderer', wilder#renderer_mux({
|
||||
\ ':': s:popupmenu_renderer,
|
||||
\ '/': s:wildmenu_renderer,
|
||||
\ 'substitute': s:wildmenu_renderer,
|
||||
\ }))
|
||||
'''
|
||||
#[[plugins]]
|
||||
#repo = 'dstein64/vim-startuptime'
|
||||
[[plugins]]
|
||||
repo = 'purescript-contrib/purescript-vim'
|
||||
[[plugins]]
|
||||
repo = 'PProvost/vim-ps1'
|
||||
[[plugins]]
|
||||
repo = 'nvim-lua/popup.nvim'
|
||||
on_if = 'has("nvim")'
|
||||
[[plugins]]
|
||||
repo = 'nvim-lua/plenary.nvim'
|
||||
on_if = 'has("nvim")'
|
||||
[[plugins]]
|
||||
repo = 'Twinside/vim-haskellFold'
|
||||
hook_post_source = '''
|
||||
call SetHaskellFolding()
|
||||
'''
|
||||
on_ft = ['haskell']
|
||||
[[plugins]]
|
||||
repo = 'kana/vim-submode'
|
||||
hook_add = '''
|
||||
" A message will appear in the message line when you're in a submode
|
||||
" and stay there until the mode has exited.
|
||||
let g:submode_always_show_submode = 1
|
||||
|
||||
let g:submode_keep_leaving_key = 1
|
||||
|
||||
let g:submode_timeout = 0
|
||||
|
||||
" We're taking over the default <C-w> setting. Don't worry we'll do
|
||||
" our best to put back the default functionality.
|
||||
call submode#enter_with('nav', 'n', '', '<C-ENTER>')
|
||||
|
||||
call submode#map('nav', 'n', 's', 'e', ':normal! 6j<cr>')
|
||||
call submode#map('nav', 'n', 's', 'o', ':normal! 6k<cr>')
|
||||
call submode#map('nav', 'n', 's', ',', '<Cmd>normal! <C-d><CR>')
|
||||
call submode#map('nav', 'n', 's', '.', '<Cmd>normal! <C-u><CR>')
|
||||
call submode#map('nav', 'n', 's', ']', '<Cmd>normal! <C-b><CR>')
|
||||
call submode#map('nav', 'n', 's', '[', '<Cmd>normal! <C-f><CR>')
|
||||
call submode#map('nav', 'n', '', 'n', 'B')
|
||||
call submode#map('nav', 'n', '', 'i', 'W')
|
||||
call submode#map('nav', 'n', 's', '<ENTER>', ':tabprevious<cr>')
|
||||
call submode#map('nav', 'n', 's', '=', ':tabnext<cr>')
|
||||
'''
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'jparise/vim-graphql'
|
||||
[[plugins]]
|
||||
repo = 'mileszs/ack.vim'
|
||||
# [[plugins]]
|
||||
# repo = 'vim-scripts/cmdalias.vim'
|
||||
[[plugins]]
|
||||
repo = 'easymotion/vim-easymotion'
|
||||
hook_add = '''
|
||||
'''
|
||||
[[plugins]]
|
||||
repo = 'Raimondi/delimitMate'
|
||||
hook_add = '''
|
||||
let g:delimitMate_matchpairs = "(:),[:],{:}"
|
||||
let g:delimitMate_expand_cr = 1
|
||||
let g:delimitMate_expand_space = 1
|
||||
let g:delimitMate_autoclose = 1
|
||||
'''
|
||||
[[plugins]]
|
||||
repo = 'vim-scripts/genindent.vim'
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'scrooloose/nerdcommenter'
|
||||
hook_add = '''
|
||||
let NERDSpaceDelims=1
|
||||
let NERDCreateDefaultMappings=0
|
||||
'''
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'scrooloose/nerdtree'
|
||||
on_event = 'NERDTreeToggle'
|
||||
hook_add = '''
|
||||
let g:NERDTreeMapActivateNode = '<CR>'
|
||||
let g:NERDTreeMapCustomOpen = ''
|
||||
let g:NERDTreeMapOpenExpl = 'n'
|
||||
let g:NERDTreeMapJumpNextSibling = ''
|
||||
" let g:NERDTreeMapOpenSplit = ''
|
||||
" use NERDTree instead of netrw
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
|
||||
'''
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'Xuyuanp/nerdtree-git-plugin'
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'xolox/vim-easytags'
|
||||
hook_add = '''
|
||||
let g:easytags_async = 1
|
||||
'''
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'xolox/vim-misc'
|
||||
[[plugins]]
|
||||
repo = 'nathanaelkane/vim-indent-guides'
|
||||
[[plugins]]
|
||||
repo = 'Shougo/vimproc.vim'
|
||||
build = 'make'
|
||||
[[plugins]]
|
||||
repo = 'sjbach/lusty'
|
||||
hook_add = '''
|
||||
let g:LustyExplorerSuppressRubyWarning = 1
|
||||
'''
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'nixprime/cpsm'
|
||||
build = 'sh -c "PY3=ON ./install.sh"'
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'liuchengxu/vista.vim'
|
||||
hook_add = '''
|
||||
let g:vista#renderer#enable_icon = 0
|
||||
let g:vista_ctags_cmd = {
|
||||
\ 'haskell': 'hasktags -x -o - -c',
|
||||
\ 'yaml': 'hasktags -x -o - -c',
|
||||
\ }
|
||||
'''
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'sbdchd/neoformat'
|
||||
hook_add = '''
|
||||
let g:neoformat_enabled_haskell = ['brittany']
|
||||
let g:neoformat_enabled_typescript = ['prettier']
|
||||
let g:neoformat_try_node_exe = 1
|
||||
'''
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'AndrewRadev/bufferize.vim'
|
||||
[[plugins]]
|
||||
repo = 'vmchale/dhall-vim'
|
||||
[[plugins]]
|
||||
repo = 'Shougo/echodoc.vim'
|
||||
hook_add = '''
|
||||
" set cmdheight=2
|
||||
let g:echodoc#enable_at_startup = 1
|
||||
let g:echodoc#type = 'signature'
|
||||
'''
|
||||
[[plugins]]
|
||||
repo = 'tpope/vim-scriptease'
|
||||
on_if = '!has("nvim")'
|
||||
[[plugins]]
|
||||
repo = 'Konfekt/FastFold'
|
||||
hook_add = '''
|
||||
let g:fastfold_savehook = 1
|
||||
let g:fastfold_fold_command_suffixes = ['x','X','a','A','o','O','c','C']
|
||||
let g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk']
|
||||
let g:markdown_folding = 1
|
||||
let g:tex_fold_enabled = 1
|
||||
let g:vimsyn_folding = 'af'
|
||||
let g:xml_syntax_folding = 1
|
||||
let g:html_syntax_folding = 1
|
||||
let g:javaScript_fold = 1
|
||||
let g:sh_fold_enabled= 7
|
||||
let g:ruby_fold = 1
|
||||
let g:perl_fold = 1
|
||||
let g:perl_fold_blocks = 1
|
||||
let g:r_syntax_folding = 1
|
||||
let g:rust_fold = 1
|
||||
let g:haskell_fold = 1
|
||||
'''
|
||||
[[plugins]]
|
||||
repo = 'editorconfig/editorconfig-vim'
|
||||
hook_add = '''
|
||||
" overwrite nonsense from editorconfig
|
||||
let g:EditorConfig_max_line_indicator = 'none'
|
||||
" let g:EditorConfig_preserve_formatoptions = 1
|
||||
'''
|
||||
[[plugins]]
|
||||
repo = 'hasufell/ghcup.vim'
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'junegunn/vim-easy-align'
|
||||
[[plugins]]
|
||||
repo = 'dominikduda/vim_current_word'
|
||||
hook_add = '''
|
||||
let g:vim_current_word#highlight_current_word = 0
|
||||
hi default link CurrentWordTwins CursorColumn
|
||||
'''
|
||||
#[[plugins]]
|
||||
# repo = 'vim-airline/vim-airline'
|
||||
#[[plugins]]
|
||||
# repo = 'vim-airline/vim-airline-themes'
|
||||
[[plugins]]
|
||||
repo = 'mkitt/tabline.vim'
|
||||
[[plugins]]
|
||||
repo = 'kshenoy/vim-signature'
|
||||
|
||||
# finder
|
||||
#[[plugins]]
|
||||
#repo = 'liuchengxu/vim-clap'
|
||||
#build = 'make'
|
||||
#hook_add = '''
|
||||
# autocmd Filetype clap_input inoremap <silent> <buffer> <kPageDown> <C-R>=clap#navigation#scroll('down')<CR>
|
||||
# autocmd Filetype clap_input inoremap <silent> <buffer> <kPageUp> <C-R>=clap#navigation#scroll('up')<CR>
|
||||
# autocmd Filetype clap_input nnoremap <silent> <buffer> <kPageDown> <C-R>=clap#navigation#scroll('down')<CR>
|
||||
# autocmd Filetype clap_input nnoremap <silent> <buffer> <kPageUp> <C-R>=clap#navigation#scroll('up')<CR>
|
||||
#
|
||||
# let g:clap_popup_move_manager = {
|
||||
# \ "\<kPageUp>": "\<PageUp>",
|
||||
# \ "\<kPageDown>": "\<PageDown>",
|
||||
# \ }
|
||||
#
|
||||
# let g:clap_layout = {'relative': 'editor', 'width': '95%', 'height': '33%', 'row': '33%', 'col': '5%'}
|
||||
# let g:clap_use_pure_python = 1
|
||||
#
|
||||
# function! MultiClap(com, ...) abort
|
||||
# let opts = map(copy(a:000), "printf('++query=%s', v:val)")
|
||||
# execute 'Clap ' a:com join(opts, ' ')
|
||||
# endfunction
|
||||
#
|
||||
# command! -nargs=* Rag call MultiClap('grep', <f-args>)
|
||||
# command! -nargs=* Dag call MultiClap('dumb_jump', <f-args>)
|
||||
#
|
||||
# let g:clap_provider_generated_tags = {
|
||||
# \ 'source': {-> Tags__source()},
|
||||
# \ 'sink': {line -> Tags__sink(line)},
|
||||
# \}
|
||||
#
|
||||
# function! Tags__source ()
|
||||
# return flatten(map(tagfiles(), {_, file -> filter(readfile(file), 'stridx(v:val, "!_TAG") != 0')}))
|
||||
# endfunc
|
||||
#
|
||||
# function! Tags__sink (line)
|
||||
# " Let vim handle the tag
|
||||
# execute 'tag' split(a:line, '\t')[0]
|
||||
# endfunc
|
||||
#
|
||||
# cabbrev C Clap
|
||||
# cabbrev c Clap
|
||||
# cabbrev cp Clap proj_tags
|
||||
#'''
|
||||
#on_if = '!has("nvim") && !exists("g:vscode")'
|
||||
|
||||
# scm
|
||||
[[plugins]]
|
||||
repo = 'tpope/vim-fugitive'
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'tpope/vim-rhubarb'
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'tommcdo/vim-fubitive'
|
||||
[[plugins]]
|
||||
repo = 'airblade/vim-gitgutter'
|
||||
hook_add = '''
|
||||
" https://github.com/airblade/vim-gitgutter/issues/696
|
||||
autocmd ColorScheme * highlight! link SignColumn LineNr
|
||||
'''
|
||||
on_if = '!exists("g:vscode")'
|
||||
|
||||
# local vimrc
|
||||
[[plugins]]
|
||||
repo = 'LucHermitte/lh-vim-lib'
|
||||
[[plugins]]
|
||||
repo = 'LucHermitte/local_vimrc'
|
||||
|
||||
# completion
|
||||
#[[plugins]]
|
||||
#repo = 'Valloric/YouCompleteMe'
|
||||
#build = './install.py --clang-completer --go-completer --rust-completer --system-boost --system-libclang'
|
||||
#on_ft = ['c', 'go', 'clojure']
|
||||
#hook_add = '''
|
||||
# youcompleteme
|
||||
# let g:ycm_filetype_blacklist = {
|
||||
# \ 'notes' : 1,
|
||||
# \ 'markdown' : 1,
|
||||
# \ 'text' : 1,
|
||||
# \ 'java' : 1,
|
||||
# \}
|
||||
# let g:ycm_confirm_extra_conf = 0
|
||||
# let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
|
||||
# let g:ycm_collect_identifiers_from_tags_files = 1
|
||||
# let g:ycm_seed_identifiers_with_syntax = 0
|
||||
# " let g:ycm_always_populate_location_list = 1
|
||||
# let g:ycm_autoclose_preview_window_after_completion = 1
|
||||
# let g:ycm_key_invoke_completion = '<C-Space>'
|
||||
# let g:ycm_key_list_select_completion = ['<TAB>']
|
||||
# let g:ycm_key_list_previous_completion = ['<S-TAB>']
|
||||
# " nnoremap <F4> :YcmCompleter GoToDefinition<CR>
|
||||
# let g:ycm_server_log_level = 'error'
|
||||
# let g:ycm_semantic_triggers = {'haskell' : ['. ', '$ ']}
|
||||
# let g:ycm_goto_buffer_command = 'horizontal-split'
|
||||
#'''
|
||||
[[plugins]]
|
||||
repo = 'Shougo/deoplete.nvim'
|
||||
hook_add = '''
|
||||
let g:deoplete#enable_at_startup = 1
|
||||
autocmd FileType TelescopePrompt call deoplete#custom#buffer_option('auto_complete', v:false)
|
||||
'''
|
||||
on_if = '!exists("g:vscode")'
|
||||
lazy = false
|
||||
[[plugins]]
|
||||
repo = 'Shougo/deoplete-lsp'
|
||||
on_if = '!exists("g:vscode")'
|
||||
lazy = false
|
||||
[[plugins]]
|
||||
repo = 'roxma/nvim-yarp'
|
||||
on_if = '!has("nvim")'
|
||||
[[plugins]]
|
||||
repo = 'roxma/vim-hug-neovim-rpc'
|
||||
on_if = '!has("nvim")'
|
||||
|
||||
# linting/compilation
|
||||
[[plugins]]
|
||||
repo = 'dense-analysis/ale'
|
||||
# build = 'bash -c "cp -R ~/.vim/ale_linters ."'
|
||||
hook_add = '''
|
||||
let g:ale_enabled = 1
|
||||
" let g:ale_haskell_hie_executable = $HOME . '/.ghcup/bin/haskell-language-server-wrapper'
|
||||
" let g:ale_linters = {'haskell':['hie'], 'c':[]}
|
||||
let g:ale_linters_explicit = 1
|
||||
let g:ale_haskell_argon_error_level = 14
|
||||
let g:ale_haskell_argon_warn_level = 10
|
||||
let g:ale_haskell_argon_info_level = 6
|
||||
'''
|
||||
on_if = 'index(["sh", "vim"], &ft) >= 0 && !exists("g:vscode")'
|
||||
|
||||
# LSP
|
||||
[[plugins]]
|
||||
repo = 'autozimu/LanguageClient-neovim'
|
||||
rev = 'dev'
|
||||
build = 'bash ./install.sh'
|
||||
hook_add = '''
|
||||
" Required for operations modifying multiple buffers like rename.
|
||||
set hidden
|
||||
|
||||
let g:LanguageClient_autoStart = 0
|
||||
let g:LanguageClient_diagnosticsEnable = 1
|
||||
let g:LanguageClient_diagnosticsList = "Quickfix"
|
||||
let g:LanguageClient_diagnosticsDisplay = {
|
||||
\ 1: {
|
||||
\ "name": "Error",
|
||||
\ "texthl": "ALEError",
|
||||
\ "signText": "✖",
|
||||
\ "signTexthl": "ALEErrorSign",
|
||||
\ "virtualTexthl": "Error",
|
||||
\ },
|
||||
\ 2: {
|
||||
\ "name": "Warning",
|
||||
\ "texthl": "ALEWarning",
|
||||
\ "signText": "⚠",
|
||||
\ "signTexthl": "ALEWarningSign",
|
||||
\ "virtualTexthl": "Virtual",
|
||||
\ },
|
||||
\ 3: {
|
||||
\ "name": "Information",
|
||||
\ "texthl": "ALEInfo",
|
||||
\ "signText": "ℹ",
|
||||
\ "signTexthl": "ALEInfoSign",
|
||||
\ "virtualTexthl": "Virtual",
|
||||
\ },
|
||||
\ 4: {
|
||||
\ "name": "Hint",
|
||||
\ "texthl": "ALEInfo",
|
||||
\ "signText": "➤",
|
||||
\ "signTexthl": "ALEInfoSign",
|
||||
\ "virtualTexthl": "Virtual",
|
||||
\ },
|
||||
\ }
|
||||
|
||||
" hi link ALEError Error
|
||||
hi ALEError term=underline cterm=underline ctermfg=Red gui=undercurl guisp=Red
|
||||
hi link ALEWarning Warning
|
||||
hi Virtual cterm=italic ctermfg=10 gui=italic guifg=#4b5558
|
||||
hi link ALEInfo SpellCap
|
||||
|
||||
let $LANGUAGECLIENT_DEBUG=1
|
||||
let g:LanguageClient_loggingLevel='DEBUG'
|
||||
let g:LanguageClient_virtualTextPrefix = ''
|
||||
let g:LanguageClient_loggingFile = expand('~/LanguageClient.log')
|
||||
let g:LanguageClient_serverStderr = expand('~/LanguageServer.log')
|
||||
|
||||
let g:LanguageClient_rootMarkers = {
|
||||
\ 'haskell': ['cabal.project', '*.cabal', 'stack.yaml'],
|
||||
\ 'elm': ['elm.json']
|
||||
\ }
|
||||
|
||||
let g:LanguageClient_serverCommands = {
|
||||
\ 'haskell': ['haskell-language-server-wrapper', '--lsp', '--logfile', $HOME.'/hls-server.log'],
|
||||
\ 'purescript': ['~/.npm-modules/bin/purescript-language-server', '--stdio'],
|
||||
\ 'elm': ['elm-language-server'],
|
||||
\ 'typescript': ['typescript-language-server', '--stdio']
|
||||
\ }
|
||||
'''
|
||||
on_if = '!has("nvim")'
|
||||
#[[plugins]]
|
||||
#repo = 'prabirshrestha/vim-lsp'
|
||||
#hook_add = '''
|
||||
# function! s:on_lsp_buffer_enabled() abort
|
||||
# setlocal omnifunc=lsp#complete
|
||||
# setlocal signcolumn=yes
|
||||
# if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
|
||||
# nmap <buffer> gd <plug>(lsp-definition)
|
||||
# nmap <buffer> gr <plug>(lsp-references)
|
||||
# " nmap <buffer> gi <plug>(lsp-implementation)
|
||||
# " nmap <buffer> gt <plug>(lsp-type-definition)
|
||||
# nmap <buffer> <leader>rn <plug>(lsp-rename)
|
||||
# nmap <buffer> .g <Plug>(lsp-previous-diagnostic)
|
||||
# nmap <buffer> ,g <Plug>(lsp-next-diagnostic)
|
||||
# nmap <buffer> T <plug>(lsp-hover)
|
||||
# nmap <buffer> <leader>la <plug>(lsp-code-action)
|
||||
# nmap <buffer> <leader>sd <plug>(lsp-document-diagnostics)
|
||||
#
|
||||
# " refer to doc to add more commands
|
||||
# endfunction
|
||||
#
|
||||
# augroup lsp_install
|
||||
# au!
|
||||
# " call s:on_lsp_buffer_enabled only for languages that has the server registered.
|
||||
# autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
|
||||
# augroup END
|
||||
#
|
||||
# let g:lsp_auto_enable = 0
|
||||
#
|
||||
# " command -nargs=0 LspStart call lsp#activate()
|
||||
#'''
|
||||
|
||||
# snippets
|
||||
#[[plugins]]
|
||||
#repo = 'Shougo/neosnippet.vim'
|
||||
#[[plugins]]
|
||||
#repo = 'honza/vim-snippets'
|
||||
|
||||
# multi language
|
||||
[[plugins]]
|
||||
repo = 'luochen1990/rainbow'
|
||||
hook_add = '''
|
||||
let g:rainbow_conf = {
|
||||
\ 'guifgs': ['#DC322F', 'royalblue3', 'darkorange3', 'seagreen3'],
|
||||
\ 'ctermfgs': ['lightred', 'lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'],
|
||||
\}
|
||||
let g:rainbow_active = 1
|
||||
'''
|
||||
on_if = 'index(["clojure", "haskell", "python"], &ft) >= 0 && !exists("g:vscode")'
|
||||
|
||||
# haskell
|
||||
[[plugins]]
|
||||
repo = 'neovimhaskell/haskell-vim'
|
||||
hook_add = '''
|
||||
let g:haskell_classic_highlighting = 1
|
||||
let g:haskell_indent_disable = 1
|
||||
" let g:haskell_enable_quantification = 1
|
||||
" let g:haskell_enable_recursivedo = 1
|
||||
" let g:haskell_enable_arrowsyntax = 1
|
||||
" let g:haskell_enable_pattern_synonyms = 1
|
||||
" let g:haskell_enable_typeroles = 1
|
||||
let g:haskell_indent_if = 0
|
||||
let g:haskell_indent_case = 4
|
||||
let g:haskell_indent_let = 4
|
||||
let g:haskell_indent_where = 6
|
||||
let g:haskell_indent_before_where = 2
|
||||
let g:haskell_indent_after_bare_where = 2
|
||||
let g:haskell_indent_do = 4
|
||||
let g:haskell_indent_in = 0
|
||||
let g:haskell_indent_guard = 4
|
||||
" let g:haskell_disable_TH = 1
|
||||
'''
|
||||
on_if = 'index(["haskell", "cabal"], &ft) >= 0 && !exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'Twinside/vim-hoogle'
|
||||
hook_source = '''
|
||||
nnoremap <leader>ho :Hoogle<CR>
|
||||
nnoremap <leader>hc :HoogleClose<CR>
|
||||
'''
|
||||
on_if = 'index(["haskell"], &ft) >= 0 && !exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'alx741/vim-stylishask'
|
||||
hook_add = '''
|
||||
let g:stylishask_on_save = 0
|
||||
'''
|
||||
on_if = 'index(["haskell"], &ft) >= 0 && !exists("g:vscode")'
|
||||
|
||||
[[plugins]]
|
||||
repo = 'fatih/vim-go'
|
||||
on_ft = ['go']
|
||||
hook_post_source = 'GoInstallBinaries'
|
||||
|
||||
# rust
|
||||
[[plugins]]
|
||||
repo = 'rust-lang/rust.vim'
|
||||
on_ft = ['rust']
|
||||
|
||||
# python
|
||||
[[plugins]]
|
||||
repo = 'python-mode/python-mode'
|
||||
on_ft = ['python']
|
||||
#[[plugins]]
|
||||
# repo = 'zchee/deoplete-jedi'
|
||||
# on_ft = ['python']
|
||||
#[[plugins]]
|
||||
# repo = 'davidhalter/jedi-vim'
|
||||
# on_ft = ['python']
|
||||
[[plugins]]
|
||||
repo = 'manicmaniac/coconut.vim'
|
||||
on_ft = ['python']
|
||||
[[plugins]]
|
||||
repo = 'alfredodeza/pytest.vim'
|
||||
on_if = 'index(["python"], &ft) >= 0 && !exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'idanarye/vim-vebugger'
|
||||
on_if = 'index(["python"], &ft) >= 0 && !exists("g:vscode")'
|
||||
|
||||
# scala
|
||||
[[plugins]]
|
||||
repo = 'derekwyatt/vim-scala'
|
||||
on_if = 'index(["scala"], &ft) >= 0 && !exists("g:vscode")'
|
||||
|
||||
# javascript
|
||||
[[plugins]]
|
||||
repo = 'pangloss/vim-javascript'
|
||||
on_ft = ['typescript', 'javascript']
|
||||
[[plugins]]
|
||||
repo = 'MaxMEllon/vim-jsx-pretty'
|
||||
on_ft = ['typescript', 'javascript']
|
||||
|
||||
# typescript
|
||||
[[plugins]]
|
||||
repo = 'leafgarland/typescript-vim'
|
||||
on_ft = ['typescript', 'javascript']
|
||||
#[[plugins]]
|
||||
#repo = 'Quramy/tsuquyomi'
|
||||
#on_ft = ['typescript', 'javascript']
|
||||
[[plugins]]
|
||||
repo = 'prettier/vim-prettier'
|
||||
on_ft = ['typescript', 'javascript']
|
||||
build = 'npm install'
|
||||
|
||||
|
||||
# color and beauty
|
||||
# [[plugins]]
|
||||
# repo = 'tomasiser/vim-code-dark'
|
||||
# [[plugins]]
|
||||
# repo = 'romainl/Apprentice'
|
||||
# [[plugins]]
|
||||
# repo = 'chriskempson/base16-vim'
|
||||
# [[plugins]]
|
||||
# repo = 'fneu/breezy'
|
||||
# [[plugins]]
|
||||
# repo = 'romainl/Disciple'
|
||||
# [[plugins]]
|
||||
# repo = 'wimstefan/Lightning'
|
||||
# [[plugins]]
|
||||
# repo = 'NLKNguyen/papercolor-theme'
|
||||
# [[plugins]]
|
||||
# repo = 'flazz/vim-colorschemes'
|
||||
[[plugins]]
|
||||
repo = 'overcache/NeoSolarized'
|
||||
hook_add = '''
|
||||
let g:neosolarized_contrast = 'normal'
|
||||
let g:neosolarized_visibility = 'normal'
|
||||
let g:neosolarized_vertSplitBgTrans = 0
|
||||
let g:neosolarized_bold = 1
|
||||
let g:neosolarized_underline = 1
|
||||
let g:neosolarized_italic = 1
|
||||
set background=dark
|
||||
colorscheme NeoSolarized
|
||||
'''
|
||||
# repo = 'reedes/vim-colors-pencil'
|
||||
# [[plugins]]
|
||||
# repo = 'whatyouhide/vim-gotham'
|
||||
# [[plugins]]
|
||||
# repo = 'noahfrederick/vim-hemisu'
|
||||
# [[plugins]]
|
||||
# repo = 'morhetz/gruvbox'
|
||||
|
||||
# toml
|
||||
[[plugins]]
|
||||
repo = 'https://github.com/cespare/vim-toml'
|
||||
|
||||
# unmanaged
|
||||
[[plugins]]
|
||||
name = 'L9'
|
||||
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
rtp = 'L9'
|
||||
[[plugins]]
|
||||
name = 'ScrollColor'
|
||||
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
rtp = 'ScrollColor'
|
||||
[[plugins]]
|
||||
name = 'bufonly'
|
||||
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
rtp = 'bufonly'
|
||||
on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
name = 'colorschemedgrade'
|
||||
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
rtp = 'colorschemedegrade'
|
||||
[[plugins]]
|
||||
name = 'exheres-syntax'
|
||||
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
rtp = 'exheres-syntax-20160115'
|
||||
[[plugins]]
|
||||
name = 'fontzoom'
|
||||
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
rtp = 'fontzoom'
|
||||
on_if = '!has("nvim")'
|
||||
#[[plugins]]
|
||||
#name = 'fuzzyfinder'
|
||||
#repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
#rtp = 'fuzzyfinder'
|
||||
#on_if = '!exists("g:vscode")'
|
||||
[[plugins]]
|
||||
name = 'log'
|
||||
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
rtp = 'log'
|
||||
on_if = '!exists("g:vscode")'
|
||||
#[[plugins]]
|
||||
#repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
#rtp = 'paredit'
|
||||
#[[plugins]]
|
||||
#repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
#rtp = 'tslime'
|
||||
[[plugins]]
|
||||
name = 'txtfmt'
|
||||
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
|
||||
rtp = 'txtfmt'
|
||||
on_if = '!exists("g:vscode")'
|
||||
|
||||
|
||||
[[plugins]]
|
||||
repo = 'williamboman/nvim-lsp-installer'
|
||||
hook_add = '''
|
||||
lua << EOF
|
||||
require("nvim-lsp-installer").setup({
|
||||
automatic_installation = false,
|
||||
ui = {
|
||||
icons = {
|
||||
server_installed = "✓",
|
||||
server_pending = "➜",
|
||||
server_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
})
|
||||
EOF
|
||||
'''
|
||||
on_if = 'has("nvim") && !exists("g:vscode")'
|
||||
lazy = true
|
||||
depends = 'nvim-lspconfig'
|
||||
[[plugins]]
|
||||
repo = 'neovim/nvim-lspconfig'
|
||||
hook_add = '''
|
||||
" https://github.com/nvim-lua/diagnostic-nvim/issues/29#issuecomment-819344193
|
||||
" https://github.com/neovim/neovim/issues/12389
|
||||
|
||||
function! Diagnostic_open()
|
||||
if len(filter(nvim_tabpage_list_wins(0), {k,v->nvim_win_get_config(v).relative!=""})) <= 1
|
||||
lua vim.diagnostic.open_float({focusable = false})
|
||||
endif
|
||||
endfunction
|
||||
|
||||
lua << EOF
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.cmd('autocmd CursorHold * call Diagnostic_open()')
|
||||
end
|
||||
require('lspconfig').hls.setup{
|
||||
cmd = { vim.fs.normalize('~/.ghcup/bin/haskell-language-server-wrapper'), '--lsp', '+RTS', '--nonmoving-gc', '-RTS' },
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
haskell = {
|
||||
formattingProvider = "brittany",
|
||||
plugin = {
|
||||
["ghcide-hover-and-symbols"] = { globalOn = true },
|
||||
["ghcide-code-actions-imports-exports"] = { globalOn = true },
|
||||
["ghcide-code-actions-type-signatures"] = { globalOn = false },
|
||||
["ghcide-code-actions-bindings"] = { globalOn = false },
|
||||
["ghcide-code-actions-fill-holes"] = { globalOn = false },
|
||||
["ghcide-completions"] = { globalOn = true },
|
||||
["ghcide-type-lenses"] = { globalOn = false },
|
||||
pragmas = { globalOn = false },
|
||||
tactics = { globalOn = false },
|
||||
rename = { globalOn = false },
|
||||
retrie = { globalOn = false },
|
||||
callHierarchy = { globalOn = true },
|
||||
class = { globalOn = false },
|
||||
haddockComments = { globalOn = true },
|
||||
eval = { globalOn = false },
|
||||
importLens = { globalOn = false },
|
||||
qualifyImportNames = { globalOn = true },
|
||||
refineImports = { globalOn = true },
|
||||
moduleName = { globalOn = false },
|
||||
hlint = { globalOn = true },
|
||||
splice = { globalOn = false },
|
||||
alternateNumberFormat = { globalOn = false },
|
||||
selectionRange = { globalOn = false },
|
||||
changeTypeSignature = { globalOn = false }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
require('lspconfig').tsserver.setup{ on_attach = on_attach }
|
||||
require('lspconfig').bashls.setup{ on_attach = on_attach }
|
||||
require('lspconfig').jsonls.setup{ on_attach = on_attach }
|
||||
require('lspconfig').vimls.setup{ on_attach = on_attach }
|
||||
require('lspconfig').dockerls.setup{ on_attach = on_attach }
|
||||
require('lspconfig').powershell_es.setup{ on_attach = on_attach, bundle_path = 'c:/w/PowerShellEditorServices', shell = 'pwsh' }
|
||||
EOF
|
||||
'''
|
||||
on_if = 'has("nvim") && !exists("g:vscode")'
|
||||
lazy = true
|
||||
|
||||
[[plugins]]
|
||||
repo = 'kyazdani42/nvim-web-devicons'
|
||||
on_if = 'has("nvim") && !exists("g:vscode")'
|
||||
lazy = false
|
||||
|
||||
[[plugins]]
|
||||
repo = 'folke/trouble.nvim'
|
||||
hook_add = '''
|
||||
lua << EOF
|
||||
require("trouble").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
action_keys = { -- key mappings for actions in the trouble list
|
||||
jump_close = {"t"}, -- jump to the diagnostic and close the list
|
||||
}
|
||||
}
|
||||
EOF
|
||||
'''
|
||||
lazy = false
|
||||
on_if = 'has("nvim") && !exists("g:vscode")'
|
||||
|
||||
[[plugins]]
|
||||
repo = 'nvim-telescope/telescope-file-browser.nvim'
|
||||
lazy = false
|
||||
on_if = 'has("nvim") && !exists("g:vscode")'
|
||||
[[plugins]]
|
||||
repo = 'nvim-telescope/telescope.nvim'
|
||||
lazy = false
|
||||
on_if = 'has("nvim") && !exists("g:vscode")'
|
||||
hook_add = '''
|
||||
command! -nargs=* Rag :lua require('telescope.builtin').live_grep({ default_text = vim.fn.expand(<f-args>) })
|
||||
'''
|
||||
|
||||
[[plugins]]
|
||||
repo = 'ldelossa/litee.nvim'
|
||||
lazy = false
|
||||
hook_add = '''
|
||||
lua << EOF
|
||||
require("litee.lib").setup({})
|
||||
EOF
|
||||
'''
|
||||
on_if = 'has("nvim") && !exists("g:vscode")'
|
||||
|
||||
[[plugins]]
|
||||
repo = 'hasufell/litee-calltree.nvim'
|
||||
lazy = false
|
||||
hook_add = '''
|
||||
lua << EOF
|
||||
require("litee.calltree").setup({
|
||||
map_resize_keys = false
|
||||
})
|
||||
EOF
|
||||
'''
|
||||
on_if = 'has("nvim") && !exists("g:vscode")'
|
||||
379
syntax/haskell.vim.bak
Executable file
379
syntax/haskell.vim.bak
Executable file
@@ -0,0 +1,379 @@
|
||||
" Vim syntax file
|
||||
"
|
||||
" Modification of vims Haskell syntax file:
|
||||
" - match types using regular expression
|
||||
" - highlight toplevel functions
|
||||
" - use "syntax keyword" instead of "syntax match" where appropriate
|
||||
" - functions and types in import and module declarations are matched
|
||||
" - removed hs_highlight_more_types (just not needed anymore)
|
||||
" - enable spell checking in comments and strings only
|
||||
" - FFI highlighting
|
||||
" - QuasiQuotation
|
||||
" - top level Template Haskell slices
|
||||
" - PackageImport
|
||||
"
|
||||
" TODO: find out which vim versions are still supported
|
||||
"
|
||||
" From Original file:
|
||||
" ===================
|
||||
"
|
||||
" Language: Haskell
|
||||
" Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org>
|
||||
" Last Change: 2010 Feb 21
|
||||
" Original Author: John Williams <jrw@pobox.com>
|
||||
"
|
||||
" Thanks to Ryan Crumley for suggestions and John Meacham for
|
||||
" pointing out bugs. Also thanks to Ian Lynagh and Donald Bruce Stewart
|
||||
" for providing the inspiration for the inclusion of the handling
|
||||
" of C preprocessor directives, and for pointing out a bug in the
|
||||
" end-of-line comment handling.
|
||||
"
|
||||
" Options-assign a value to these variables to turn the option on:
|
||||
"
|
||||
" hs_highlight_delimiters - Highlight delimiter characters--users
|
||||
" with a light-colored background will
|
||||
" probably want to turn this on.
|
||||
" hs_highlight_boolean - Treat True and False as keywords.
|
||||
" hs_highlight_types - Treat names of primitive types as keywords.
|
||||
" hs_highlight_debug - Highlight names of debugging functions.
|
||||
" hs_allow_hash_operator - Don't highlight seemingly incorrect C
|
||||
" preprocessor directives but assume them to be
|
||||
" operators
|
||||
"
|
||||
"
|
||||
|
||||
if version < 600
|
||||
syn clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
"syntax sync fromstart "mmhhhh.... is this really ok to do so?
|
||||
syntax sync linebreaks=15 minlines=50 maxlines=500
|
||||
|
||||
syn match hsSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)"
|
||||
syn match hsSpecialChar contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)"
|
||||
syn match hsSpecialCharError contained "\\&\|'''\+"
|
||||
sy region hsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hsSpecialChar,@Spell
|
||||
sy match hsCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=hsSpecialChar,hsSpecialCharError
|
||||
sy match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hsSpecialCharError
|
||||
|
||||
" (Qualified) identifiers (no default highlighting)
|
||||
syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>"
|
||||
syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>"
|
||||
|
||||
" Infix operators--most punctuation characters and any (qualified) identifier
|
||||
" enclosed in `backquotes`. An operator starting with : is a constructor,
|
||||
" others are variables (e.g. functions).
|
||||
syn match hsVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*"
|
||||
syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*"
|
||||
syn match hsVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`"
|
||||
syn match hsConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`"
|
||||
|
||||
" Toplevel Template Haskell support
|
||||
"sy match hsTHTopLevel "^[a-z]\(\(.\&[^=]\)\|\(\n[^a-zA-Z0-9]\)\)*"
|
||||
sy match hsTHIDTopLevel "^[a-z]\S*"
|
||||
sy match hsTHTopLevel "^\$(\?" nextgroup=hsTHTopLevelName
|
||||
sy match hsTHTopLevelName "[a-z]\S*" contained
|
||||
|
||||
" Reserved symbols--cannot be overloaded.
|
||||
syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|_\|{\|}"
|
||||
|
||||
sy region hsInnerParen start="(" end=")" contained contains=hsInnerParen,hsConSym,hsType,hsVarSym
|
||||
sy region hs_InfixOpFunctionName start="^(" end=")\s*[^:`]\(\W\&\S\&[^'\"`()[\]{}@]\)\+"re=s
|
||||
\ contained keepend contains=hsInnerParen,hs_HlInfixOp
|
||||
|
||||
sy match hs_hlFunctionName "[a-z_]\(\S\&[^,\(\)\[\]]\)*" contained
|
||||
sy match hs_FunctionName "^[a-z_]\(\S\&[^,\(\)\[\]]\)*" contained contains=hs_hlFunctionName
|
||||
sy match hs_HighliteInfixFunctionName "`[a-z_][^`]*`" contained
|
||||
sy match hs_InfixFunctionName "^\S[^=]*`[a-z_][^`]*`"me=e-1 contained contains=hs_HighliteInfixFunctionName,hsType,hsConSym,hsVarSym,hsString,hsCharacter
|
||||
sy match hs_HlInfixOp "\(\W\&\S\&[^`(){}'[\]]\)\+" contained contains=hsString
|
||||
sy match hs_InfixOpFunctionName "^\(\(\w\|[[\]{}]\)\+\|\(\".*\"\)\|\('.*'\)\)\s*[^:]=*\(\W\&\S\&[^='\"`()[\]{}@]\)\+"
|
||||
\ contained contains=hs_HlInfixOp,hsCharacter
|
||||
|
||||
sy match hs_OpFunctionName "(\(\W\&[^(),\"]\)\+)" contained
|
||||
"sy region hs_Function start="^["'a-z_([{]" end="=\(\s\|\n\|\w\|[([]\)" keepend extend
|
||||
sy region hs_Function start="^["'a-zA-Z_([{]\(\(.\&[^=]\)\|\(\n\s\)\)*=" end="\(\s\|\n\|\w\|[([]\)"
|
||||
\ contains=hs_OpFunctionName,hs_InfixOpFunctionName,hs_InfixFunctionName,hs_FunctionName,hsType,hsConSym,hsVarSym,hsString,hsCharacter
|
||||
|
||||
sy match hs_TypeOp "::"
|
||||
sy match hs_DeclareFunction "^[a-z_(]\S*\(\s\|\n\)*::" contains=hs_FunctionName,hs_OpFunctionName,hs_TypeOp
|
||||
|
||||
" hi hs_TypeOp guibg=red
|
||||
|
||||
" hi hs_InfixOpFunctionName guibg=yellow
|
||||
" hi hs_Function guibg=green
|
||||
" hi hs_InfixFunctionName guibg=red
|
||||
" hi hs_DeclareFunction guibg=red
|
||||
|
||||
sy keyword hsStructure data family class where instance default deriving
|
||||
sy keyword hsTypedef type newtype
|
||||
|
||||
sy keyword hsInfix infix infixl infixr
|
||||
sy keyword hsStatement do case of let in
|
||||
sy keyword hsConditional if then else
|
||||
|
||||
"if exists("hs_highlight_types")
|
||||
" Primitive types from the standard prelude and libraries.
|
||||
sy match hsType "\<[A-Z]\(\S\&[^,.]\)*\>"
|
||||
sy match hsType "()"
|
||||
"endif
|
||||
|
||||
" Not real keywords, but close.
|
||||
if exists("hs_highlight_boolean")
|
||||
" Boolean constants from the standard prelude.
|
||||
syn keyword hsBoolean True False
|
||||
endif
|
||||
|
||||
syn region hsPackageString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained
|
||||
sy match hsModuleName excludenl "\([A-Z]\w*\.\?\)*" contained
|
||||
|
||||
sy match hsImport "\<import\>\s\+\(qualified\s\+\)\?\(\<\(\w\|\.\)*\>\)"
|
||||
\ contains=hsModuleName,hsImportLabel
|
||||
\ nextgroup=hsImportParams,hsImportIllegal skipwhite
|
||||
sy keyword hsImportLabel import qualified contained
|
||||
|
||||
sy match hsImportIllegal "\w\+" contained
|
||||
|
||||
sy keyword hsAsLabel as contained
|
||||
sy keyword hsHidingLabel hiding contained
|
||||
|
||||
sy match hsImportParams "as\s\+\(\w\+\)" contained
|
||||
\ contains=hsModuleName,hsAsLabel
|
||||
\ nextgroup=hsImportParams,hsImportIllegal skipwhite
|
||||
sy match hsImportParams "hiding" contained
|
||||
\ contains=hsHidingLabel
|
||||
\ nextgroup=hsImportParams,hsImportIllegal skipwhite
|
||||
sy region hsImportParams start="(" end=")" contained
|
||||
\ contains=hsBlockComment,hsLineComment, hsType,hsDelimTypeExport,hs_hlFunctionName,hs_OpFunctionName
|
||||
\ nextgroup=hsImportIllegal skipwhite
|
||||
|
||||
" hi hsImport guibg=red
|
||||
"hi hsImportParams guibg=bg
|
||||
"hi hsImportIllegal guibg=bg
|
||||
"hi hsModuleName guibg=bg
|
||||
|
||||
"sy match hsImport "\<import\>\(.\|[^(]\)*\((.*)\)\?"
|
||||
" \ contains=hsPackageString,hsImportLabel,hsImportMod,hsModuleName,hsImportList
|
||||
"sy keyword hsImportLabel import contained
|
||||
"sy keyword hsImportMod as qualified hiding contained
|
||||
"sy region hsImportListInner start="(" end=")" contained keepend extend contains=hs_OpFunctionName
|
||||
"sy region hsImportList matchgroup=hsImportListParens start="("rs=s+1 end=")"re=e-1
|
||||
" \ contained
|
||||
" \ keepend extend
|
||||
" \ contains=hsType,hsLineComment,hsBlockComment,hs_hlFunctionName,hsImportListInner
|
||||
|
||||
|
||||
|
||||
" new module highlighting
|
||||
syn region hsDelimTypeExport start="\<[A-Z]\(\S\&[^,.]\)*\>(" end=")" contained
|
||||
\ contains=hsType
|
||||
|
||||
sy keyword hsExportModuleLabel module contained
|
||||
sy match hsExportModule "\<module\>\(\s\|\t\|\n\)*\([A-Z]\w*\.\?\)*" contained contains=hsExportModuleLabel,hsModuleName
|
||||
|
||||
sy keyword hsModuleStartLabel module contained
|
||||
sy keyword hsModuleWhereLabel where contained
|
||||
|
||||
syn match hsModuleStart "^module\(\s\|\n\)*\(\<\(\w\|\.\)*\>\)\(\s\|\n\)*"
|
||||
\ contains=hsModuleStartLabel,hsModuleName
|
||||
\ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel
|
||||
|
||||
syn region hsModuleCommentA start="{-" end="-}"
|
||||
\ contains=hsModuleCommentA,hsCommentTodo,@Spell contained
|
||||
\ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel skipwhite skipnl
|
||||
|
||||
syn match hsModuleCommentA "--.*\n"
|
||||
\ contains=hsCommentTodo,@Spell contained
|
||||
\ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel skipwhite skipnl
|
||||
|
||||
syn region hsModuleExports start="(" end=")" contained
|
||||
\ nextgroup=hsModuleCommentB,hsModuleWhereLabel skipwhite skipnl
|
||||
\ contains=hsBlockComment,hsLineComment,hsType,hsDelimTypeExport,hs_hlFunctionName,hs_OpFunctionName,hsExportModule
|
||||
|
||||
syn match hsModuleCommentB "--.*\n"
|
||||
\ contains=hsCommentTodo,@Spell contained
|
||||
\ nextgroup=hsModuleCommentB,hsModuleWhereLabel skipwhite skipnl
|
||||
|
||||
syn region hsModuleCommentB start="{-" end="-}"
|
||||
\ contains=hsModuleCommentB,hsCommentTodo,@Spell contained
|
||||
\ nextgroup=hsModuleCommentB,hsModuleWhereLabel skipwhite skipnl
|
||||
" end module highlighting
|
||||
|
||||
" FFI support
|
||||
sy keyword hsFFIForeign foreign contained
|
||||
"sy keyword hsFFIImportExport import export contained
|
||||
sy keyword hsFFIImportExport export contained
|
||||
sy keyword hsFFICallConvention ccall stdcall contained
|
||||
sy keyword hsFFISafety safe unsafe contained
|
||||
sy region hsFFIString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=hsSpecialChar
|
||||
sy match hsFFI excludenl "\<foreign\>\(.\&[^\"]\)*\"\(.\)*\"\(\s\|\n\)*\(.\)*::"
|
||||
\ keepend
|
||||
\ contains=hsFFIForeign,hsFFIImportExport,hsFFICallConvention,hsFFISafety,hsFFIString,hs_OpFunctionName,hs_hlFunctionName
|
||||
|
||||
|
||||
sy match hsNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
|
||||
sy match hsFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
|
||||
|
||||
" Comments
|
||||
sy keyword hsCommentTodo TODO FIXME XXX TBD contained
|
||||
sy match hsLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=hsCommentTodo,@Spell
|
||||
sy region hsBlockComment start="{-" end="-}" contains=hsBlockComment,hsCommentTodo,@Spell
|
||||
sy region hsPragma start="{-#" end="#-}"
|
||||
|
||||
" Liquid Types
|
||||
sy region hsLiquidAnnot start="{-@\s*" end="@-}" contains=hsLiquidKeyword,hsLiquidReftA,hsLiquidReftB,hsLiquidReftC
|
||||
sy region hsLiquidAnnot start="{-@\s*\<invariant\>" end="@-}" contains=hsLiquidKeyword,hsLiquidReftA,hsLiquidReftB,hsLiquidReftC
|
||||
sy region hsLiquidAnnot start="{-@\s*\<predicate\>" end="@-}" contains=hsLiquidKeyword,hsLiquidReftA,hsLiquidReftB,hsLiquidReftC
|
||||
sy region hsLiquidAnnot start="{-@\s*\<assert\>" end="@-}" contains=hsLiquidKeyword,hsLiquidReftA,hsLiquidReftB,hsLiquidReftC
|
||||
sy region hsLiquidAnnot start="{-@\s*\<type\>" end="@-}" contains=hsLiquidKeyword,hsLiquidReftA,hsLiquidReftB,hsLiquidReftC
|
||||
sy region hsLiquidAnnot start="{-@\s*\<data\>" end="@-}" contains=hsLiquidKeyword,hsLiquidReftA,hsLiquidReftB,hsLiquidReftC
|
||||
sy keyword hsLiquidKeyword assume assert invariant predicate type data contained
|
||||
sy region hsLiquidReftA start="{\(\s\|\w\)" end=":" contained
|
||||
sy region hsLiquidReftB start="|" end="}" contained
|
||||
sy match hsLiquidReftC "\w*:" contained
|
||||
|
||||
" QuasiQuotation
|
||||
sy region hsQQ start="\[\$" end="|\]"me=e-2 keepend contains=hsQQVarID,hsQQContent nextgroup=hsQQEnd
|
||||
sy region hsQQNew start="\[\(.\&[^|]\&\S\)*|" end="|\]"me=e-2 keepend contains=hsQQVarIDNew,hsQQContent nextgroup=hsQQEnd
|
||||
sy match hsQQContent ".*" contained
|
||||
sy match hsQQEnd "|\]" contained
|
||||
sy match hsQQVarID "\[\$\(.\&[^|]\)*|" contained
|
||||
sy match hsQQVarIDNew "\[\(.\&[^|]\)*|" contained
|
||||
|
||||
if exists("hs_highlight_debug")
|
||||
" Debugging functions from the standard prelude.
|
||||
syn keyword hsDebug undefined error trace
|
||||
endif
|
||||
|
||||
|
||||
" C Preprocessor directives. Shamelessly ripped from c.vim and trimmed
|
||||
" First, see whether to flag directive-like lines or not
|
||||
if (!exists("hs_allow_hash_operator"))
|
||||
syn match cError display "^\s*\(%:\|#\).*$"
|
||||
endif
|
||||
" Accept %: for # (C99)
|
||||
syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCommentError
|
||||
syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
|
||||
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2
|
||||
syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cCppSkip
|
||||
syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cCppSkip
|
||||
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
syn match cIncluded display contained "<[^>]*>"
|
||||
syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
|
||||
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cCppOut,cCppOut2,cCppSkip,cCommentStartError
|
||||
syn region cDefine matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$"
|
||||
syn region cPreProc matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend
|
||||
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=cCommentStartError,cSpaceError contained
|
||||
syntax match cCommentError display "\*/" contained
|
||||
syntax match cCommentStartError display "/\*"me=e-1 contained
|
||||
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained
|
||||
|
||||
|
||||
if version >= 508 || !exists("did_hs_syntax_inits")
|
||||
if version < 508
|
||||
let did_hs_syntax_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink hs_hlFunctionName Function
|
||||
HiLink hs_HighliteInfixFunctionName Function
|
||||
HiLink hs_HlInfixOp Function
|
||||
HiLink hs_OpFunctionName Function
|
||||
HiLink hsTypedef Typedef
|
||||
HiLink hsVarSym hsOperator
|
||||
HiLink hsConSym hsOperator
|
||||
if exists("hs_highlight_delimiters")
|
||||
" Some people find this highlighting distracting.
|
||||
HiLink hsDelimiter Delimiter
|
||||
endif
|
||||
|
||||
HiLink hsModuleStartLabel Structure
|
||||
HiLink hsExportModuleLabel Keyword
|
||||
HiLink hsModuleWhereLabel Structure
|
||||
HiLink hsModuleName Normal
|
||||
|
||||
HiLink hsImportIllegal Error
|
||||
HiLink hsAsLabel hsImportLabel
|
||||
HiLink hsHidingLabel hsImportLabel
|
||||
HiLink hsImportLabel Include
|
||||
HiLink hsImportMod Include
|
||||
HiLink hsPackageString hsString
|
||||
|
||||
HiLink hsOperator Operator
|
||||
|
||||
HiLink hsInfix Keyword
|
||||
HiLink hsStructure Structure
|
||||
HiLink hsStatement Statement
|
||||
HiLink hsConditional Conditional
|
||||
|
||||
HiLink hsSpecialCharError Error
|
||||
HiLink hsSpecialChar SpecialChar
|
||||
HiLink hsString String
|
||||
HiLink hsFFIString String
|
||||
HiLink hsCharacter Character
|
||||
HiLink hsNumber Number
|
||||
HiLink hsFloat Float
|
||||
|
||||
HiLink hsLiterateComment hsComment
|
||||
HiLink hsBlockComment hsComment
|
||||
HiLink hsLineComment hsComment
|
||||
HiLink hsModuleCommentA hsComment
|
||||
HiLink hsModuleCommentB hsComment
|
||||
HiLink hsComment Comment
|
||||
HiLink hsCommentTodo Todo
|
||||
HiLink hsPragma SpecialComment
|
||||
HiLink hsBoolean Boolean
|
||||
|
||||
" Liquid Types
|
||||
HiLink hsLiquidAnnot SpecialComment "String
|
||||
HiLink hsLiquidKeyword Operator "Float
|
||||
HiLink hsLiquidReftA Include
|
||||
HiLink hsLiquidReftB Include
|
||||
HiLink hsLiquidReftC Include
|
||||
|
||||
if exists("hs_highlight_types")
|
||||
HiLink hsDelimTypeExport hsType
|
||||
HiLink hsType Type
|
||||
endif
|
||||
|
||||
HiLink hsDebug Debug
|
||||
|
||||
HiLink hs_TypeOp hsOperator
|
||||
|
||||
HiLink cCppString hsString
|
||||
HiLink cCommentStart hsComment
|
||||
HiLink cCommentError hsError
|
||||
HiLink cCommentStartError hsError
|
||||
HiLink cInclude Include
|
||||
HiLink cPreProc PreProc
|
||||
HiLink cDefine Macro
|
||||
HiLink cIncluded hsString
|
||||
HiLink cError Error
|
||||
HiLink cPreCondit PreCondit
|
||||
HiLink cComment Comment
|
||||
HiLink cCppSkip cCppOut
|
||||
HiLink cCppOut2 cCppOut
|
||||
HiLink cCppOut Comment
|
||||
|
||||
HiLink hsFFIForeign Keyword
|
||||
HiLink hsFFIImportExport Structure
|
||||
HiLink hsFFICallConvention Keyword
|
||||
HiLink hsFFISafety Keyword
|
||||
|
||||
HiLink hsTHIDTopLevel Macro
|
||||
HiLink hsTHTopLevelName Macro
|
||||
|
||||
HiLink hsQQVarID Keyword
|
||||
HiLink hsQQVarIDNew Keyword
|
||||
HiLink hsQQEnd Keyword
|
||||
HiLink hsQQContent String
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "haskell"
|
||||
|
||||
105
syntax/proto.vim
Normal file
105
syntax/proto.vim
Normal file
@@ -0,0 +1,105 @@
|
||||
" Protocol Buffers - Google's data interchange format
|
||||
" Copyright 2008 Google Inc. All rights reserved.
|
||||
" https://developers.google.com/protocol-buffers/
|
||||
"
|
||||
" Redistribution and use in source and binary forms, with or without
|
||||
" modification, are permitted provided that the following conditions are
|
||||
" met:
|
||||
"
|
||||
" * Redistributions of source code must retain the above copyright
|
||||
" notice, this list of conditions and the following disclaimer.
|
||||
" * Redistributions in binary form must reproduce the above
|
||||
" copyright notice, this list of conditions and the following disclaimer
|
||||
" in the documentation and/or other materials provided with the
|
||||
" distribution.
|
||||
" * Neither the name of Google Inc. nor the names of its
|
||||
" contributors may be used to endorse or promote products derived from
|
||||
" this software without specific prior written permission.
|
||||
"
|
||||
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
" This is the Vim syntax file for Google Protocol Buffers.
|
||||
"
|
||||
" Usage:
|
||||
"
|
||||
" 1. cp proto.vim ~/.vim/syntax/
|
||||
" 2. Add the following to ~/.vimrc:
|
||||
"
|
||||
" augroup filetype
|
||||
" au! BufRead,BufNewFile *.proto setfiletype proto
|
||||
" augroup end
|
||||
"
|
||||
" Or just create a new file called ~/.vim/ftdetect/proto.vim with the
|
||||
" previous lines on it.
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
syn keyword pbTodo contained TODO FIXME XXX
|
||||
syn cluster pbCommentGrp contains=pbTodo
|
||||
|
||||
syn keyword pbSyntax syntax import option
|
||||
syn keyword pbStructure package message group oneof
|
||||
syn keyword pbRepeat optional required repeated
|
||||
syn keyword pbDefault default
|
||||
syn keyword pbExtend extend extensions to max reserved
|
||||
syn keyword pbRPC service rpc returns
|
||||
|
||||
syn keyword pbType int32 int64 uint32 uint64 sint32 sint64
|
||||
syn keyword pbType fixed32 fixed64 sfixed32 sfixed64
|
||||
syn keyword pbType float double bool string bytes
|
||||
syn keyword pbTypedef enum
|
||||
syn keyword pbBool true false
|
||||
|
||||
syn match pbInt /-\?\<\d\+\>/
|
||||
syn match pbInt /\<0[xX]\x+\>/
|
||||
syn match pbFloat /\<-\?\d*\(\.\d*\)\?/
|
||||
syn region pbComment start="\/\*" end="\*\/" contains=@pbCommentGrp
|
||||
syn region pbComment start="//" skip="\\$" end="$" keepend contains=@pbCommentGrp
|
||||
syn region pbString start=/"/ skip=/\\./ end=/"/
|
||||
syn region pbString start=/'/ skip=/\\./ end=/'/
|
||||
|
||||
if version >= 508 || !exists("did_proto_syn_inits")
|
||||
if version < 508
|
||||
let did_proto_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink pbTodo Todo
|
||||
|
||||
HiLink pbSyntax Include
|
||||
HiLink pbStructure Structure
|
||||
HiLink pbRepeat Repeat
|
||||
HiLink pbDefault Keyword
|
||||
HiLink pbExtend Keyword
|
||||
HiLink pbRPC Keyword
|
||||
HiLink pbType Type
|
||||
HiLink pbTypedef Typedef
|
||||
HiLink pbBool Boolean
|
||||
|
||||
HiLink pbInt Number
|
||||
HiLink pbFloat Float
|
||||
HiLink pbComment Comment
|
||||
HiLink pbString String
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "proto"
|
||||
294
vimrc
294
vimrc
@@ -1,22 +1,288 @@
|
||||
call plug#begin('~/.vim/plugged')
|
||||
" ===== hasufell's vimrc ))))
|
||||
|
||||
if has('nvim')
|
||||
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||
else
|
||||
Plug 'Shougo/deoplete.nvim'
|
||||
Plug 'roxma/nvim-yarp'
|
||||
Plug 'roxma/vim-hug-neovim-rpc'
|
||||
" no ATTENTION messages when swap file is already found
|
||||
set shortmess+=A
|
||||
|
||||
let g:pymode_python = 'python3'
|
||||
let g:python_host_prog = '/usr/bin/python2'
|
||||
let g:python3_host_prog = '/usr/bin/python3'
|
||||
|
||||
" plugin stuff
|
||||
filetype plugin on
|
||||
|
||||
set backspace=indent,eol,start " backspace through everything in insert mode
|
||||
set cmdheight=1
|
||||
|
||||
" if has("gui_running")
|
||||
" autocmd GUIEnter * set vb t_vb=
|
||||
" endif
|
||||
set belloff=all
|
||||
|
||||
set wildmenu
|
||||
" set wildmode=longest,list,full
|
||||
|
||||
" plugins
|
||||
if &compatible
|
||||
set nocompatible " Be iMproved
|
||||
endif
|
||||
|
||||
Plug 'Shougo/neosnippet.vim'
|
||||
Plug 'honza/vim-snippets'
|
||||
" Required:
|
||||
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim
|
||||
|
||||
call plug#end()
|
||||
let s:toml = $HOME . '/.vim/plugins.toml'
|
||||
let g:dein#lazy_rplugins = v:false
|
||||
" Required:
|
||||
if dein#load_state($HOME . '/.cache/dein')
|
||||
call dein#begin($HOME . '/.cache/dein', [$HOME . '/.vim/vimrc', $HOME . '/.vim/plugins.toml'])
|
||||
call dein#add('wsdjeg/dein-ui.vim')
|
||||
call dein#load_toml(s:toml)
|
||||
|
||||
" Let dein manage dein
|
||||
" Required:
|
||||
call dein#add($HOME . '/.cache/dein/repos/github.com/Shougo/dein.vim')
|
||||
|
||||
" Required:
|
||||
call dein#end()
|
||||
call dein#save_state()
|
||||
endif
|
||||
filetype plugin indent on
|
||||
|
||||
" ===== further plugin initialization and default config =====
|
||||
so ~/.vim/plugged/cmdalias.vim/plugin/cmdalias.vim
|
||||
so ~/.vim/autoload/log-autocmds.vim
|
||||
|
||||
" lustyexplorer
|
||||
set hidden
|
||||
|
||||
|
||||
" Enable snipMate compatibility feature.
|
||||
let g:neosnippet#enable_snipmate_compatibility = 1
|
||||
" ==== conque ====
|
||||
" command aliases
|
||||
call CmdAlias('t','tabnew')
|
||||
" call CmdAlias('cmd','ConqueTermSplit')
|
||||
" call CmdAlias('bash','ConqueTermSplit bash<CR>')
|
||||
call CmdAlias('openall','tab sball')
|
||||
call CmdAlias('stripw','call StripTrailingWhitespaces()<CR>')
|
||||
call CmdAlias('hotkeys', 'tabnew ~/.vim/hotkeys')
|
||||
call CmdAlias('TC', 'call ToggleComment()<CR>')
|
||||
call CmdAlias('TF', 'call ToggleFoldText()<CR>')
|
||||
call CmdAlias('ctags', '!/usr/bin/ctags -R --langmap=c:.c.h --c++-kinds=+p --c-kinds=+p+x --fields=+i+a+S+t+l+m+n --extra=+q .<CR>')
|
||||
call CmdAlias('Nf', 'Neoformat')
|
||||
call CmdAlias('NF', 'Neoformat')
|
||||
call CmdAlias('nf', 'Neoformat')
|
||||
call CmdAlias('LS', 'LanguageClientStart')
|
||||
call CmdAlias('LspLog', 'lua vim.cmd("e"..vim.lsp.get_log_path())<CR>')
|
||||
|
||||
|
||||
" deoplete
|
||||
let g:deoplete#enable_at_startup = 1
|
||||
|
||||
" global settings
|
||||
if has('gui_running')
|
||||
set guioptions -=T
|
||||
|
||||
" disable gvim tab
|
||||
set guioptions-=e
|
||||
|
||||
set winaltkeys=no
|
||||
set guiheadroom=0
|
||||
else
|
||||
set termguicolors
|
||||
endif
|
||||
set foldmethod=syntax "fold based on indent
|
||||
set foldnestmax=10 "deepest fold is 10 levels
|
||||
set nofoldenable "dont fold by default
|
||||
set foldlevel=1 "this is just what i useset directory=~/.vimtmp
|
||||
set mouse=a
|
||||
set autoread
|
||||
set number
|
||||
set encoding=utf8
|
||||
set guifont=Hack\ Nerd\ Font\ Mono\ 16
|
||||
set clipboard=unnamedplus
|
||||
set textwidth=0
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set directory=~/.vimtmp
|
||||
set modeline
|
||||
set modelines=1
|
||||
set autoindent
|
||||
set laststatus=2
|
||||
|
||||
let g:nickID = 'hasufell'
|
||||
|
||||
" don't yank to buffer on deletion
|
||||
" vnoremap d "_d
|
||||
" nnoremap d "_d
|
||||
vnoremap x "_x
|
||||
nnoremap x "_x
|
||||
|
||||
" Syntax
|
||||
syntax on
|
||||
|
||||
" pane navigation
|
||||
" Use ctrl-[hjkl] to select the active split!
|
||||
let g:C_Ctrl_j = 'off'
|
||||
let g:BASH_Ctrl_j = 'off'
|
||||
|
||||
try
|
||||
lang en_US
|
||||
catch
|
||||
endtry
|
||||
|
||||
" ===========================
|
||||
|
||||
|
||||
" Disable annoying auto line break
|
||||
fu! DisableBr()
|
||||
set wrap
|
||||
set linebreak
|
||||
set nolist " list disables linebreak
|
||||
set textwidth=0
|
||||
set wrapmargin=0
|
||||
set formatoptions-=t
|
||||
endfu
|
||||
|
||||
" Disable line breaks for all file types
|
||||
au BufNewFile,BufRead *.* call DisableBr()
|
||||
|
||||
|
||||
" ==========copy/paste===========
|
||||
function! Paste(mode)
|
||||
if a:mode == 'v'
|
||||
normal gv
|
||||
normal "_d
|
||||
normal "+gP
|
||||
normal l
|
||||
elseif a:mode == 'i'
|
||||
set virtualedit=all
|
||||
normal `^"+gP
|
||||
let &virtualedit = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" ======select all=======
|
||||
function! Select()
|
||||
set virtualedit=all
|
||||
normal `^ggVG
|
||||
let &virtualedit = ''
|
||||
endfunction
|
||||
" =======================
|
||||
|
||||
|
||||
|
||||
" ====== traling whitespace =====
|
||||
fun! ShowTrailingWhitespace(pattern)
|
||||
if &ft == 'conque_term'
|
||||
call clearmatches()
|
||||
return
|
||||
endif
|
||||
if &ft == 'diff'
|
||||
call clearmatches()
|
||||
return
|
||||
endif
|
||||
let str=a:pattern
|
||||
if str == '1'
|
||||
match ExtraWhitespace /\s\+$/
|
||||
elseif str == '2'
|
||||
call clearmatches()
|
||||
" match ExtraWhitespace /\s\+\%#\@<!$/
|
||||
elseif str == '3'
|
||||
match ExtraWhitespace /\s\+$/
|
||||
endif
|
||||
endfun
|
||||
|
||||
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
match ExtraWhitespace /\s\+$/
|
||||
autocmd BufWinEnter * call ShowTrailingWhitespace('1')
|
||||
autocmd InsertEnter * call ShowTrailingWhitespace('2')
|
||||
autocmd InsertLeave * call ShowTrailingWhitespace('3')
|
||||
autocmd BufWinLeave * call clearmatches()
|
||||
|
||||
|
||||
fun! StripTrailingWhitespaces()
|
||||
let l = line(".")
|
||||
let c = col(".")
|
||||
%s/\s\+$//e
|
||||
call cursor(l, c)
|
||||
endfun
|
||||
|
||||
function! ComIfGit(com1, com2)
|
||||
silent! !git rev-parse --is-inside-work-tree
|
||||
if v:shell_error == 0
|
||||
execute a:com1
|
||||
else
|
||||
execute a:com2
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" ===========================
|
||||
|
||||
|
||||
" comment hiding
|
||||
func! IsComment( lnum )
|
||||
return synIDattr(synID(a:lnum, match(getline(a:lnum),'\S')+1, 1),'name') =~? 'comment'
|
||||
endfun
|
||||
|
||||
|
||||
"set fdm=expr
|
||||
set fde=IsComment(v:lnum)?1:IsComment(prevnonblank(v:lnum))?1:IsComment(nextnonblank\(v:lnum))?1:0
|
||||
|
||||
|
||||
" light #073642 dark #002b36 grey #586e75
|
||||
highlight Folded gui=NONE guifg=#586e75 guibg=#002b36
|
||||
set foldtext='\ '
|
||||
|
||||
|
||||
let g:folded = 0
|
||||
function! ToggleComment()
|
||||
if (g:folded == 0)
|
||||
highlight Comment guifg=#002b36
|
||||
let g:folded=1
|
||||
else
|
||||
highlight Comment guifg=#586e75
|
||||
let g:folded=0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
let g:myfoldtext = 0
|
||||
function! ToggleFoldText()
|
||||
if (g:myfoldtext == 0)
|
||||
set foldtext='--'.v:folddashes.'\ '.getline(v:foldstart).'\ '
|
||||
let g:myfoldtext=1
|
||||
else
|
||||
set foldtext='\ '
|
||||
let g:myfoldtext=0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" vim macro to jump to devhelp topics.
|
||||
""""""""""""""""""""""""""""""
|
||||
function! DevHelpCurrentWord()
|
||||
let word = expand('<cword>')
|
||||
exe '!devhelp -s ' . word . ' &'
|
||||
endfunction
|
||||
|
||||
function! ManCurrentWord()
|
||||
let word = expand('<cword>')
|
||||
exe '!man 3 ' . word
|
||||
endfunction
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" Close preview after typing
|
||||
""""""""""""""""""""""""""""""
|
||||
autocmd WinEnter * call ClosePreviewWindow()
|
||||
function ClosePreviewWindow()
|
||||
if getwinvar(winnr("#"), "&pvw") == 1
|
||||
pclose
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
set title
|
||||
autocmd BufEnter * set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:h\")})%)%(\ %a%)
|
||||
|
||||
|
||||
" vim:foldmethod=marker:foldlevel=0
|
||||
|
||||
Reference in New Issue
Block a user