From: Georgios Atheridis Date: Sun, 22 May 2022 16:55:12 +0000 (+0000) Subject: first commit X-Git-Url: https://git.atheridis.org/?a=commitdiff_plain;h=5dab091acdb1bca6d1e0744ec748e2aea8944375;p=configs%2Fneovim.git first commit --- 5dab091acdb1bca6d1e0744ec748e2aea8944375 diff --git a/coc-settings.json b/coc-settings.json new file mode 100644 index 0000000..971a6c0 --- /dev/null +++ b/coc-settings.json @@ -0,0 +1,52 @@ +{ + "diagnostic-languageserver.formatFiletypes": { + "python": [ + "black", + "isort", + "docformatter" + ] + }, + "diagnostic-languageserver.formatters": { + "black": { + "command": "black", + "args": [ + "-q", + "-" + ] + }, + "isort": { + "command": "isort", + "args": [ + "-q", + "-" + ] + }, + "docformatter": { + "command": "docformatter", + "args": [ + "-" + ] + } + }, + "coc.preferences.formatOnSaveFiletypes": [ + "c", + "cpp", + "css", + "markdown", + "javascript", + "graphql", + "html", + "yaml", + "json", + "python", + "rust", + "toml" + ], + "html.filetypes": [ + "html", + "handlebars", + "htmldjango", + "blade", + "jinja" + ] +} diff --git a/init.vim b/init.vim new file mode 100644 index 0000000..56d6dd1 --- /dev/null +++ b/init.vim @@ -0,0 +1,15 @@ +for f in split(glob('$HOME/.config/nvim/vim_settings/*/*.vim'), '\n') + exe 'source' f +endfor + +for f in split(glob('$HOME/.config/nvim/vim_settings/*.vim'), '\n') + exe 'source' f +endfor + +for f in split(glob('$HOME/.config/nvim/plug_settings/*/*.vim'), '\n') + exe 'source' f +endfor + +for f in split(glob('$HOME/.config/nvim/plug_settings/*.vim'), '\n') + exe 'source' f +endfor diff --git a/plug_settings/coc/mappings.vim b/plug_settings/coc/mappings.vim new file mode 100644 index 0000000..b4ed16a --- /dev/null +++ b/plug_settings/coc/mappings.vim @@ -0,0 +1,45 @@ +" Coc Mappings + +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Formatting selected code +xmap f (coc-format-selected) +nmap f (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 + +" Symbol renaming +nnoremap rm (coc-rename) + +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap + \ pumvisible() ? "\" : + \ CheckBackspace() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion +inoremap pumvisible() ? "" : "\r" + diff --git a/plug_settings/coc/settings.vim b/plug_settings/coc/settings.vim new file mode 100644 index 0000000..197c585 --- /dev/null +++ b/plug_settings/coc/settings.vim @@ -0,0 +1,3 @@ +" Highlight the symbol and its references when holding the cursor +autocmd CursorHold * silent call CocActionAsync('highlight') + diff --git a/plug_settings/floaterm/mappings.vim b/plug_settings/floaterm/mappings.vim new file mode 100644 index 0000000..98d895e --- /dev/null +++ b/plug_settings/floaterm/mappings.vim @@ -0,0 +1,6 @@ +" Floaterm +let g:floaterm_keymap_toggle = '' +let g:floaterm_keymap_prev = '' +let g:floaterm_keymap_next = '' +let g:floaterm_keymap_new = '' +let g:floaterm_keymap_kill = '' diff --git a/plug_settings/nerdtree/mappings.vim b/plug_settings/nerdtree/mappings.vim new file mode 100644 index 0000000..bf92ab9 --- /dev/null +++ b/plug_settings/nerdtree/mappings.vim @@ -0,0 +1,3 @@ +nnoremap n :NERDTree +nnoremap e :NERDTreeToggle +nnoremap f :NERDTreeFocus diff --git a/plug_settings/nerdtree/settings.vim b/plug_settings/nerdtree/settings.vim new file mode 100644 index 0000000..843fd0c --- /dev/null +++ b/plug_settings/nerdtree/settings.vim @@ -0,0 +1,2 @@ +let g:NERDTreeGitStatusUseNerdFonts = 1 +let g:NERDTreeHighlightCursorline = 0 diff --git a/plug_settings/scope/settings.vim b/plug_settings/scope/settings.vim new file mode 100644 index 0000000..d80951e --- /dev/null +++ b/plug_settings/scope/settings.vim @@ -0,0 +1,5 @@ +augroup qs_colors + autocmd! + autocmd ColorScheme * highlight QuickScopePrimary guifg='#ff00ff' gui=underline ctermfg=155 cterm=underline + autocmd ColorScheme * highlight QuickScopeSecondary guifg='#aa0000' gui=underline ctermfg=81 cterm=underline +augroup END diff --git a/plug_settings/startify/settings.vim b/plug_settings/startify/settings.vim new file mode 100644 index 0000000..5cb5ae1 --- /dev/null +++ b/plug_settings/startify/settings.vim @@ -0,0 +1,38 @@ +let g:startify_session_dir = '~/.config/nvim/session' + +let g:startify_lists = [ + \ { 'type': 'files', 'header': [' Files'] }, + \ { 'type': 'dir', 'header': [' Current Directory '. getcwd()] }, + \ { 'type': 'sessions', 'header': [' Sessions'] }, + \ { 'type': 'bookmarks', 'header': [' Bookmarks'] }, + \ ] + +let g:startify_bookmarks = [ + \ { 'in': '~/.config/nvim/init.vim' }, + \ { 'b': '~/.bashrc' } + \ ] + +" You can automatically restart a session like this +let g:startify_session_autoload = 1 + +let g:startify_change_to_dir = 1 + +let g:startify_session_delete_buffers = 1 + +let g:startify_change_to_vcs_root = 1 + +let g:startify_fortune_use_unicode = 1 + +let g:startify_session_persistence = 1 + +let g:startify_enable_special = 0 + +let g:startify_custom_header = [ + \ ' __ __ _ ___ ', + \ ' \ \/ /___ _______ ______ ____ | | / (_)___ ___ ', + \ ' \ / __ \/ ___/ / / / __ `/ __ \ | | / / / __ `__ \', + \ ' / / /_/ / / / /_/ / /_/ / /_/ / | |/ / / / / / / /', + \ ' /_/\____/_/ \__,_/\__, /\____/ |___/_/_/ /_/ /_/ ', + \ ' /____/ ', + \] + diff --git a/plug_settings/theme/airline.vim b/plug_settings/theme/airline.vim new file mode 100644 index 0000000..1da8346 --- /dev/null +++ b/plug_settings/theme/airline.vim @@ -0,0 +1,4 @@ +let g:airline_powerline_fonts = 1 +let g:airline#extensions#tabline#enabled = 1 + +let g:airline_section_z = '%3p%% %3l:%2c' diff --git a/plug_settings/theme/color.vim b/plug_settings/theme/color.vim new file mode 100644 index 0000000..e09a91b --- /dev/null +++ b/plug_settings/theme/color.vim @@ -0,0 +1,3 @@ +set background=light +colo PaperColor +let g:airline_theme='papercolor' diff --git a/vim_settings/mappings.vim b/vim_settings/mappings.vim new file mode 100644 index 0000000..7df71f8 --- /dev/null +++ b/vim_settings/mappings.vim @@ -0,0 +1,64 @@ +" Autocomplete navigation +inoremap ("\") +inoremap ("\") +inoremap ("\a") + +" Buffer navigation +nnoremap J :bprevious +nnoremap K :bnext + +" Window navigation +nnoremap h +nnoremap j +nnoremap k +nnoremap l + +" Use alt +hjkl to resize windows +nnoremap :vertical resize -2 +nnoremap :resize -2 +nnoremap :resize +2 +nnoremap :vertical resize +2 + +" Remap escape +inoremap jkl +inoremap JKL + +" Tab changes buffer +nnoremap :bnext +nnoremap :bprevious + +" Sane Y default +nnoremap Y y$ + +" add a semicolon +inoremap A; +nnoremap A; + +" add a comma +inoremap A, +nnoremap A, + +" add 3 ` +inoremap ``` + +" add brackets +inoremap A() +nnoremap A() + +inoremap A[] +nnoremap A[] + +inoremap A{} +nnoremap A{} + +" Move while in insert mode +inoremap +inoremap +inoremap +inoremap + +inoremap +inoremap +inoremap +inoremap + diff --git a/vim_settings/plugins.vim b/vim_settings/plugins.vim new file mode 100644 index 0000000..02a09f6 --- /dev/null +++ b/vim_settings/plugins.vim @@ -0,0 +1,69 @@ +" Auto-install vim-plug +if empty(glob('$HOME/.local/share/nvim/site/autoload/plug.vim')) + silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +endif + +" Plugin List +call plug#begin() + + " Coc + Plug 'neoclide/coc.nvim', {'branch': 'release'} + + " nerdtree + Plug 'preservim/nerdtree' + Plug 'ryanoasis/vim-devicons' + Plug 'tiagofumo/vim-nerdtree-syntax-highlight' + Plug 'Xuyuanp/nerdtree-git-plugin' + Plug 'PhilRunninger/nerdtree-visual-selection' + + " Auto pairs for '(' '[' '{' + Plug 'jiangmiao/auto-pairs' + + " Surround with '(' '[' '{' + Plug 'tpope/vim-surround' + + " Highlight for scope f and F + Plug 'unblevable/quick-scope' + + " Mass comment / uncomment + Plug 'tpope/vim-commentary' + + " Floaterm + Plug 'voldikss/vim-floaterm' + + " Startify + Plug 'mhinz/vim-startify' + + " Themes + Plug 'NLKNguyen/papercolor-theme' + Plug 'vim-airline/vim-airline' + Plug 'vim-airline/vim-airline-themes' + +call plug#end() + +" Coc List +let g:coc_global_extensions = [ + \ 'coc-clangd', + \ 'coc-clang-format-style-options', + \ 'coc-cmake', + \ 'coc-css', + \ 'coc-cssmodules', + \ 'coc-diagnostic', + \ 'coc-docker', + \ 'coc-json', + \ 'coc-go', + \ 'coc-highlight', + \ 'coc-html', + \ 'coc-htmldjango', + \ 'coc-html-css-support', + \ 'coc-jedi', + \ 'coc-json', + \ 'coc-markdownlint', + \ '@yaegassy/coc-nginx', + \ 'coc-rls', + \ 'coc-toml', + \ 'coc-tsserver', + \ 'coc-xml', + \ 'coc-yaml', +\] diff --git a/vim_settings/settings.vim b/vim_settings/settings.vim new file mode 100644 index 0000000..18d3a1f --- /dev/null +++ b/vim_settings/settings.vim @@ -0,0 +1,35 @@ +syntax enable + +set encoding=utf-8 +set fileencoding=utf-8 + +set mouse=a + +set shiftwidth=4 +set smarttab +set expandtab +set smartindent +set autoindent + +set colorcolumn=88 +set nowrap +set linebreak +augroup Markdown + autocmd! + autocmd FileType markdown set wrap +augroup END +set number relativenumber +set hidden +set nohlsearch + +au BufEnter * set fo-=c +au BufEnter * set fo-=o + +set clipboard=unnamedplus + +set termguicolors + +set nobackup +set nowritebackup +set updatetime=200 +set shortmess+=c