Skip to content

Commit

Permalink
Merge pull request #2 from PrashanthaTP/version-1.1.0-rc-1
Browse files Browse the repository at this point in the history
Version 1.1.0 rc 1
  • Loading branch information
PrashanthaTP authored Aug 16, 2021
2 parents 6da4403 + 8074a25 commit a894c93
Show file tree
Hide file tree
Showing 12 changed files with 474 additions and 141 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# My Dotfiles

---

Configuration files for windows applications

- Nvim
12 changes: 12 additions & 0 deletions nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# My Dotfiles ![](https://img.shields.io/badge/config%20for-nvim-blue?style=for-the-badge)

---

My setup for various applications.

## nvim 🚀

- 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 `
34 changes: 34 additions & 0 deletions nvim/coc-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"coc.preferences.formatOnSaveFiletypes": [
"css",
"markdown",
"javascript",
"graphql",
"html",
"yaml",
"json",
"python"
],

// python config
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,

"diagnostic.checkCurrentLine": true,
//"diagnostic.enableMessage": "jump",
"jedi.hover.enable": true,
"hover.target": "float",
"clangd.path": "C:\\Users\\Prashanth T P\\AppData\\Local\\coc\\extensions\\coc-clangd-data\\install\\12.0.1\\clangd_12.0.1\\bin\\clangd.exe",
//html
"html.autoClosingTags": true,
"html.filetypes": ["html", "javascript", "handlebars", "htmldjango", "blade"],
"html.enable": true,
"snippets.extends": {

"cpp": ["c"],
"javascript":["html"],
"javascriptreact": ["javascript"],
"typescript": ["javascript"]
}

}
51 changes: 45 additions & 6 deletions nvim/general/general.vim
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
"General Settings
set mouse=a
" CLIPBOARD ----- {{{
"vim clipboard and system clipboard same now
set clipboard^=unnamed
set autochdir
" }}}

" MODES ----- {{{
"use jk in insert mode to switch to normal mode
imap jk <ESC>
" }}}

" EDITOR ----- {{{
syntax on
" filetype on
" filetype plugin on
" filetype indent on
set ignorecase
set smartcase
" use 4 spaces for tabs
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 listchars=tab:>·,trail:~,extends:>,precedes:<,space:·
"set list
" }}}
"

" SEARCHING ----- {{{
set nohlsearch
Expand All @@ -30,8 +41,8 @@ set foldmethod=marker
" remember foldings
augroup remember_folds
autocmd!
autocmd BufWinLeave * mkview
autocmd BufWinEnter * silent! loadview
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent! loadview
augroup END
" }}}

Expand All @@ -58,3 +69,31 @@ set wildignore+=**/android/*
set wildignore+=**/ios/*
set wildignore+=**/.git/*
" }}}

" coc needs it----- {{{
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
" unicode characters in the file autoload/float.vim
set encoding=utf-8

" TextEdit might fail if hidden is not set.
set hidden

" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup

" Give more space for displaying messages.
set cmdheight=2

" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
set ttimeoutlen=0
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" }}}
" " show tabline
" set showtabline=2
" if has('gui_running')
" set guioptions-=e
" endif
49 changes: 49 additions & 0 deletions nvim/general/keybindings.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
" MODES ----- {{{
"use jk in insert mode to switch to normal mode
inoremap jk <ESC>
" }}}

" yanking ----- {{{
"to match the behaviour of 'C' and 'D'
nnoremap Y y$
"highlight the yanked area for an extened period
augroup highlight_yank
autocmd!
au TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=300}
augroup END
" }}}

" searching : the primeagen : top 5 keybindings ----- {{{
"put the cursor at screen center while going to next search result
nnoremap n nzz
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
"undo breakpoints
inoremap . .<C-g>u
inoremap , ,<C-g>u
inoremap ! !<C-g>u
inoremap ? ?<C-g>u
" }}}
"
" moving lines with ALT key ----- {{{
"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
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv
" }}}

"htmlhttps://stackoverflow.com/questions/130734/how-can-one-close-html-tags-in-vim-quickly
"inoremap ><Space> ><Esc>F<lyt>o</<C-r>"><Esc>O<Space>

" better indentation ----- {{{
vnoremap > >gv
vnoremap < <gv
" }}}
14 changes: 11 additions & 3 deletions nvim/general/leader.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@

let mapleader = "\<Space>"

" Mappings with leader key
" source vim file
nmap <leader>sv :source $LOCALAPPDATA/nvim/init.vim<CR>
nmap <leader>so :e $LOCALAPPDATA/nvim/init.vim<CR>
" nmap <leader>so :vsplit <bar> :e $LOCALAPPDATA/nvim/init.vim<CR>
nnoremap <leader>n :bnext<CR>
nnoremap <leader>p :bprev<CR>
nnoremap <leader>b :buffers<CR>
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
"nmap <leader>ws :

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

source $LOCALAPPDATA/nvim/plugs/plugins.vim
source $LOCALAPPDATA/nvim/plugs/coc.vim
source $LOCALAPPDATA/nvim/plugs/markdown.vim
source $LOCALAPPDATA/nvim/general/general.vim
source $LOCALAPPDATA/nvim/general/leader.vim
source $LOCALAPPDATA/nvim/general/keybindings.vim
source $LOCALAPPDATA/nvim/plugs/plugins.vim
source $LOCALAPPDATA/nvim/languages/languages.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

17 changes: 17 additions & 0 deletions nvim/languages/languages.vim
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
" python ----- {{{
let g:python3_host_prog = "$PYTHON_HOME/Python/python.exe"
" }}}
" cpp ----- {{{
"autocmd vimEnter *.cpp map <F8> :w <CR> :!clear ; g++ --std=c++17 %; if [ -f a.out ]; then time ./a.out; rm a.out; fi <CR>
"map <F8> :!g++ % -o %:r && \./%:r <CR>
"
augroup languages
autocmd!
autocmd filetype cpp nnoremap <F5> :w <bar> !g++ -std=c++11 -O2 -Wall % -o %:r && %:r.exe <CR>
autocmd filetype javascript,javascript_react UltiSnipsAddFiletypes javascript.javascript_react.html
" autocmd FileType javascript_react UltiSnipsAddFiletypes html
" autocmd FileType javascript,javascriptreact,typescript,typescriptreact
" \ UltiSnipsAddFiletypes javascript.javascriptreact.typescript.typescriptreact
augroup END
"
" }}}

107 changes: 107 additions & 0 deletions nvim/plugs/coc.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
" coc ----- {{{
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("nvim-0.5.0") || has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
"set signcolumn=number
set signcolumn=yes
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.
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.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif

" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
"let g:coc_snippet_next = '<tab>' "tab to go to first suggestion


" 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>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
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)
" 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')
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 buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <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','')}

"nnoremap <silent> <leader>q :call CocAction('diagnosticInfo') <CR>
Loading

0 comments on commit a894c93

Please sign in to comment.