Skip to content

Instantly share code, notes, and snippets.

@prkstaff
Last active December 14, 2023 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prkstaff/fb933799508069f4e141f854086b9fea to your computer and use it in GitHub Desktop.
Save prkstaff/fb933799508069f4e141f854086b9fea to your computer and use it in GitHub Desktop.
" close buffer without closing window using leader q
map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>
" nice indent for yaml files:
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
"
" nice indent for html files:
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
" spell checks
setlocal spell spelllang=en_us,pt_br
autocmd FileType yaml,json,vim setlocal nospell
" enable undo even after closing buffers
set undofile
call plug#begin('~/.vim/plugged')
" Treesitter
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" Vim oil
Plug 'stevearc/oil.nvim'
" devicons
Plug 'nvim-tree/nvim-web-devicons'
" commentary
Plug 'tpope/vim-commentary'
" latex
Plug 'lervag/vimtex'
Plug 'mattn/emmet-vim'
" vscode plugins
" be sure to have npm and node inside your distro
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Plugins to install with coc:
" python: coc-pyright
" json: coc-json
" yaml: coc-yaml
" docker: coc-docker
" html: coc-html
" coc-emmet: emmet support
" coc-prettier
" coc-pairs
" tag management
Plug 'preservim/tagbar'
" Paper Color theme
Plug 'NLKNguyen/papercolor-theme'
" undo diff tool
Plug 'mbbill/undotree'
Plug 'nvim-lualine/lualine.nvim' "
" If you want to have icons in your statusline choose one of these
Plug 'nvim-tree/nvim-web-devicons'
" lint
Plug 'dense-analysis/ale'
" Telescope
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.2' }
" Go
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries'}
" Autocomplete for vim-go
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" terraform
Plug 'hashivim/vim-terraform'
" Git
Plug 'tpope/vim-fugitive'
" Wiki
Plug 'vimwiki/vimwiki'
" Markdown Preview
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
call plug#end()
" init oil nvim
lua << EOF
require("oil").setup {
view_options = {
show_hidden = true,
}
}
require('lualine').setup {
options = {
show_filename_only = false,
},
sections = {
lualine_c = {
{'filename', path = 1,},
},
}
}
EOF
" require('lualine').setup()
" deoplete start
let g:deoplete#enable_at_startup = 1
call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' })
" Delve debug keys
" f9 breakpoint
nnoremap <f10> :GoDebugNext<cr>
nnoremap <f4> :GoDebugContinue<cr>
nnoremap <f11> :GoDebugStep<cr>
nnoremap <f8> :GoDebugHalt<cr>
" Find files using Telescope command-line sugar.
nnoremap <leader>ff <cmd>Telescope find_files --hidden=false<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fc <cmd>Telescope commands<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
" stop highlight
nnoremap <leader>nh <cmd>:noh<cr>
" pip install vimwiki-markdown
let g:vimwiki_list = [{
\ 'path': '~/vimwiki',
\ 'template_path': '~/vimwiki/templates/',
\ 'template_default': 'default',
\ 'syntax': 'markdown',
\ 'ext': '.md',
\ 'path_html': '/home/rprado/Insync/prkstaff@gmail.com/Google Drive/VIMWIKI/',
\ 'custom_wiki2html': 'vimwiki_markdown',
\ 'template_ext': '.tpl'},{
\ 'path': '~/professional_wiki',
\ 'template_path': '~/professional_wiki/templates/',
\ 'template_default': 'default',
\ 'syntax': 'markdown',
\ 'ext': '.md',
\ 'path_html': '/home/rprado/Insync/prkstaff@gmail.com/Google Drive/PROFESSIONAL_WIKI/',
\ 'custom_wiki2html': 'vimwiki_markdown',
\ 'template_ext': '.tpl'},{
\ 'path': '~/study_wiki',
\ 'template_path': '~/study_wiki/templates/',
\ 'template_default': 'default',
\ 'syntax': 'markdown',
\ 'ext': '.md',
\ 'path_html': '/home/rprado/Insync/prkstaff@gmail.com/Google Drive/STUDY_WIKI/',
\ 'custom_wiki2html': 'vimwiki_markdown',
\ 'template_ext': '.tpl'}]
" Enable emmet just for html and css
let g:user_emmet_install_global = 0
autocmd FileType html,css,gohtmltmpl EmmetInstall
" Turn on PaperColor theme
set background=dark
colorscheme PaperColor
" set line numbers
set number
set relativenumber
" toggle undo history using leader h
nnoremap <leader>h :UndotreeToggle<CR>
" Tagbar Toggle
nmap <leader>t :TagbarToggle<CR>
" Will add 4 spaces when >> and 4 spaces when tab
set tabstop=2 shiftwidth=2 expandtab
" Enable current file open with oil.nvim using :E
command! -bang -nargs=0 E execute 'lua require("oil").open()'
" disable table mappings for vimwiki to enable autocomplete
let g:vimwiki_key_mappings = {
\ 'all_maps': 1,
\ 'global': 1,
\ 'headers': 1,
\ 'text_objs': 1,
\ 'table_format': 1,
\ 'table_mappings': 0,
\ 'lists': 1,
\ 'links': 1,
\ 'html': 1,
\ 'mouse': 0,
\ }
augroup VimwikiRemaps
autocmd!
" unmap tab in insert mode
autocmd Filetype vimwiki silent! iunmap <buffer> <Tab>
" remap table tab mappings to M-n M-p
autocmd Filetype vimwiki inoremap <silent><expr><buffer> <M-n> vimwiki#tbl#kbd_tab()
autocmd Filetype vimwiki inoremap <silent><expr><buffer> <M-p> vimwiki#tbl#kbd_shift_tab()
" on enter if completion is open, complete first element otherwise use
" default vimwiki mapping
autocmd Filetype vimwiki inoremap <silent><expr><buffer> <cr> pumvisible() ? coc#_select_confirm()
\: "<C-]><Esc>:VimwikiReturn 1 5<CR>"
augroup end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment