Created
November 14, 2021 11:52
-
-
Save limpid-kzonix/94bacbded8f622a4bbfa79a1350be93f to your computer and use it in GitHub Desktop.
Neovim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"suggest.timeout": 500, | |
"diagnostic.enableSign": true, | |
"diagnostic.enableHighlightLineNumber": true, | |
"diagnostic.errorSign": "!!", | |
"diagnostic.warningSign": "⚠", | |
"diagnostic.infoSign": ">>", | |
"diagnostic.hintSign": ">>", | |
"codeLens.enable": true, | |
"codeLens.separator": "*", | |
"list.maxPreviewHeight": 20, | |
"coc.preferences.useQuickfixForLocations": true, | |
"coc.preferences.rootPatterns": [".git"], | |
"coc.preferences.currentFunctionSymbolAutoUpdate": true, | |
"coc.preferences.colorSupport": true, | |
"suggest.enablePreview": true, | |
"diagnostic.checkCurrentLine": true, | |
"eslint.autoFixOnSave": true, | |
"javascript.format.enabled": true, | |
"javascript.showUnused": true, | |
"coc.preferences.formatOnType": true, | |
"coc.preferences.formatOnSaveFiletypes": [ | |
"css", | |
"markdown", | |
"javascript", | |
"javascriptreact", | |
"typescript", | |
"typescriptreact" | |
], | |
"prettier.requireConfig": true, | |
"languageserver": { | |
"bash": { | |
"command": "bash-language-server", | |
"args": ["start"], | |
"filetypes": ["sh"], | |
"ignoredRootPaths": ["~"] | |
}, | |
"scry": { | |
"command": "scry", | |
"rootPatterns": ["shard.yml", ".git"], | |
"filetypes": ["crystal", "cr"] | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ----------------------------------- " | |
" ███▄ █ ██▒ █▓ ██▓ ███▄ ▄███▓" | |
" ██ ▀█ █▓ ██░ █▒ ▓██▒ ██▒▀█▀ ██▒" | |
"▓██ ▀█ ██▒ ▓██ █▒░ ▒██▒▓ ██ ▓██░" | |
"▓██▒ ▐▌██▒ ▒██ █░ ░██░▒ ██ ▒██ " | |
"▒██░ ▓██░ ▒▀█░ ░██░▒ ██▒ ░██▒" | |
"░ ▒░ ▒ ▒ ▐░ ░ ░ ▒░ ░ ░" | |
"░ ░░ ░ ▒░ ░ ░ ░ ░ ░ ░" | |
" ░ ░ ░ ░░ ░ ░ " | |
" ░ ░ ░ " | |
" ░ " | |
" ----------------------------------- " | |
call plug#begin() | |
Plug 'preservim/nerdtree' | |
Plug 'scrooloose/syntastic' | |
Plug 'tpope/vim-surround' | |
Plug 'jiangmiao/auto-pairs' | |
Plug 'machakann/vim-sandwich' | |
Plug 'tpope/vim-sleuth' | |
Plug 'editorconfig/editorconfig-vim' | |
" Plebvim lsp Plugins | |
Plug 'neovim/nvim-lspconfig' | |
Plug 'hrsh7th/cmp-nvim-lsp' | |
Plug 'hrsh7th/cmp-buffer' | |
Plug 'hrsh7th/nvim-cmp' | |
Plug 'tzachar/cmp-tabnine', { 'do': './install.sh' } | |
Plug 'onsails/lspkind-nvim' | |
" Plug 'nvim-lua/completion-nvim' | |
Plug 'glepnir/lspsaga.nvim' | |
Plug 'simrat39/symbols-outline.nvim' | |
" Plug 'tjdevries/nlua.nvim' | |
" Plug 'tjdevries/lsp_extensions.nvim' | |
Plug 'rhysd/vim-crystal' | |
Plug 'nvim-lua/plenary.nvim' | |
Plug 'nvim-telescope/telescope.nvim' | |
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } | |
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} | |
Plug 'nvim-treesitter/nvim-treesitter-refactor' | |
Plug 'romgrk/nvim-treesitter-context' | |
Plug 'nvim-treesitter/nvim-treesitter-textobjects' | |
Plug 'nvim-treesitter/playground' | |
Plug 'kyazdani42/nvim-tree.lua' | |
Plug 'TimUntersberger/neogit' | |
Plug 'lewis6991/gitsigns.nvim' | |
Plug 'tpope/vim-fugitive' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'mbbill/undotree' | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'tpope/vim-commentary' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'w0rp/ale' | |
Plug 'mfussenegger/nvim-dap' | |
Plug 'rcarriga/nvim-dap-ui' | |
Plug 'puremourning/vimspector' | |
Plug 'Mofiqul/dracula.nvim' | |
Plug 'nvim-lualine/lualine.nvim' | |
Plug 'kyazdani42/nvim-web-devicons' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
Plug 'mhinz/vim-sayonara', { 'on': 'Sayonara' } | |
call plug#end() | |
""" ---------------------------------------------------- | |
""" ----------------- basic settings ------------------- | |
""" ---------------------------------------------------- | |
set nu | |
syntax enable | |
syntax on | |
set nocompatible | |
filetype on | |
set nobackup | |
set nowritebackup | |
set noswapfile | |
set number | |
set mouse=a mousemodel=popup_setpos | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set softtabstop=4 | |
set nowrap | |
set wrap linebreak nolist | |
autocmd Filetype crystal setlocal tabstop=4 | |
set clipboard=unnamedplus | |
" set termguicolors | |
set hidden | |
set noshowmode | |
set autoread | |
" encoding, autoindent | |
set autoindent | |
set encoding=utf-8 | |
set fileencodings=utf-8 | |
set fileencoding=utf-8 | |
setlocal noswapfile | |
" Give more space for displ:aying messages. | |
set cmdheight=2 | |
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable | |
" delays and poor user experience. | |
set updatetime=300 | |
" Don't pass messages to |ins-completion-menu|. | |
set shortmess+=c | |
" Always show the signcolumn, otherwise it would shift the text each time | |
" diagnostics appear/become resolved. | |
set signcolumn=yes | |
highlight clear SignColumn | |
nmap <silent> <C-Up> :wincmd k<CR> | |
nmap <silent> <C-Down> :wincmd j<CR> | |
nmap <silent> <C-Left> :wincmd h<CR> | |
nmap <silent> <C-Right> :wincmd l<CR> | |
nmap <silent> <A-Left> :tabprev<CR> | |
nmap <silent> <A-Right> :tabnext<CR> | |
nmap <silent> <A-n> :tabnew<CR> | |
""" Theme | |
colorscheme dracula | |
""" ----------------------- Telescope -------------------------- | |
""" ------------------------------------------------------------ | |
" Find files using Telescope command-line sugar. | |
nnoremap <leader>ff <cmd>Telescope find_files<cr> | |
nnoremap <leader>fg <cmd>Telescope live_grep<cr> | |
nnoremap <leader>fb <cmd>Telescope buffers<cr> | |
nnoremap <leader>fh <cmd>Telescope help_tags<cr> | |
" Using Lua functions | |
nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr> | |
nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr> | |
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr> | |
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr> | |
""" --------------------- FZF ---------------------------------- | |
" Preview window on the upper side of the window with 40% height, | |
" hidden by default, ctrl-/ to toggle | |
function! s:fzf_statusline() | |
" Override statusline as you like | |
highlight fzf1 ctermfg=161 ctermbg=251 | |
highlight fzf2 ctermfg=23 ctermbg=251 | |
highlight fzf3 ctermfg=237 ctermbg=251 | |
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f | |
endfunction | |
autocmd! User FzfStatusLine call <SID>fzf_statusline() | |
let g:fzf_buffers_jump = 1 | |
" [[B]Commits] Customize the options used by 'git log': | |
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' | |
" [Commands] --expect expression for directly executing the command | |
let g:fzf_commands_expect = 'alt-enter,ctrl-x' | |
nnoremap <C-f> :Ag<CR> | |
nnoremap <C-r> :BLines<CR> | |
" FZF configuration | |
augroup AutoFzf | |
autocmd! FileType fzf | |
autocmd FileType fzf set laststatus=0 noshowmode noruler | |
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler | |
if has('nvim') | |
autocmd TermOpen * tnoremap <Esc> <c-\><c-n> | |
autocmd FileType fzf tunmap <Esc> | |
endif | |
augroup end | |
nmap <leader><tab> <plug>(fzf-maps-n) | |
xmap <leader><tab> <plug>(fzf-maps-x) | |
omap <leader><tab> <plug>(fzf-maps-o) | |
imap <C-x><C-k> <plug>(fzf-complete-word) | |
imap <C-x><C-f> <plug>(fzf-complete-path) | |
imap <C-x><C-j> <plug>(fzf-complete-file) | |
imap <C-x><C-l> <plug>(fzf-complete-line) | |
function! s:find_files() | |
let git_dir = system('git rev-parse --show-toplevel 2> /dev/null')[:-2] | |
if git_dir !=# '' | |
call fzf#vim#gitfiles(git_dir, fzf#vim#with_preview('right')) | |
else | |
call fzf#vim#files('.', fzf#vim#with_preview('right')) | |
endif | |
endfunction | |
command! ProjectFiles execute s:find_files() | |
nnoremap <silent> <C-p> :ProjectFiles<CR> | |
nnoremap <silent> <C-s> :BLines<CR> | |
let g:fzf_action = { | |
\ 'ctrl-t': 'tab split', | |
\ 'ctrl-x': 'split', | |
\ 'ctrl-v': 'vsplit' | |
\ } | |
let g:fzf_colors = { | |
\ 'fg': ['fg', 'Normal'], | |
\ 'bg': ['bg', 'Normal'], | |
\ 'hl': ['fg', 'Comment'], | |
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], | |
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], | |
\ 'hl+': ['fg', 'Statement'], | |
\ 'info': ['fg', 'PreProc'], | |
\ 'border': ['fg', 'Ignore'], | |
\ 'prompt': ['fg', 'Conditional'], | |
\ 'pointer': ['fg', 'Exception'], | |
\ 'marker': ['fg', 'Keyword'], | |
\ 'spinner': ['fg', 'Label'], | |
\ 'header': ['fg', 'Comment'] | |
\ } | |
" Insert mode completion | |
imap <c-x><c-k> <plug>(fzf-complete-word) | |
imap <c-x><c-j> <plug>(fzf-complete-file-ag) | |
imap <c-x><c-l> <plug>(fzf-complete-line) | |
autocmd! FileType fzf | |
autocmd FileType fzf set laststatus=0 noruler | |
\| autocmd BufLeave <buffer> set laststatus=2 ruler | |
command! -bang -nargs=* Buffers | |
\ call fzf#vim#buffers( | |
\ '', | |
\ <bang>0 ? fzf#vim#with_preview('up:60%') | |
\ : fzf#vim#with_preview('right:0%', '?'), | |
\ <bang>0) | |
command! -bang -nargs=* LinesWithPreview | |
\ call fzf#vim#grep( | |
\ 'rg --with-filename --column --line-number --no-heading --color=always --smart-case . '.fnameescape(expand('%')), 1, | |
\ fzf#vim#with_preview({}, 'up:50%', '?'), | |
\ 1) | |
command! -bang -nargs=* Ag | |
\ call fzf#vim#ag( | |
\ '', | |
\ <bang>0 ? fzf#vim#with_preview('up:60%') | |
\ : fzf#vim#with_preview('right:50%', '?'), | |
\ <bang>0) | |
command! -bang -nargs=* MRU call fzf#vim#history(fzf#vim#with_preview()) | |
command! -bang BTags | |
\ call fzf#vim#buffer_tags('', { | |
\ 'down': '40%', | |
\ 'options': '--with-nth 1 | |
\ --reverse | |
\ --prompt "> " | |
\ --preview-window="70%" | |
\ --preview " | |
\ tail -n +\$(echo {3} | tr -d \";\\\"\") {2} | | |
\ head -n 16"' | |
\ }) | |
function! RipgrepFzf(query, fullscreen) | |
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true' | |
let initial_command = printf(command_fmt, shellescape(a:query)) | |
let reload_command = printf(command_fmt, '{q}') | |
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} | |
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) | |
endfunction | |
command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0) | |
""" ---------- COC.NVIM ------------ | |
""" -------------------------------- | |
autocmd FileType json syntax match Comment +\/\/.\+$+ | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
" Use <c-space> to trigger completion. | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current | |
" position. Coc only does snippet and additional edit on confirm. | |
if exists('*complete_info') | |
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>" | |
else | |
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
endif | |
" Use `[g` and `]g` to navigate diagnostics | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
nmap <C-]> <Plug>(coc-definition) | |
nmap <silent> <C-]> <Plug>(coc-definition) | |
noremap <C-]> <Plug>(coc-definition) | |
noremap <silent> <C-]> <Plug>(coc-definition) | |
" GoTo code navigation. | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
nmap <silent> gi <Plug>(coc-implementation) | |
nmap <silent> gr <Plug>(coc-references) | |
" Use K to show documentation in preview window. | |
nnoremap <silent> K :call <SID>show_documentation()<CR> | |
function! s:show_documentation() | |
if (index(['vim','help'], &filetype) >= 0) | |
execute 'h '.expand('<cword>') | |
else | |
call CocAction('doHover') | |
endif | |
endfunction | |
" Highlight the symbol and its references when holding the cursor. | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
" Symbol renaming. | |
nmap <leader>rn <Plug>(coc-rename) | |
" Used to expand decorations in worksheets | |
nmap <Leader>ws <Plug>(coc-metals-expand-decoration) | |
" Formatting selected code. | |
xmap <leader>f <Plug>(coc-format-selected) | |
nmap <leader>f <Plug>(coc-format-selected) | |
augroup mygroup | |
autocmd! | |
" Setup formatexpr specified filetype(s). | |
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') | |
" Update signature help on jump placeholder. | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
" Setup formatexpr specified filetype(s). | |
autocmd FileType scala setl formatexpr=CocAction('formatSelected') | |
" Update signature help on jump placeholder | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
augroup end | |
" Applying codeAction to the selected region. | |
" Example: `<leader>aap` for current paragraph | |
xmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>a <Plug>(coc-codeaction-selected) | |
" Remap keys for applying codeAction to the current line. | |
nmap <leader>ac <Plug>(coc-codeaction) | |
" Apply AutoFix to problem on the current line. | |
nmap <leader>qf <Plug>(coc-fix-current) | |
" Introduce function text object | |
" NOTE: Requires 'textDocument.documentSymbol' support from the language server. | |
xmap if <Plug>(coc-funcobj-i) | |
xmap af <Plug>(coc-funcobj-a) | |
omap if <Plug>(coc-funcobj-i) | |
omap af <Plug>(coc-funcobj-a) | |
" Use <TAB> for selections ranges. | |
" NOTE: Requires 'textDocument/selectionRange' support from the language server. | |
" coc-tsserver, coc-python are the examples of servers that support it. | |
nmap <silent> <TAB> <Plug>(coc-range-select) | |
xmap <silent> <TAB> <Plug>(coc-range-select) | |
" Add `:Format` command to format current buffer. | |
command! -nargs=0 Format :call CocAction('format') | |
" Add `:Fold` command to fold current buffer. | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
" Add `:OR` command for organize imports of the current buffer. | |
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') | |
" Add (Neo)Vim's native statusline support. | |
" NOTE: Please see `:h coc-status` for integrations with external plugins that | |
" provide custom statusline: lightline.vim, vim-airline. | |
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} | |
" Mappings using CoCList: | |
" Show all diagnostics. | |
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr> | |
" Manage extensions. | |
nnoremap <silent> <space>e :<C-u>CocList extensions<cr> | |
" Show commands. | |
nnoremap <silent> <space>c :<C-u>CocList commands<cr> | |
" Find symbol of current document. | |
nnoremap <silent> <space>o :<C-u>CocList outline<cr> | |
" Search workspace symbols. | |
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr> | |
" Do default action for next item. | |
nnoremap <silent> <space>j :<C-u>CocNext<CR> | |
" Do default action for previous item. | |
nnoremap <silent> <space>k :<C-u>CocPrev<CR> | |
" Resume latest coc list. | |
nnoremap <silent> <space>p :<C-u>CocListResume<CR> | |
" Toggle panel with Tree Views | |
nnoremap <silent> <space>t :<C-u>CocCommand metals.tvp<CR> | |
" Toggle Tree View 'metalsBuild' | |
nnoremap <silent> <space>tb :<C-u>CocCommand metals.tvp metalsBuild<CR> | |
" Toggle Tree View 'metalsCompile' | |
nnoremap <silent> <space>tc :<C-u>CocCommand metals.tvp metalsCompile<CR> | |
" Reveal current current class (trait or object) in Tree View 'metalsBuild' | |
nnoremap <silent> <space>tf :<C-u>CocCommand metals.revealInTreeView metalsBuild<CR> | |
let g:coc_global_extensions = [ | |
\ 'coc-json', | |
\ 'coc-lists', | |
\ 'coc-python', | |
\ 'coc-tsserver', | |
\ 'coc-snippets', | |
\ 'coc-clangd', | |
\ 'coc-eslint', | |
\ 'coc-prettier', | |
\ 'coc-pairs', | |
\ 'coc-texlab', | |
\ 'coc-metals' | |
\ ] | |
""" ------------------------------------- | |
""" --------- /end/COC.NVIM ------------- | |
""" ------------------------------------- | |
""" ------------------------------------- | |
""" ------------ NERD Tree -------------- | |
""" ------------------------------------- | |
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 | |
nmap <C-n> :NERDTreeToggle<CR> | |
nnoremap ,, :NERDTreeFind<CR> | |
let NERDTreeAutoDeleteBuffer = 1 | |
let NERDTreeDirArrows = 1 | |
let g:NERDTreeDirArrowExpandable = '+' | |
let g:NERDTreeDirArrowCollapsible = '-' | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
let g:webdevicons_enable = 1 | |
let g:webdevicons_enable_nerdtree = 1 | |
let g:webdevicons_enable_airline_statusline = 1 | |
let g:webdevicons_enable_startify = 1 | |
let g:webdevicons_conceal_nerdtree_brackets = 1 | |
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' ' | |
let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = 'ƛ' | |
let g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol = '' | |
let g:WebDevIconsUnicodeDecorateFolderNodes = 1 | |
let g:DevIconsEnableFoldersOpenClose = 1 | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['html'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['js'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['json'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['jsx'] = 'ﰆ' | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['scala'] = 'ƛ' | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['sbt'] = 'ﰩ' | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['md'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['vim'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['yaml'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['yml'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols = {} | |
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['.*vimrc.*'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['.gitignore'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['package.json'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['package.lock.json'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['node_modules'] = '' | |
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['webpack\.'] = 'ﰩ' | |
" gitgutter | |
let g:gitgutter_override_sign_column_highlight = 0 | |
let g:gitgutter_sign_added = '┃' | |
let g:gitgutter_sign_modified = '┃' | |
let g:gitgutter_sign_removed = '┃' | |
let g:gitgutter_sign_removed_first_line = '┃' | |
let g:gitgutter_sign_modified_removed = '┃' | |
""" ------------------------------------- | |
""" --------- NERD Commenter ------------ | |
""" ------------------------------------- | |
nnoremap <C-_> :call NERDComment('Toggle', 'Toggle')<CR> | |
inoremap <C-_> <esc>:call NERDComment('Toggle', 'Toggle')<CR> | |
vnoremap <C-_> :call NERDComment('Toggle', 'Toggle')<CR>gv | |
" Add spaces after comment delimiters by default | |
let g:NERDSpaceDelims = 1 | |
" Use compact syntax for prettified multi-line comments | |
let g:NERDCompactSexyComs = 1 | |
" Align line-wise comment delimiters flush left instead of following code indentation | |
let g:NERDDefaultAlign = 'left' | |
" Set a language to use its alternate delimiters by default | |
let g:NERDAltDelims_java = 1 | |
" Add your own custom formats or override the defaults | |
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } | |
" Allow commenting and inverting empty lines (useful when commenting a region) | |
let g:NERDCommentEmptyLines = 1 | |
" Enable trimming of trailing whitespace when uncommenting | |
let g:NERDTrimTrailingWhitespace = 1 | |
" Enable NERDCommenterToggle to check all selected lines is commented or not | |
let g:NERDToggleCheckAllLines = 1 | |
""" -------------------------------------- | |
""" ----------------- ALE ---------------- | |
""" -------------------------------------- | |
let g:ale_echo_msg_error_str = 'E' | |
let g:ale_echo_msg_warning_str = 'W' | |
let g:ale_echo_msg_format = '%s [%severity%]' | |
let g:ale_sign_error = '⨉' | |
let g:ale_sign_warning = '⚠' | |
let g:ale_statusline_format = ['⨉ %d', '⚠ %d', ''] | |
let g:ale_lint_on_text_changed = 'never' | |
let g:ale_lint_on_insert_leave = 1 | |
let g:ale_completion_enabled = 1 | |
let g:ale_set_highlights = 0 | |
let g:ale_linters_explicit = 1 | |
let g:ale_warn_about_trailing_whitespace = 0 | |
let g:ale_sign_column_always = 1 | |
let g:ale_lint_on_text_changed = 'never' | |
let g:ale_lint_on_enter = 0 | |
let g:ale_list_window_size = 5 | |
" syntastic | |
set statusline+=%#warningmsg# | |
set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
" vim-crystal | |
let g:crystal_auto_format = 1 | |
" Configuration for vim-scala | |
au BufRead,BufNewFile *.sbt set filetype=scala | |
autocmd FileType json syntax match Comment +\/\/.\+$+ | |
vnoremap <leader>g :<C-u>call <SID>GrepFromSelected(visualmode())<CR> | |
nnoremap <leader>g :<C-u>set operatorfunc=<SID>GrepFromSelected<CR>g@ | |
function! s:GrepFromSelected(type) | |
let saved_unnamed_register = @@ | |
if a:type ==# 'v' | |
normal! `<v`>y | |
elseif a:type ==# 'char' | |
normal! `[v`]y | |
else | |
return | |
endif | |
let word = substitute(@@, '\n$', '', 'g') | |
let word = escape(word, '| ') | |
let @@ = saved_unnamed_register | |
execute 'CocList grep '.word | |
endfunction | |
nnoremap <silent> <space>w :exe 'CocList -I --normal --input='.expand('<cword>').' words'<CR> | |
""" Evil line - lualine configuration | |
lua << END | |
local lualine = require 'lualine' | |
-- Color table for highlights | |
-- stylua: ignore | |
local colors = { | |
bg = '#202328', | |
fg = '#bbc2cf', | |
yellow = '#ECBE7B', | |
cyan = '#008080', | |
darkblue = '#081633', | |
green = '#98be65', | |
orange = '#FF8800', | |
violet = '#a9a1e1', | |
magenta = '#c678dd', | |
blue = '#51afef', | |
red = '#ec5f67', | |
} | |
local conditions = { | |
buffer_not_empty = function() | |
return vim.fn.empty(vim.fn.expand '%:t') ~= 1 | |
end, | |
hide_in_width = function() | |
return vim.fn.winwidth(0) > 80 | |
end, | |
check_git_workspace = function() | |
local filepath = vim.fn.expand '%:p:h' | |
local gitdir = vim.fn.finddir('.git', filepath .. ';') | |
return gitdir and #gitdir > 0 and #gitdir < #filepath | |
end, | |
} | |
-- Config | |
local config = { | |
options = { | |
-- Disable sections and component separators | |
component_separators = '', | |
section_separators = '', | |
theme = { | |
-- We are going to use lualine_c an lualine_x as left and | |
-- right section. Both are highlighted by c theme . So we | |
-- are just setting default looks o statusline | |
normal = { c = { fg = colors.fg, bg = colors.bg } }, | |
inactive = { c = { fg = colors.fg, bg = colors.bg } }, | |
}, | |
}, | |
sections = { | |
-- these are to remove the defaults | |
lualine_a = {}, | |
lualine_b = {}, | |
lualine_y = {}, | |
lualine_z = {}, | |
-- These will be filled later | |
lualine_c = {}, | |
lualine_x = {}, | |
}, | |
inactive_sections = { | |
-- these are to remove the defaults | |
lualine_a = {}, | |
lualine_v = {}, | |
lualine_y = {}, | |
lualine_z = {}, | |
lualine_c = {}, | |
lualine_x = {}, | |
}, | |
} | |
-- Inserts a component in lualine_c at left section | |
local function ins_left(component) | |
table.insert(config.sections.lualine_c, component) | |
end | |
-- Inserts a component in lualine_x ot right section | |
local function ins_right(component) | |
table.insert(config.sections.lualine_x, component) | |
end | |
ins_left { | |
function() | |
return '▊' | |
end, | |
color = { fg = colors.blue }, -- Sets highlighting of component | |
padding = { left = 0, right = 1 }, -- We don't need space before this | |
} | |
ins_left { | |
-- mode component | |
function() | |
-- auto change color according to neovims mode | |
local mode_color = { | |
n = colors.red, | |
i = colors.green, | |
v = colors.blue, | |
[''] = colors.blue, | |
V = colors.blue, | |
c = colors.magenta, | |
no = colors.red, | |
s = colors.orange, | |
S = colors.orange, | |
[''] = colors.orange, | |
ic = colors.yellow, | |
R = colors.violet, | |
Rv = colors.violet, | |
cv = colors.red, | |
ce = colors.red, | |
r = colors.cyan, | |
rm = colors.cyan, | |
['r?'] = colors.cyan, | |
['!'] = colors.red, | |
t = colors.red, | |
} | |
vim.api.nvim_command('hi! LualineMode guifg=' .. mode_color[vim.fn.mode()] .. ' guibg=' .. colors.bg) | |
return '' | |
end, | |
color = 'LualineMode', | |
padding = { right = 1 }, | |
} | |
ins_left { | |
-- filesize component | |
'filesize', | |
cond = conditions.buffer_not_empty, | |
} | |
ins_left { | |
'filename', | |
cond = conditions.buffer_not_empty, | |
color = { fg = colors.magenta, gui = 'bold' }, | |
} | |
ins_left { 'location' } | |
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } } | |
ins_left { | |
'diagnostics', | |
sources = { 'nvim_lsp' }, | |
symbols = { error = ' ', warn = ' ', info = ' ' }, | |
diagnostics_color = { | |
color_error = { fg = colors.red }, | |
color_warn = { fg = colors.yellow }, | |
color_info = { fg = colors.cyan }, | |
}, | |
} | |
-- Insert mid section. You can make any number of sections in neovim :) | |
-- for lualine it's any number greater then 2 | |
ins_left { | |
function() | |
return '%=' | |
end, | |
} | |
ins_left { | |
-- Lsp server name . | |
function() | |
local msg = 'No Active Lsp' | |
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') | |
local clients = vim.lsp.get_active_clients() | |
if next(clients) == nil then | |
return msg | |
end | |
for _, client in ipairs(clients) do | |
local filetypes = client.config.filetypes | |
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then | |
return client.name | |
end | |
end | |
return msg | |
end, | |
icon = ' LSP:', | |
color = { fg = '#ffffff', gui = 'bold' }, | |
} | |
-- Add components to right sections | |
ins_right { | |
'o:encoding', -- option component same as &encoding in viml | |
fmt = string.upper, -- I'm not sure why it's upper case either ;) | |
cond = conditions.hide_in_width, | |
color = { fg = colors.green, gui = 'bold' }, | |
} | |
ins_right { | |
'fileformat', | |
fmt = string.upper, | |
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh | |
color = { fg = colors.green, gui = 'bold' }, | |
} | |
ins_right { | |
'branch', | |
icon = '', | |
color = { fg = colors.violet, gui = 'bold' }, | |
} | |
ins_right { | |
'diff', | |
-- Is it me or the symbol for modified us really weird | |
symbols = { added = ' ', modified = '柳 ', removed = ' ' }, | |
diff_color = { | |
added = { fg = colors.green }, | |
modified = { fg = colors.orange }, | |
removed = { fg = colors.red }, | |
}, | |
cond = conditions.hide_in_width, | |
} | |
ins_right { | |
function() | |
return '▊' | |
end, | |
color = { fg = colors.blue }, | |
padding = { left = 1 }, | |
} | |
-- Now don't forget to initialize lualine | |
lualine.setup(config) | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment