Browse Source

need to fix ALE markdown thing and create needed programs list but installed LSP

Christian Chiarulli 6 years ago
parent
commit
673a407d9d

+ 1 - 0
.ctagsignore

@@ -0,0 +1 @@
+dein

+ 5 - 0
init.vim

@@ -7,3 +7,8 @@ source $HOME/.config/nvim/modules/airline.vim
 source $HOME/.config/nvim/modules/deoplete.vim
 source $HOME/.config/nvim/modules/nerdtree.vim
 source $HOME/.config/nvim/modules/startify.vim
+source $HOME/.config/nvim/modules/gutentags_plus.vim
+source $HOME/.config/nvim/modules/markdown-preview.vim
+source $HOME/.config/nvim/modules/language_server.vim
+"install ripgrep"
+"install universal ctags"

+ 14 - 1
modules/deoplete.vim

@@ -1,4 +1,17 @@
 " Enable deoplete
 let g:deoplete#enable_at_startup = 1
+let g:deoplete#complete_method = "omnifunc"
+let g:deoplete#auto_complete_delay = 0
 " <TAB>: completion.
-inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
+""inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
+"use TAB as the mapping
+inoremap <silent><expr> <TAB>
+      \ pumvisible() ?  "\<C-n>" :
+      \ <SID>check_back_space() ? "\<TAB>" :
+      \ deoplete#mappings#manual_complete()
+function! s:check_back_space() abort ""     
+  let col = col('.') - 1
+  return !col || getline('.')[col - 1]  =~ '\s'
+endfunction ""   
+inoremap <silent><expr><S-TAB>  pumvisible() ? "\<C-p>" : "\<TAB>"
+inoremap <expr><BS>  deoplete#smart_close_popup()."\<C-h>"

+ 28 - 13
modules/general.vim

@@ -31,15 +31,18 @@ set smarttab
 " Converts tabs to spaces
 set expandtab
 " Makes indenting smart
-set smartindent
+""set smartindent
 " Good auto indent
-set autoindent
+""set autoindent
 " Always display the status line
 set laststatus=2
 " Line numbers
 set number
 " Enable highlighting of the current line
 set cursorline
+" Get rid of annoying red highlights"
+let g:python_highlight_all = 0
+" Disable arrows"
 let g:elite_mode=1
 " Disable arrow movement, resize splits instead.
 if get(g:, 'elite_mode')
@@ -56,22 +59,34 @@ nnoremap <C-Q> :wq!<CR>
 nnoremap <C-c> <Esc>
 " <TAB>: completion.
 inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
-" F2 split vertical
-nnoremap <F2> :vsplit<CR>
-" F3 split horizontal
-nnoremap <F3> :split<CR>
-" Toggle Line numbers
-nnoremap <F4> :set nonumber!<CR>
-" Toggle NERDTree
-nnoremap <F5> :NERDTreeToggle<CR>
-" Get rid of highlights after search
-nnoremap <silent> <F7> :nohlsearch<CR><F7>
 " Open terminal with F1
-nnoremap <F1> :10split term://bash<CR>
+nnoremap <silent> <F1> :10split term://bash<CR>
 " insert mode for terminal
 autocmd BufWinEnter,WinEnter term://* startinsert
 autocmd BufLeave term://* stopinsert
+" Toggle tagbar
+nnoremap <silent> <F2> :tagbar<CR>
+" Toggle Line numbers
+nnoremap <silent> <F4> :set nonumber!<CR>
+" Toggle NERDTree
+nnoremap <silent> <F5> :NERDTreeToggle<CR>
+" Startify
+nnoremap <silent> <F6> :Startify<CR>
+" Get rid of highlights after search
+nnoremap <silent> <F7> :nohlsearch<CR><F7>
+" Toggle open buffers
+nnoremap <silent> <F8> :BuffergatorToggle<CR>
+" For fuzzy finder
+nnoremap <silent> <F9> :Files<CR>
+" F10 split vertical
+nnoremap <silent> <F10> :vsplit<CR>
+" F11 split horizontal
+nnoremap <silent> <F11> :split<CR>
+" Make current buffer only buffer
+nnoremap <silent> <F12> :only<CR>
 " Remap window switch
+" Switch to rename for LSP to do add leader
+""nnoremap <F4> :SearchTasks *<CR>
 nnoremap <C-h> <C-w>h
 nnoremap <C-j> <C-w>j
 nnoremap <C-k> <C-w>k

+ 9 - 2
modules/gutentags_plus.vim

@@ -2,10 +2,17 @@
 let g:gutentags_modules = ['ctags', 'gtags_cscope']
 
 " config project root markers.
-let g:gutentags_project_root = ['.root']
+let g:gutentags_project_root = ['.root', '.git']
 
 " generate datebases in my cache directory, prevent gtags files polluting my project
 let g:gutentags_cache_dir = expand('~/.cache/tags')
 
 " change focus to quickfix window after search (optional).
-let g:gutentags_plus_switch = 1
+""let g:gutentags_plus_switch = 1
+
+" This will ignore everything in .gitignore"
+let g:gutentags_file_list_command = 'rg --files'
+
+"Install ripgrep"
+"Install ctags"
+".notags will ignore everything"

+ 20 - 0
modules/language_server.vim

@@ -0,0 +1,20 @@
+" Required for operations modifying multiple buffers like rename.
+set hidden
+
+let g:LanguageClient_autoStart = 1
+
+let g:LanguageClient_serverCommands = {
+    \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
+    \ 'javascript': ['/usr/local/bin/javascript-typescript-stdio'],
+    \ 'javascript.jsx': ['tcp://127.0.0.1:2089'],
+    \ 'python': ['pyls'], 
+    \ 'sh': ['bash-language-server', 'start'],
+    \ }
+" pyls doesn't need a path because it is defined in the neovim virtual
+" environment"
+" TODO add this to script npm i -g bash-language-server
+
+
+nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
+nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
+nnoremap <silent> <F3> :call LanguageClient#textDocument_rename()<CR>

+ 2 - 2
modules/markdown-preview.vim

@@ -16,12 +16,12 @@ let g:mkdp_refresh_slow = 0
 " set to 1, the MarkdownPreview command can be use for all files,
 " by default it just can be use in markdown file
 " default: 0
-let g:mkdp_command_for_global = 1
+let g:mkdp_command_for_global = 0
 
 " set to 1, preview server available to others in your network
 " by default, the server only listens on localhost (127.0.0.1)
 " default: 0
-let g:mkdp_open_to_the_world = 1
+let g:mkdp_open_to_the_world = 0
 
 " use custom IP to open preview page
 " useful when you work in remote vim and preview on local browser

+ 22 - 5
modules/plugins.vim

@@ -1,8 +1,13 @@
 " Add the dein installation directory into runtimepath
 set runtimepath+=~/.config/nvim/dein/repos/github.com/Shougo/dein.vim
 
+function! DoRemote()
+    UpdateRemotePlugins
+endfunction
+
 if dein#load_state('~/.config/nvim/dein')
   call dein#begin('~/.config/nvim/dein')
+
   
   " Themes
   call dein#add('liuchengxu/space-vim-dark')
@@ -29,19 +34,27 @@ if dein#load_state('~/.config/nvim/dein')
   call dein#add('jeetsukumaran/vim-buffergator')
   " Ctrlp 
   call dein#add('ctrlpvim/ctrlp.vim')
-  "Syntax 
+  "Linting 
   call dein#add('w0rp/ale') 
+  call dein#add('autozimu/LanguageClient-neovim', {
+    \ 'rev': 'next',
+    \ 'build': 'bash install.sh',
+    \ })
+  " Fuzzy finder
+  call dein#add('junegunn/fzf.vim',  { 'dir': '~/.fzf', 'do': './install --all' })
+  call dein#add('junegunn/fzf')
+
+
   "Git
   call dein#add('airblade/vim-gitgutter')
   call dein#add('tpope/vim-fugitive')
   " BufOnly use :BufOnly to unload all or pass it a single buffer
   call dein#add('vim-scripts/BufOnly.vim')
-  " Markdown viewer
-  "
-  call dein#add('iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install'  })
+  " Markdown viewer TODO Fix this stupid thing
+  "call dein#add('iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install'  })
 
   call dein#add('~/.config/nvim/dein/repos/github.com/Shougo/dein.vim')
-  call dein#add('Shougo/deoplete.nvim')
+  call dein#add('Shougo/deoplete.nvim', {'do': 'UpdateRemotePlugins'})
   if !has('nvim')
     call dein#add('roxma/nvim-yarp')
     call dein#add('roxma/vim-hug-neovim-rpc')
@@ -55,3 +68,7 @@ endif
 if dein#check_install()
   call dein#install()
 endif
+
+
+" TODO inside dein/repos/ somewhere there are cach and state files which keep
+" screwing me for installing new plugins

+ 1 - 1
modules/theme.vim

@@ -1,7 +1,7 @@
 
 " Switch to whatever colorscheme you like
 "colorscheme onedark
-"colorscheme gruvbox
+""colorscheme gruvbox
 colorscheme tender
 
 " This chunk is just for spacevim theme

+ 0 - 5
old/init.vim

@@ -1,10 +1,5 @@
 
 
-nnoremap <F2> :BuffergatorToggle<CR>
-nnoremap <F3> :Files<CR>
-nnoremap <F4> :SearchTasks *<CR>
-nnoremap <F8> :TagbarToggle<CR>
-nnoremap <F12> :only<CR>