Skip to content

Commit

Permalink
Merge pull request #7 from PrashanthaTP/v2.0.0
Browse files Browse the repository at this point in the history
Version 2.0.0
  • Loading branch information
PrashanthaTP authored Sep 1, 2021
2 parents a894c93 + 0823d51 commit efdd5fd
Show file tree
Hide file tree
Showing 13 changed files with 291 additions and 86 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

---

Configuration files for windows applications
Configuration files for different applications (_in windows_)

- Nvim
[![Vim](https://img.shields.io/badge/VIM-%2311AB00.svg?&style=for-the-badge&logo=vim&logoColor=white)](https://www.vim.org/)
[![Neovim](https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)](https://neovim.io/)
[![Bash](https://img.shields.io/badge/Shell_Script-121011?style=for-the-badge&logo=gnu-bash&logoColor=white)](https://www.gnu.org/software/bash/)

## Fonts

_(Nerd Fonts Needed)_

My favourites

- Operator Mono
- Fira Code
- Source Code Pro
27 changes: 22 additions & 5 deletions nvim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,26 @@

My setup for various applications.

## nvim 🚀
## nvim :rocket:

- with language support for cpp and python
- for coc
- `:CocCommand clangd.install ` (make sure clangd path is added to `:CocConfig`)
- `:CocInstall coc-clangd coc-css coc-emmet coc-eslint coc-html coc-java coc-jedi coc-json coc-lua coc-pairs coc-prettier coc-pyright coc-snippets coc-tsserver coc-vimlsp `
### COC : Conquer of Completion

- `:CocCommand clangd.install ` (make sure clangd path is added to `:CocConfig`)
- `:CocInstall coc-clangd coc-css coc-emmet coc-eslint coc-html coc-java coc-jedi coc-json coc-lua coc-pairs coc-prettier coc-pyright coc-snippets coc-tsserver coc-vimlsp `
- quick tip :
you can move to floating window using `C-w` commands

### Firenvim

#### Installation

- first follow installation instruction here : https://github.com/glacambre/firenvim
- to setup config jsons run
```bash
$ nvim --headless "+call firenvim#install(0) | q"
#or inside neovim
:call firenvim#install(0)
```
- to allow only specific websites, follow here : https://github.com/glacambre/firenvim/issues/321
- set shortcut inside chrome://extensions/shortcuts for firenvim on focus
- other troubleshootings : https://github.com/glacambre/firenvim/blob/master/TROUBLESHOOTING.md
59 changes: 59 additions & 0 deletions nvim/general/augroups.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""
"Auto Commands
"""
" trim trailing whitespace ----- {{{
"https://vi.stackexchange.com/a/456
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun

augroup TRIM_WHITESPACE
autocmd!
autocmd BufWritePre * if !&binary && &ft !=# 'mail'
\| call TrimWhitespace()
\| endif
augroup END
" }}}

" persistent folding state --- {{{
augroup REMEMBER_FOLDS
autocmd!
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent! loadview
augroup END
" --- }}}

" Cursor management --- {{{
"https://github.com/microsoft/terminal/issues/4335
"
" https//vim.fandom.com/wiki/Configuring_the_cursor
" 1 or 0 -> blinking block
" 2 solid block
" 3 -> blinking underscore
" 4 solid underscore
" Recent versions of xterm (282 or above) also support
" 5 -> blinking vertical bar
" 6 -> solid vertical bar
"
augroup CURSOR_MANAGEMENT
autocmd!

" powershell requires different format for escape codes
" see :
" (i) https://docs.microsoft.com/en-us/powershell/module/psreadline/set-psreadlineoption?view=powershell-5.1#example-6--use-vimodechangehandler-to-display-vi-mode-changes
" (ii) https://github.com/microsoft/terminal/issues/1604
if has('win32')
"https://github.com/neovim/neovim/issues/4867#issuecomment-291249173"
autocmd VimEnter * silent !echo -ne "\e[2 q"
autocmd VimLeave * set guicursor=a:ver25

else
autocmd VimEnter * silent !echo -ne "\e[2 q"
autocmd VimLeave * silent !echo -ne "\e[6 q"
" autocmd VimLeave * let &t_me="\<Esc>]50;CursorShape=1\x7"
" autocmd VimLeave * let &t_SI.="\<Esc>[6 q"
endif
augroup END
" }}
25 changes: 25 additions & 0 deletions nvim/general/colorscheme_settings.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
let g:colorscheme='default'
" gruvbox ----- {{{
if (has("termguicolors"))
set termguicolors
endif
set background=dark
" colorscheme gruvbox
" au Colorscheme gruvbox :hi Keyword gui=italic cterm=italic
"https://github.com/sainnhe/gruvbox-material/blob/master/doc/gruvbox-material.txt
"soft,medium,hard
"let g:gruvbox_material_background = 'medium'
let g:gruvbox_material_transparent_background = 1
let g:gruvbox_material_enable_bold = 1
let g:gruvbox_material_enable_italic = 1
"let g:gruvbox_material_statusline_style = 'original'
let g:gruvbox_material_diagnostic_virtual_text = 'colored'
let g:gruvbox_material_better_performance = 1
"configuration must be dont before applying colorscheme
"
"if &filetype!='gitcommit'
colorscheme gruvbox-material
"endif

" }}}

23 changes: 23 additions & 0 deletions nvim/general/cursor.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
" also see augroups.vim
" cursor ----- {{{
" Cursor in terminal
" https//vim.fandom.com/wiki/Configuring_the_cursor
" 1 or 0 -> blinking block
" 2 solid block
" 3 -> blinking underscore
" 4 solid underscore
" Recent versions of xterm (282 or above) also support
" 5 -> blinking vertical bar
" 6 -> solid vertical bar
if &term =~ '^xterm'
" normal mode ||
" .= means shorthand for appending : see help .=
let &t_EI .= "\<Esc>[1 q"
" replace mode _
let &t_SR .= "\e[4 q"
" insert mode |
let &t_SI .= "\<Esc>[6 q"
endif
"
" }}}

28 changes: 18 additions & 10 deletions nvim/general/general.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
set mouse=a
" CLIPBOARD ----- {{{
"vim clipboard and system clipboard same now
set clipboard^=unnamed
set clipboard^=unnamed

"wrap backspace
set backspace=indent,eol,start
"https://stackoverflow.com/a/53872985/12988588
"dont save character deleted using `x`
"send it to The blackhole-register
nnoremap x "_x
set autochdir
" }}}

Expand All @@ -19,16 +27,20 @@ set tabstop=4
set softtabstop=4
set shiftwidth=4
set number relativenumber
" Show white spaces https://gist.github.com/jdavid82/d40f40e6f124aad6223eba0ff0c7ad65#file-vimrc-L37-L39
set scrolloff=8
"set colorcolumn=80
" Show white spaces https://gist.github.com/jdavid82/d40f40e6f124aad6223eba0ff0c7ad65#file-vimrc-L37-L39
"set listchars=tab:>·,trail:~,extends:>,precedes:<,space:·
"set list
" }}}
"

" SEARCHING ----- {{{
set nohlsearch
set incsearch "on by default"
" clear last used search pattern:http://vimdoc.sourceforge.net/htmldoc/pattern.html#last-pattern
let @/=""
"
let @/=""
" }}}

" FOLDING ----- {{{
Expand All @@ -38,12 +50,7 @@ set foldmethod=marker
" }}}

" BUFFERS ----- {{{
" remember foldings
augroup remember_folds
autocmd!
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent! loadview
augroup END
" remember foldings is nvim/general/augroups.vim
" }}}

" SPLITS ----- {{{
Expand All @@ -56,7 +63,7 @@ nnoremap <C-H> <C-W><C-H>
"}}}

" wildmenu ----- {{{

" Nice menu when typing `:find *.py`
set wildmode=longest,list,full
set wildmenu
Expand Down Expand Up @@ -97,3 +104,4 @@ set shortmess+=c
" if has('gui_running')
" set guioptions-=e
" endif

27 changes: 27 additions & 0 deletions nvim/general/git.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function Set_git_settings()
"colorscheme gruvbox
"below line is important : gruvbox-material doesn't work
let g:lightline.colorscheme='gruvbox'
endfunction

if &diff
set nornu
"https://stackoverflow.com/questions/2019281/load-different-colorscheme-when-using-vimdiff
" highlight! DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
" highlight! DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
" highlight! DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
" highlight! DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red
" Fix the difficult-to-read default setting for diff text highlighting. The
" bang (!) is required since we are overwriting the DiffText setting. The highlighting
" for \"Todo" also looks nice (yellow) if you don't like the \"MatchParen" colors.
highlight! link DiffText MatchParen

:call Set_git_settings()
endif


augroup GITCOMMIT_SETTINGS
"https://vi.stackexchange.com/questions/4343/can-i-detect-whether-current-vim-instance-is-launched-by-git
autocmd!
autocmd FileType gitcommit silent :call Set_git_settings()
augroup END
6 changes: 3 additions & 3 deletions nvim/general/keybindings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inoremap jk <ESC>

" yanking ----- {{{
"to match the behaviour of 'C' and 'D'
nnoremap Y y$
nnoremap Y y$
"highlight the yanked area for an extened period
augroup highlight_yank
autocmd!
Expand All @@ -22,7 +22,7 @@ nnoremap N Nzz
"
" breakpoints ----- {{{
"puts the next line at the end of current line : mz = create a mark called z , do J, `z = goto mark z
nnoremap J mzJ`z
nnoremap J mzJ`z
"undo breakpoints
inoremap . .<C-g>u
inoremap , ,<C-g>u
Expand All @@ -31,7 +31,7 @@ inoremap ? ?<C-g>u
" }}}
"
" moving lines with ALT key ----- {{{
"https://vim.fandom.com/wiki/Moving_lines_up_or_down
"https://vim.fandom.com/wiki/Moving_lines_up_or_down
nnoremap <A-j> :m .+1<CR>==
nnoremap <A-k> :m .-2<CR>==
inoremap <A-j> <Esc>:m .+1<CR>==gi
Expand Down
10 changes: 9 additions & 1 deletion nvim/general/leader.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ nmap <leader>so :e $LOCALAPPDATA/nvim/init.vim<CR>
nnoremap <leader>n :bnext<CR>
nnoremap <leader>p :bprev<CR>
nnoremap <leader>b :buffers<CR>
" splits ----- {{{
nnoremap <leader>w <C-W>w
nnoremap <leader>h <C-W>h
nnoremap <leader>l <C-W>l
nnoremap <leader>j <C-W>j
nnoremap <leader>k <C-W>k
"
nnoremap <silent> <Leader>r= <C-w>=<CR>
nnoremap <silent> <Leader>= :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
nnoremap <silent> <Leader>0 :exe "vertical resize " . (winwidth(0) * 3/2)<CR>
nnoremap <silent> <Leader>9 :exe "vertical resize " . (winwidth(0) * 2/3)<CR>
" }}}

"nmap <leader>ws :

16 changes: 12 additions & 4 deletions nvim/init.vim
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
let mapleader = "\<Space>"

source $LOCALAPPDATA/nvim/general/augroups.vim
source $LOCALAPPDATA/nvim/plugs/plugins.vim
source $LOCALAPPDATA/nvim/general/colorscheme_settings.vim
source $LOCALAPPDATA/nvim/plugs/coc.vim
source $LOCALAPPDATA/nvim/plugs/lightline_v1.vim
source $LOCALAPPDATA/nvim/plugs/telescope_plug.vim
source $LOCALAPPDATA/nvim/plugs/firenvim.vim
source $LOCALAPPDATA/nvim/plugs/markdown.vim

source $LOCALAPPDATA/nvim/general/cursor.vim
source $LOCALAPPDATA/nvim/general/general.vim
source $LOCALAPPDATA/nvim/general/leader.vim
source $LOCALAPPDATA/nvim/general/keybindings.vim

source $LOCALAPPDATA/nvim/languages/languages.vim
"set path+=*

source $LOCALAPPDATA/nvim/general/git.vim

"set path+=**
hi Normal ctermbg=none guibg=none
"wrap backspace
set backspace=indent,eol,start
hi Comment gui=italic cterm=italic
hi htmlArg gui=italic cterm=italic

31 changes: 25 additions & 6 deletions nvim/plugs/coc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if has("nvim-0.5.0") || has("patch-8.1.1564")
else
set signcolumn=yes
endif

" 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.
Expand Down Expand Up @@ -64,8 +64,9 @@ autocmd CursorHold * silent call CocActionAsync('highlight')
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" f starts in telescope settings
" xmap <leader>f <Plug>(coc-format-selected)
" nmap <leader>f <Plug>(coc-format-selected)

augroup mygroup
autocmd!
Expand All @@ -81,9 +82,9 @@ xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
nmap <leader>ca <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
nmap <leader>cf <Plug>(coc-fix-current)
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
Expand All @@ -102,6 +103,24 @@ command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organize
" 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','')}
"set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

"nnoremap <silent> <leader>q :call CocAction('diagnosticInfo') <CR>
" Using CocList
" Show all diagnostics
nnoremap <silent> <space>cl :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent> <space>ce :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent> <space>cc :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent> <space>co :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent> <space>cs :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent> <space>cj :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent> <space>ck :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent> <space>cp :<C-u>CocListResume<CR>
"
Loading

0 comments on commit efdd5fd

Please sign in to comment.