Latest updates to home manager config

This commit is contained in:
Salar Rahmanian 2021-02-11 19:34:44 -08:00
parent a6da359a98
commit f75b5b6171

116
home.nix
View file

@ -18,9 +18,8 @@
home.stateVersion = "20.09"; home.stateVersion = "20.09";
home.sessionVariables = { home.sessionVariables = {
EDITOR = "$HOME/bin/run-emacsclient-cli"; EDITOR = "nvim";
VISUAL = "$EDITOR"; VISUAL = "$EDITOR";
ALTERNATE_EDITOR = "nvim";
}; };
programs.git = { programs.git = {
@ -111,16 +110,21 @@
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
vimdiffAlias = true; vimdiffAlias = true;
withNodeJs = true;
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
fzf-vim
seoul256-vim
vim-polyglot
vim-gitgutter
rainbow
ack-vim ack-vim
auto-pairs auto-pairs
coc-nvim
coc-json
coc-python
coc-tabnine
fzf-vim
lightline-vim lightline-vim
rainbow
seoul256-vim
vim-fugitive vim-fugitive
vim-gitgutter
vim-polyglot
]; ];
extraConfig = '' extraConfig = ''
set t_Co=256 set t_Co=256
@ -136,6 +140,9 @@
set cmdheight=2 set cmdheight=2
set smarttab set smarttab
set linebreak set linebreak
set hlsearch
set ignorecase
set incsearch
set guifont=SF\ Mono:h12 set guifont=SF\ Mono:h12
set termguicolors set termguicolors
let g:clipboard = { let g:clipboard = {
@ -184,6 +191,7 @@
map <leader>y :Tags<cr> map <leader>y :Tags<cr>
autocmd! FileType fzf tnoremap <buffer> <leader>q <c-c> autocmd! FileType fzf tnoremap <buffer> <leader>q <c-c>
nnoremap <C-p> :FZF<CR> nnoremap <C-p> :FZF<CR>
let g:rainbow_active = 1 let g:rainbow_active = 1
let g:rainbow_conf = { let g:rainbow_conf = {
\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'], \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'],
@ -217,6 +225,94 @@
\ 'gitbranch': 'FugitiveHead' \ 'gitbranch': 'FugitiveHead'
\ }, \ },
\ } \ }
" START Configuration for coc.nvim
" --------------------------------
set nobackup
set nowritebackup
" 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)
''; '';
}; };
@ -274,6 +370,8 @@
set -xg NIX_PATH $HOME/.nix-defexpr/channels $NIX_PATH set -xg NIX_PATH $HOME/.nix-defexpr/channels $NIX_PATH
set -xg FZF_DEFAULT_OPTS "--preview='bat {} --color=always'" \n set -xg FZF_DEFAULT_OPTS "--preview='bat {} --color=always'" \n
set -xg TOOLCHAINS swift
''; '';
promptInit = '' promptInit = ''
@ -287,7 +385,7 @@
ping="prettyping"; ping="prettyping";
".." = "cd .."; ".." = "cd ..";
pj="python -m json.tool"; pj="python -m json.tool";
k="exa --long --header --git --all"; l="exa --long --header --git --all";
g="git"; g="git";
gl="git log"; gl="git log";
gc="git commit -m"; gc="git commit -m";
@ -310,6 +408,7 @@
tabninecfg="vc /Users/salar/Library/Preferences/TabNine/TabNine.toml"; tabninecfg="vc /Users/salar/Library/Preferences/TabNine/TabNine.toml";
sshfre1="ssh salar@fre1.softinio.net"; sshfre1="ssh salar@fre1.softinio.net";
moshfre1="mosh salar@fre1.softinio.net"; moshfre1="mosh salar@fre1.softinio.net";
sshls1="ssh -i pem/LightsailDefaultKey-us-west-2.pem admin@52.42.3.248";
portsupdate="sudo port -v selfupdate"; portsupdate="sudo port -v selfupdate";
emacsload="launchctl load -w ~/Library/LaunchAgents/gnu.emacs.daemon.plist"; emacsload="launchctl load -w ~/Library/LaunchAgents/gnu.emacs.daemon.plist";
emacsunload="launchctl unload ~/Library/LaunchAgents/gnu.emacs.daemon.plist"; emacsunload="launchctl unload ~/Library/LaunchAgents/gnu.emacs.daemon.plist";
@ -392,5 +491,6 @@
pkgs.hyperfine pkgs.hyperfine
pkgs.graphviz pkgs.graphviz
pkgs.metals pkgs.metals
pkgs.neofetch
]; ];
} }