Code cleanup to make modular part1

This commit is contained in:
Salar Rahmanian 2021-04-11 23:31:11 -07:00
parent 9d593e70b7
commit 0e58ff36eb
11 changed files with 435 additions and 418 deletions

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>gnu.emacs.daemon</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Emacs.app/Contents/MacOS/Emacs</string>
<string>--daemon</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>salar</string>
</dict>
</plist>

383
home.nix
View file

@ -4,22 +4,16 @@
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
home.username = "salar"; imports = (import ./programs);
home.homeDirectory = "/Users/salar";
# This value determines the Home Manager release that your home = {
# configuration is compatible with. This helps avoid breakage username = "salar";
# when a new Home Manager release introduces backwards homeDirectory = "/Users/salar";
# incompatible changes. stateVersion = "21.05";
# sessionVariables = {
# You can update Home Manager without changing this value. See EDITOR = "nvim";
# the Home Manager release notes for a list of state version VISUAL = "$EDITOR";
# changes in each release. };
home.stateVersion = "21.05";
home.sessionVariables = {
EDITOR = "nvim";
VISUAL = "$EDITOR";
}; };
programs.bat = { programs.bat = {
@ -43,52 +37,6 @@
gitProtocol = "ssh"; gitProtocol = "ssh";
}; };
programs.git = {
enable = true;
userEmail = "code@softinio.com";
userName = "Salar Rahmanian";
ignores = [
"*~"
".DS_Store"
"*.bloop"
"*.metals"
"*.metals.sbt"
"*metals.sbt"
"*.direnv"
"*.envrc" # there is lorri, nix-direnv & simple direnv; let people decide
"*hie.yaml" # ghcide files
"*.mill-version" # used by metals
"*.idea"
"*.vscode"
"*.python-version"
];
extraConfig = {
core = {
editor = "nvim";
};
github.user = "softinio";
merge.tool = "intellij";
mergetool = {
cmd = "idea merge \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"";
trustExitCode = true;
prompt = false;
};
diff.tool = "intellij";
difftool = {
cmd = "idea diff \"$LOCAL\" \"$REMOTE\"";
prompt = false;
};
url = {
"git@github.com:" = {
insteadOf = "https://github.com/";
};
};
pull = {
rebase = true;
};
};
};
programs.htop = { programs.htop = {
enable = true; enable = true;
sortDescending = true; sortDescending = true;
@ -106,319 +54,6 @@
}; };
}; };
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
plugins = with pkgs.vimPlugins; [
ack-vim
auto-pairs
coc-nvim
coc-java
coc-json
coc-metals
coc-python
coc-tabnine
fzf-vim
git-messenger-vim
lightline-vim
nerdtree
nerdtree-git-plugin
rainbow
seoul256-vim
split-term-vim
vim-fugitive
vim-gitgutter
vim-polyglot
];
extraConfig = ''
set directory=$HOME/.vim/swapfiles/swap//
set undodir=~/.vim/swapfiles/undo//
set backupdir=~/.vim/swapfiles/backup//
" Make those folders automatically if they don't already exist.
if !isdirectory(expand(&undodir))
call mkdir(expand(&undodir), "p")
endif
if !isdirectory(expand(&backupdir))
call mkdir(expand(&backupdir), "p")
endif
if !isdirectory(expand(&directory))
call mkdir(expand(&directory), "p")
endif
set t_Co=256
set encoding=utf-8
syntax on
set expandtab
set hidden
set showmatch
set colorcolumn=120
set cursorcolumn
set cursorline
set cmdheight=2
set smarttab
set linebreak
set hlsearch
set ignorecase
set incsearch
set guifont=SF\ Mono:h12
set termguicolors
let g:clipboard = {
\ 'name': 'pbcopy',
\ 'copy': {
\ '+': 'pbcopy',
\ '*': 'pbcopy',
\ },
\ 'paste': {
\ '+': 'pbpaste',
\ '*': 'pbpaste',
\ },
\ 'cache_enabled': 0,
\ }
set clipboard=unnamed
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
let g:seoul256_background = 233
let g:seoul256_srgb = 1
colorscheme seoul256
set background=dark
set number
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
let g:netrw_list_hide= '.*\.pyc$'
au BufRead,BufNewFile *.sbt set filetype=scala
if executable("rg")
set grepprg=rg\ --vimgrep\ --no-heading
set grepformat=%f:%l:%c:%m,%f:%l:%m
endif
let g:ackprg='rg --vimgrep --no-heading'
set grepprg=rg\ --vimgrep
let g:rg_command = 'rg --vimgrep -S'
let mapleader = "\<space>"
map! jj <ESC>
" FZF
set rtp+=/Users/salar/.nix-profile/bin/fzf
imap <c-x><c-o> <plug>(fzf-complete-line)
map <leader>b :Buffers<cr>
map <leader>f :Files<cr>
map <leader>g :GFiles<cr>
map <leader>y :Tags<cr>
autocmd! FileType fzf tnoremap <buffer> <leader>q <c-c>
nnoremap <C-p> :FZF<CR>
let g:rainbow_active = 1
let g:rainbow_conf = {
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'],
\ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'],
\ 'operators': '_,_',
\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'],
\ 'separately': {
\ '*': {},
\ 'tex': {
\ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/'],
\ },
\ 'lisp': {
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'],
\ },
\ 'vim': {
\ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'],
\ },
\ 'html': {
\ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=#</\z1># fold'],
\ },
\ 'css': 0,
\ }
\}
let g:lightline = {
\ 'colorscheme': 'seoul256',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }
" Nerdtree Configuration
let NERDTreeIgnore=['\.pyc$', '\~$', 'target'] "ignore files in NERDTree
let NERDTreeRespectWildIgnore=1
let NERDTreeQuitOnOpen=1
map <leader>m :NERDTreeToggle<CR>
" jump back to nerdtree
map <leader>n :NERDTree<CR>
" reveal in side bar
map <leader>e :NERDTreeFind<CR>
let NERDTreeShowHidden=1
"nerdtree-git-plugin
let g:NERDTreeGitStatusIndicatorMapCustom= {
\ "Modified" : "",
\ "Staged" : "",
\ "Untracked" : "",
\ "Renamed" : "",
\ "Unmerged" : "",
\ "Deleted" : "",
\ "Dirty" : "",
\ "Clean" : "",
\ "Unknown" : "?"
\ }
" Switch to previous buffer mapped to tab
function SwitchBuffer()
b#
endfunction
nmap <A-Tab> :call SwitchBuffer()<CR>
" split-term
let g:split_term_default_shell = "fish"
let g:split_term_vertical = 1
" START Configuration for coc.nvim
" --------------------------------
" Better display for messages
set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
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.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
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 symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for format selected region
xmap <leader>l <Plug>(coc-format-selected)
nmap <leader>l <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json,scala setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <leader>qf <Plug>(coc-fix-current)
" Create mappings for function text object, requires document symbols feature of languageserver.
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 select selections ranges, needs server support, like: coc-tsserver, coc-python
nmap <silent> <TAB> <Plug>(coc-range-select)
xmap <silent> <TAB> <Plug>(coc-range-select)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" 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>
" Notify coc.nvim that <enter> has been pressed.
" Currently used for the formatOnType feature.
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<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>
nmap <Leader>ws <Plug>(coc-metals-expand-decoration)
'';
};
programs.fish = { programs.fish = {
enable = true; enable = true;

4
programs/default.nix Normal file
View file

@ -0,0 +1,4 @@
[
./git
./neovim
]

52
programs/git/default.nix Normal file
View file

@ -0,0 +1,52 @@
{ config, pkgs, ... }:
let
gitConfig = {
core = {
editor = "nvim";
pager = "diff-so-fancy | less --tabs=4 -RFX";
};
merge.tool = "intellij";
mergetool = {
cmd = "idea merge \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"";
trustExitCode = true;
prompt = false;
};
diff.tool = "intellij";
difftool = {
cmd = "idea diff \"$LOCAL\" \"$REMOTE\"";
prompt = false;
};
url = {
"git@github.com:" = {
insteadOf = "https://github.com/";
};
};
pull = {
rebase = true;
};
};
in
{
programs.git = {
enable = true;
userEmail = "code@softinio.com";
userName = "Salar Rahmanian";
ignores = [
"*~"
".DS_Store"
"*.bloop"
"*.metals"
"*.metals.sbt"
"*metals.sbt"
"*.direnv"
"*.envrc" # there is lorri, nix-direnv & simple direnv; let people decide
"*hie.yaml" # ghcide files
"*.mill-version" # used by metals
"*.idea"
"*.vscode"
"*.python-version"
];
extraConfig = gitConfig;
};
}

View file

@ -0,0 +1,8 @@
{
"languageserver" = {
"nix" = {
"command" = "rnix-lsp";
"filetypes" = [ "nix" ];
};
};
}

138
programs/neovim/coc.vim Normal file
View file

@ -0,0 +1,138 @@
" START Configuration for coc.nvim
" --------------------------------
" Better display for messages
set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
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.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
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 symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for format selected region
xmap <leader>l <Plug>(coc-format-selected)
nmap <leader>l <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json,scala setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <leader>qf <Plug>(coc-fix-current)
" Create mappings for function text object, requires document symbols feature of languageserver.
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 select selections ranges, needs server support, like: coc-tsserver, coc-python
nmap <silent> <TAB> <Plug>(coc-range-select)
xmap <silent> <TAB> <Plug>(coc-range-select)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" 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>
" Notify coc.nvim that <enter> has been pressed.
" Currently used for the formatOnType feature.
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<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>
nmap <Leader>ws <Plug>(coc-metals-expand-decoration)

154
programs/neovim/config.vim Normal file
View file

@ -0,0 +1,154 @@
set directory=$HOME/.vim/swapfiles/swap//
set undodir=~/.vim/swapfiles/undo//
set backupdir=~/.vim/swapfiles/backup//
" Make those folders automatically if they don't already exist.
if !isdirectory(expand(&undodir))
call mkdir(expand(&undodir), "p")
endif
if !isdirectory(expand(&backupdir))
call mkdir(expand(&backupdir), "p")
endif
if !isdirectory(expand(&directory))
call mkdir(expand(&directory), "p")
endif
set t_Co=256
set encoding=utf-8
syntax on
set expandtab
set hidden
set showmatch
set colorcolumn=120
set cursorcolumn
set cursorline
set cmdheight=2
set smarttab
set linebreak
set hlsearch
set ignorecase
set incsearch
set guifont=SF\ Mono:h12
set termguicolors
let g:clipboard = {
\ 'name': 'pbcopy',
\ 'copy': {
\ '+': 'pbcopy',
\ '*': 'pbcopy',
\ },
\ 'paste': {
\ '+': 'pbpaste',
\ '*': 'pbpaste',
\ },
\ 'cache_enabled': 0,
\ }
set clipboard=unnamed
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
let g:seoul256_background = 233
let g:seoul256_srgb = 1
colorscheme seoul256
set background=dark
set number
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
let g:netrw_list_hide= '.*\.pyc$'
au BufRead,BufNewFile *.sbt set filetype=scala
if executable("rg")
set grepprg=rg\ --vimgrep\ --no-heading
set grepformat=%f:%l:%c:%m,%f:%l:%m
endif
let g:ackprg='rg --vimgrep --no-heading'
set grepprg=rg\ --vimgrep
let g:rg_command = 'rg --vimgrep -S'
let mapleader = "\<space>"
map! jj <ESC>
" FZF
set rtp+=/Users/salar/.nix-profile/bin/fzf
imap <c-x><c-o> <plug>(fzf-complete-line)
map <leader>b :Buffers<cr>
map <leader>f :Files<cr>
map <leader>g :GFiles<cr>
map <leader>y :Tags<cr>
autocmd! FileType fzf tnoremap <buffer> <leader>q <c-c>
nnoremap <C-p> :FZF<CR>
let g:rainbow_active = 1
let g:rainbow_conf = {
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'],
\ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'],
\ 'operators': '_,_',
\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'],
\ 'separately': {
\ '*': {},
\ 'tex': {
\ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/'],
\ },
\ 'lisp': {
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'],
\ },
\ 'vim': {
\ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'],
\ },
\ 'html': {
\ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=#</\z1># fold'],
\ },
\ 'css': 0,
\ }
\}
let g:lightline = {
\ 'colorscheme': 'seoul256',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }
" Nerdtree Configuration
let NERDTreeIgnore=['\.pyc$', '\~$', 'target'] "ignore files in NERDTree
let NERDTreeRespectWildIgnore=1
let NERDTreeQuitOnOpen=1
map <leader>m :NERDTreeToggle<CR>
" jump back to nerdtree
map <leader>n :NERDTree<CR>
" reveal in side bar
map <leader>e :NERDTreeFind<CR>
let NERDTreeShowHidden=1
"nerdtree-git-plugin
let g:NERDTreeGitStatusIndicatorMapCustom= {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ "Unknown" : "?"
\ }
" Switch to previous buffer mapped to tab
function SwitchBuffer()
b#
endfunction
nmap <A-Tab> :call SwitchBuffer()<CR>
" split-term
let g:split_term_default_shell = "fish"
let g:split_term_vertical = 1
" mkdx settings
let g:mkdx#settings = { 'highlight': { 'enable': 1 },
\ 'enter': { 'shift': 1 },
\ 'links': { 'external': { 'enable': 1 } },
\ 'toc': { 'text': 'Table of Contents', 'update_on_write': 1 },
\ 'fold': { 'enable': 1 } }
let g:polyglot_disabled = ['markdown']

View file

@ -0,0 +1,12 @@
{ buildVimPlugin }:
{
asyncrun-vim = buildVimPlugin {
name = "asyncrun-vim";
src = builtins.fetchTarball {
name = "AsyncRun-Vim-v2.7.5";
url = "https://github.com/skywind3000/asyncrun.vim/archive/2.7.5.tar.gz";
sha256 = "02fiqf4rcrxbcgvj02mpd78wkxsrnbi54aciwh9fv5mnz5ka249m";
};
};
}

View file

@ -0,0 +1,58 @@
{ config, lib, pkgs, ... }:
let
custom-plugins = pkgs.callPackage ./custom-plugins.nix {
inherit (pkgs.vimUtils) buildVimPlugin;
};
plugins = pkgs.vimPlugins // custom-plugins;
overriddenPlugins = with pkgs; [];
myVimPlugins = with plugins; [
asyncrun-vim
ack-vim
coc-nvim
coc-java
coc-json
coc-metals
coc-pairs
coc-python
coc-tabnine
fzf-vim
git-messenger-vim
lightline-vim
nerdtree
nerdtree-git-plugin
rainbow
seoul256-vim
split-term-vim
vim-fugitive
vim-gitgutter
vim-polyglot
] ++ overriddenPlugins;
baseConfig = builtins.readFile ./config.vim;
cocConfig = builtins.readFile ./coc.vim;
cocSettings = builtins.toJSON (import ./coc-settings.nix);
vimConfig = baseConfig + cocConfig;
in
{
programs.neovim = {
enable = true;
extraConfig = vimConfig;
plugins = myVimPlugins;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true; # for coc.nvim
withPython = true; # for plugins
withPython3 = true; # for plugins
};
xdg.configFile = {
"nvim/coc-settings.json".text = cocSettings;
};
}

View file

@ -1,18 +0,0 @@
#!/usr/bin/env bash
if [ -z "$EMACSCLIENT_OPTS" ]; then
EMACSCLIENT_OPTS="-nc"
fi
if [ $# -eq 0 ]; then
COMMAND='/Users/salar/.nix-profile/bin/emacsclient '$EMACSCLIENT_OPTS' -e "(if (display-graphic-p) (x-focus-frame nil))"'
else
COMMAND='/Users/salar/.nix-profile/bin/emacsclient '$EMACSCLIENT_OPTS' "$@"'
fi
if [ -z "$(shopt | grep login_shell)" ]; then
echo "$COMMAND" | exec bash --login -s "$@"
else
eval "exec $COMMAND"
fi

View file

@ -1,5 +0,0 @@
#!/usr/bin/env bash
export EMACSCLIENT_OPTS='-t'
exec run-emacsclient "$@"