diff --git a/nvim/.config/nvim/init.vim.my b/nvim/.config/nvim/init.vim.my deleted file mode 100644 index 3ad2555..0000000 --- a/nvim/.config/nvim/init.vim.my +++ /dev/null @@ -1,588 +0,0 @@ - -let mapleader=" " -set timeout timeoutlen=3000 - -set mouse= -syntax on - -set noerrorbells -set number -set relativenumber -set incsearch -set ignorecase -set ruler -set splitright -set splitbelow -set tabstop=4 softtabstop=4 -set shiftwidth=4 -set expandtab -set smartindent -set noswapfile -set nobackup -set undodir=~/.vim/undodir -set undofile -set nohlsearch -set cursorline - - -call plug#begin('~/.config/nvim/autoload/plugged') - Plug 'scrooloose/nerdcommenter' - Plug 'preservim/nerdtree' - - Plug 'zhimsel/vim-stay' - - Plug 'morhetz/gruvbox' " themes -"" Plug 'sonph/onehalf' - - " Plug 'ThePrimeagen/vim-be-good', {'do': './install.sh'} " vim training game - - " Fuzzy file search - Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " fuzzy file finder - Plug 'junegunn/fzf.vim' - Plug 'airblade/vim-rooter' " addon for fzf, for git projects - - "Plug 'ycm-core/YouCompleteMe' - Plug 'neoclide/coc.nvim', {'branch': 'release'} - - " Better syntax highlighting - " Python: - Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'} - " Plug 'davidhalter/jedi-vim' - - " C++: - Plug 'octol/vim-cpp-enhanced-highlight' - - " Snippets - Plug 'sirver/ultisnips' - Plug 'honza/vim-snippets' - Plug 'ervandew/supertab' - - " Show git modifications to file - Plug 'vim-scripts/vim-gitgutter' - - Plug 'jremmen/vim-ripgrep' " Rg uses word under cursor - - " run current file - Plug 'sbdchd/vim-run' - - " HTTP - Plug 'nicwest/vim-http' - - - " .NET C# - Plug 'OmniSharp/omnisharp-vim' - " Plug 'dense-analysis/ale' - - - " Markdown - " Plug 'plasticboy/vim-markdown' - " Plug 'kamikat/vim-markdown' - Plug 'tpope/vim-markdown' - - - " https://sharksforarms.dev/posts/neovim-rust/ - " LSP - " Collection of common configurations for the Nvim LSP client - Plug 'neovim/nvim-lspconfig' - - " Completion framework - Plug 'hrsh7th/nvim-cmp' - - " LSP completion source for nvim-cmp - Plug 'hrsh7th/cmp-nvim-lsp' - - " Snippet completion source for nvim-cmp - Plug 'hrsh7th/cmp-vsnip' - - " Other usefull completion sources - Plug 'hrsh7th/cmp-path' - Plug 'hrsh7th/cmp-buffer' - - " See hrsh7th's other plugins for more completion sources! - - " To enable more of the features of rust-analyzer, such as inlay hints and more! - Plug 'simrat39/rust-tools.nvim' - - " Snippet engine - Plug 'hrsh7th/vim-vsnip' - - " Fuzzy finder - " Optional - Plug 'nvim-lua/popup.nvim' - Plug 'nvim-lua/plenary.nvim' - Plug 'nvim-telescope/telescope.nvim' - - - - "" Rust - "Plug 'rust-lang/rust.vim' - -call plug#end() - - - -colorscheme gruvbox -"colorscheme onehalfdark let g:airline_theme='onehalfdark' -set background=dark - -set inccommand=nosplit " highlight substitude - -let g:rooter_manual_only = 1 - -" run current file plugin -let g:run_cmd_python = ['python3'] -let g:run_split = 'right' - -"set viewoptions=cursor,folds,slash,unix - -fun! SetupYCM() - nnoremap gd :YcmCompleter GoTo - nnoremap gr :YcmCompleter GoToReferences - nnoremap rr :YcmCompleter RefactorRename - nnoremap fx :YcmCompleter FixIt - - " make YCM compatible with UltiSnips (using supertab) - let g:ycm_key_list_select_completion = ['', ''] - let g:ycm_key_list_previous_completion = ['', ''] - let g:SuperTabDefaultCompletionType = '' - - " better key bindings for UltiSnipsExpandTrigger - let g:UltiSnipsExpandTrigger = "" - let g:UltiSnipsJumpForwardTrigger = "" - let g:UltiSnipsJumpBackwardTrigger = "" - - let g:ycm_global_ycm_extra_conf = '/home/david/.config/nvim/autoload/plugged/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py' -endfun - - - - -" CoC - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -fun! SetupCoC() - inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() - inoremap pumvisible() ? "\" : "\" - inoremap coc#refresh() - - nmap gd (coc-definition) - nmap gr (coc-references) - nmap gy (coc-type-definition) - nmap gi (coc-implementation) - nmap rn (coc-rename) - - " CoC snippet tab completion - inoremap - \ pumvisible() ? coc#_select_confirm() : - \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : - \ check_back_space() ? "\" : - \ coc#refresh() - - function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' - endfunction - - let g:coc_snippet_next = '' - "let g:UltiSnipsExpandTrigger="" - "let g:UltiSnipsJumpForwardTrigger=">" - "let g:UltiSnipsJumpBackwardTrigger="" - - let g:coc_global_extensions = [ - \ 'coc-snippets', - \ 'coc-pairs', - \ 'coc-prettier', - \ 'coc-json', - \ 'coc-pyright', - \ 'coc-html', - \ 'coc-css', - \ 'coc-xml', - \ 'coc-yaml', - \ 'coc-lua', - \ ] -endfun - - -" https://sharksforarms.dev/posts/neovim-rust/ -fun! SetupRust() - " Set completeopt to have a better completion experience - " :help completeopt - " menuone: popup even when there's only one match - " noinsert: Do not insert text until a selection is made - " noselect: Do not select, force user to select one from the menu - set completeopt=menuone,noinsert,noselect - - " Avoid showing extra messages when using completion - set shortmess+=c - - " Configure LSP through rust-tools.nvim plugin. - " rust-tools will configure and enable certain LSP features for us. - " See https://github.com/simrat39/rust-tools.nvim#configuration - lua < lua vim.lsp.buf.definition() - nnoremap K lua vim.lsp.buf.hover() - nnoremap gD lua vim.lsp.buf.implementation() - nnoremap lua vim.lsp.buf.signature_help() - nnoremap 1gD lua vim.lsp.buf.type_definition() - nnoremap gr lua vim.lsp.buf.references() - nnoremap g0 lua vim.lsp.buf.document_symbol() - nnoremap gW lua vim.lsp.buf.workspace_symbol() - nnoremap gd lua vim.lsp.buf.definition() - - " Quick-fix - nnoremap ga lua vim.lsp.buf.code_action() - - " Setup Completion - " See https://github.com/hrsh7th/nvim-cmp#basic-configuration - lua <'] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - -- Add tab support - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }) - }, - - -- Installed sources - sources = { - { name = 'nvim_lsp' }, - { name = 'vsnip' }, - { name = 'path' }, - { name = 'buffer' }, - }, - }) -EOF - - " have a fixed column for the diagnostics to appear in - " this removes the jitter when warnings/errors flow in - set signcolumn=yes - - " Set updatetime for CursorHold - " 300ms of no cursor movement to trigger CursorHold - set updatetime=500 - " Show diagnostic popup on cursor hover - autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics() - - " Goto previous/next diagnostic warning/error - nnoremap g[ lua vim.lsp.diagnostic.goto_prev() - nnoremap g] lua vim.lsp.diagnostic.goto_next() - -endfun - - - -autocmd BufNewFile,BufRead *.pde set syntax=java -autocmd BufNewFile,BufRead *.pde set filetype=java -autocmd BufNewFile,BufRead *.ino set syntax=arduino -autocmd BufNewFile,BufRead *.ino set filetype=arduino - -" run python script -" autocmd BufNewFile,BufRead *.py nnoremap :vs :term python % - -nnoremap rr :Run - -autocmd FileType java,typescript,go,cpp,h,c :call SetupYCM() - -autocmd FileType html,css,js,djangohtml,py,sh,lua,php :call SetupCoC() - -autocmd FileType rust :call SetupRust() - - -" Shebang line -function! Hashbang(portable, permission, RemExt) -let shells = { - \ 'awk': "awk", - \ 'sh': "bash", - \ 'hs': "runhaskell", - \ 'jl': "julia", - \ 'lua': "lua", - \ 'mak': "make", - \ 'js': "node", - \ 'm': "octave", - \ 'pl': "perl", - \ 'php': "php", - \ 'py': "python", - \ 'r': "Rscript", - \ 'rb': "ruby", - \ 'scala': "scala", - \ 'tcl': "tclsh", - \ 'tk': "wish" - \ } - - let extension = expand("%:e") - if has_key(shells,extension) - let fileshell = shells[extension] - - if a:portable - let line = "#! /usr/bin/env " . fileshell - else - let line = "#! " . system("which " . fileshell) - endif - - 0put = line - - if a:permission - :autocmd BufWritePost * :autocmd VimLeave * :!chmod u+x % - endif - if a:RemExt - :autocmd BufWritePost * :autocmd VimLeave * :!mv % "%:p:r" - endif - endif -endfunction - -:autocmd BufNewFile *.* :call Hashbang(1,1,0) - - -" HTTP -let g:vim_http_split_vertically = 1 - - - - - -fun! SetupDotnet() - " .NET C# - " Don't autoselect first omnicomplete option, show options even if there is only - " one (so the preview documentation is accessible). Remove 'preview', 'popup' - " and 'popuphidden' if you don't want to see any documentation whatsoever. - " Note that neovim does not support `popuphidden` or `popup` yet: - " https://github.com/neovim/neovim/issues/10996 - if has('patch-8.1.1880') - set completeopt=longest,menuone,popuphidden - " Highlight the completion documentation popup background/foreground the same as - " the completion menu itself, for better readability with highlighted - " documentation. - set completepopup=highlight:Pmenu,border:off - else - set completeopt=longest,menuone,preview - " Set desired preview window height for viewing documentation. - set previewheight=5 - endif - - " Tell ALE to use OmniSharp for linting C# files, and no other linters. - "let g:ale_linters = { 'cs': ['OmniSharp'] } - - augroup omnisharp_commands - autocmd! - - " Show type information automatically when the cursor stops moving. - " Note that the type is echoed to the Vim command line, and will overwrite - " any other messages in this space including e.g. ALE linting messages. - autocmd CursorHold *.cs OmniSharpTypeLookup - - " The following commands are contextual, based on the cursor position. - autocmd FileType cs nmap gd (omnisharp_go_to_definition) - autocmd FileType cs nmap gu (omnisharp_find_usages) - autocmd FileType cs nmap gi (omnisharp_find_implementations) - autocmd FileType cs nmap ospd (omnisharp_preview_definition) - autocmd FileType cs nmap ospi (omnisharp_preview_implementations) - autocmd FileType cs nmap ost (omnisharp_type_lookup) - autocmd FileType cs nmap osd (omnisharp_documentation) - autocmd FileType cs nmap osfs (omnisharp_find_symbol) - autocmd FileType cs nmap osfx (omnisharp_fix_usings) - autocmd FileType cs nmap (omnisharp_signature_help) - autocmd FileType cs imap (omnisharp_signature_help) - - " Navigate up and down by method/property/field - autocmd FileType cs nmap [[ (omnisharp_navigate_up) - autocmd FileType cs nmap ]] (omnisharp_navigate_down) - " Find all code errors/warnings for the current solution and populate the quickfix window - autocmd FileType cs nmap oscc (omnisharp_global_code_check) - " Contextual code actions (uses fzf, vim-clap, CtrlP or unite.vim selector when available) - autocmd FileType cs nmap osca (omnisharp_code_actions) - autocmd FileType cs xmap osca (omnisharp_code_actions) - " Repeat the last code action performed (does not use a selector) - autocmd FileType cs nmap os. (omnisharp_code_action_repeat) - autocmd FileType cs xmap os. (omnisharp_code_action_repeat) - - autocmd FileType cs nmap os= (omnisharp_code_format) - - autocmd FileType cs nmap rn (omnisharp_rename) - - autocmd FileType cs nmap osre (omnisharp_restart_server) - autocmd FileType cs nmap osst (omnisharp_start_server) - autocmd FileType cs nmap ossp (omnisharp_stop_server) - - "autocmd FileType cs nmap :vs | term dotnet run - autocmd FileType cs nmap run :vs:w:term dotnet run - - augroup END - - let g:OmniSharp_selector_ui = 'fzf' " Use fzf - let g:OmniSharp_selector_findusages = 'fzf' - - let g:OmniSharp_highlighting = 3 " Highlight in insert mode - - let g:OmniSharp_highlight_groups = { - \ 'Comment': 'NonText', - \ 'XmlDocCommentName': 'Identifier', - \ 'XmlDocCommentText': 'NonText' - \} - - let g:OmniSharp_popup_options = { - \ 'winblend': 30, - \ 'winhl': 'Normal:Normal' - \} - - " Enable snippet completion, using the ultisnips plugin - let g:OmniSharp_want_snippet=1 -endfun - - - -" Automaticly trim all trailing whitespace on save(write) -function! StripTrailingWhitespaces() - let l = line(".") - let c = col(".") - %s/\s\+$//e - call cursor(l, c) -endfun - -autocmd BufWritePre * :call StripTrailingWhitespaces() - - - - - - -" Markdown - -let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'xml', 'javascript', 'json', 'asm'] -let g:markdown_minlines = 100 - - - - -" disable spacebar (don't move forward) -nnoremap - -" quickly move through panes -nnoremap -nnoremap -nnoremap -nnoremap - -" resize panes -nnoremap + :vertical resize +5 -nnoremap - :vertical resize -5 -nnoremap * :resize +5 -nnoremap / :resize -5 - -nnoremap fgf :GFiles -nnoremap ff :Files - -vnoremap p "_dP - -inoremap :call NERDComment(0,"toggle") -nnoremap :call NERDComment(0,"toggle") - - - -" MUST HAVE VIM REMAPS -" https://youtu.be/hSHATqh8svM - -" Number 5: Behave Vim -nnoremap Y y$ - -" Number 4: Keeping it centered -nnoremap n nzzzv -nnoremap N Nzzzv -" nnoremap J mzJ`z - -" Number 3: Undo break points -inoremap , ,u -inoremap . .u -inoremap ! !u -inoremap ? ?u -inoremap _ _u -inoremap - -u -inoremap u - -" Number 2: Jumplist mutations -nnoremap k (v:count > 5 ? "m'" . v:count : "") . 'k' -nnoremap j (v:count > 5 ? "m'" . v:count : "") . 'j' - -" Number 1: Moving text -vnoremap J :m '>+1gv=gv -vnoremap K :m '<-2gv=gv -inoremap :m .+1== -inoremap :m .-2== -nnoremap j :m .+1== -nnoremap k :m .-2== - - -vnoremap < >gv - -" vnoremap >gv - - - - - - diff --git a/nvim/.config/nvim/init.vim.working b/nvim/.config/nvim/init.vim.working deleted file mode 100644 index 0e26f72..0000000 --- a/nvim/.config/nvim/init.vim.working +++ /dev/null @@ -1,164 +0,0 @@ -" This is an example on how rust-analyzer can be configure using rust-tools - -" Prerequisites: -" - neovim >= 0.5 -" - rust-analyzer: https://rust-analyzer.github.io/manual.html#rust-analyzer-language-server-binary - -" Steps: -" - :PlugInstall -" - Restart - -call plug#begin('~/.vim/plugged') - -" Collection of common configurations for the Nvim LSP client -Plug 'neovim/nvim-lspconfig' - -" Autocompletion framework -Plug 'hrsh7th/nvim-cmp' -" cmp LSP completion -Plug 'hrsh7th/cmp-nvim-lsp' -" cmp Snippet completion -Plug 'hrsh7th/cmp-vsnip' -" cmp Path completion -Plug 'hrsh7th/cmp-path' -Plug 'hrsh7th/cmp-buffer' -" See hrsh7th other plugins for more great completion sources! - -" Adds extra functionality over rust analyzer -Plug 'simrat39/rust-tools.nvim' - -" Snippet engine -Plug 'hrsh7th/vim-vsnip' - -" Optional -Plug 'nvim-lua/popup.nvim' -Plug 'nvim-lua/plenary.nvim' -Plug 'nvim-telescope/telescope.nvim' - -" Some color scheme other then default -Plug 'arcticicestudio/nord-vim' - -call plug#end() - -colorscheme nord - - -" Set completeopt to have a better completion experience -" :help completeopt -" menuone: popup even when there's only one match -" noinsert: Do not insert text until a selection is made -" noselect: Do not select, force user to select one from the menu -set completeopt=menuone,noinsert,noselect - -" Avoid showing extra messages when using completion -set shortmess+=c - -" Configure LSP through rust-tools.nvim plugin. -" rust-tools will configure and enable certain LSP features for us. -" See https://github.com/simrat39/rust-tools.nvim#configuration -lua < lua vim.lsp.buf.definition() -nnoremap K lua vim.lsp.buf.hover() -nnoremap gD lua vim.lsp.buf.implementation() -nnoremap lua vim.lsp.buf.signature_help() -nnoremap 1gD lua vim.lsp.buf.type_definition() -nnoremap gr lua vim.lsp.buf.references() -nnoremap g0 lua vim.lsp.buf.document_symbol() -nnoremap gW lua vim.lsp.buf.workspace_symbol() -nnoremap gd lua vim.lsp.buf.definition() - -" Quick-fix -nnoremap ga lua vim.lsp.buf.code_action() - -" Setup Completion -" See https://github.com/hrsh7th/nvim-cmp#basic-configuration -lua <'] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - -- Add tab support - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }) - }, - - -- Installed sources - sources = { - { name = 'nvim_lsp' }, - { name = 'vsnip' }, - { name = 'path' }, - { name = 'buffer' }, - }, -}) -EOF - -" have a fixed column for the diagnostics to appear in -" this removes the jitter when warnings/errors flow in -set signcolumn=yes - -" Set updatetime for CursorHold -" 300ms of no cursor movement to trigger CursorHold -set updatetime=300 -" Show diagnostic popup on cursor hover -autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics() - -" Goto previous/next diagnostic warning/error -nnoremap g[ lua vim.lsp.diagnostic.goto_prev() -nnoremap g] lua vim.lsp.diagnostic.goto_next() -