diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d0b119 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +nvim/plugged/ + diff --git a/nvim/init.vim b/nvim/init.vim index a590715..5b93952 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,39 +1,87 @@ -call plug#begin('~/.vim/plugged') +syntax on +set ruler " Show the line and column numbers of the cursor. +set formatoptions+=o " Continue comment marker in new lines. +set textwidth=0 " Hard-wrap long lines as you type them. +set modeline " Enable modeline. +"set esckeys " Cursor keys in insert mode. +set linespace=0 " Set line-spacing to minimum. +set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) +" More natural splits +set splitbelow " Horizontal split below current. +set splitright " Vertical split to right of current. +if !&scrolloff + set scrolloff=3 " Show next 3 lines while scrolling. +endif +if !&sidescrolloff + set sidescrolloff=5 " Show next 5 columns while side-scrolling. +endif +set display+=lastline +set nostartofline " Do not jump to first character with page commands. +set noerrorbells " No beeps +set backspace=indent,eol,start " Makes backspace key more powerful. +set showcmd " Show me what I'm typing +set showmode " Show current mode. +set noswapfile " Don't use swapfile +set nobackup " Don't create annoying backup files +set encoding=utf-8 " Set default encoding to UTF-8 +set autowrite " Automatically save before :next, :make etc. +set autoread " Automatically reread changed files without asking me anything +set laststatus=2 +set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats +set showmatch " Do not show matching brackets by flickering +set incsearch " Shows the match while typing +set hlsearch " Highlight found searches +set ignorecase " Search case insensitive... +set smartcase " ... but not when search pattern contains upper case characters +set gdefault " Use 'g' flag by default with :s/foo/bar/. +set magic " Use 'magic' patterns (extended regular expressions). +" Use to clear the highlighting of :set hlsearch. +if maparg('', 'n') ==# '' + nnoremap :nohlsearch +endif + +" Search and Replace +nmap s :%s//g + +" Leader key is like a command prefix. +"let mapleader='z' +"let maplocalleader='\' + +let g:python_host_prog="/usr/local/bin/python2.7" + +let g:session_autosave = 'yes' +let g:session_autoload = 'yes' +let g:session_default_to_last = 1 + +" set cursorcolumn +nmap +vmap x + +" Plugins here +call plug#begin('~/.config/nvim/plugged') +Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' +" Plug 'Shougo/deoplete.nvim' +Plug 'Valloric/YouCompleteMe' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'Chiel92/vim-autoformat' +Plug 'scrooloose/nerdtree' +Plug 'terryma/vim-multiple-cursors' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' -Plug 'scrooloose/nerdtree' -Plug 'fatih/vim-go' -Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} - +Plug 'crusoexia/vim-monokai' +Plug 'projekt0n/github-nvim-theme' call plug#end() -set noeb vb t_vb= -let mapleader = ',' -let g:go_def_mode='gopls' -let g:go_info_mode='gopls' -set colorcolumn=160 - - - set number relativenumber set nu rnu -set tabstop=4 -set shiftwidth=0 -set softtabstop=-1 -set expandtab +set tabstop=4 +set shiftwidth=0 +set softtabstop=-1 +set expandtab set autoindent -set cursorline -syntax enable -nnoremap :noh - -" autocmd vimenter * NERDTree - -" ------------------------------------------------------------------------------------------------- -" coc.nvim default settings -" ------------------------------------------------------------------------------------------------- - -" if hidden is not set, TextEdit might fail. +set cursorline set hidden " Better display for messages set cmdheight=2 @@ -57,49 +105,73 @@ function! s:check_back_space() abort return !col || getline('.')[col - 1] =~# '\s' endfunction -" Use to trigger completion. -inoremap coc#refresh() +" deoplete config +let g:deoplete#enable_at_startup = 1 +let g:deoplete#disable_auto_complete = 1 +if has("gui_running") + inoremap deoplete#mappings#manual_complete() +else + inoremap deoplete#mappings#manual_complete() +endif -" Use `[c` and `]c` to navigate diagnostics -nmap [c (coc-diagnostic-prev) -nmap ]c (coc-diagnostic-next) +" UltiSnips config +inoremap pumvisible() ? "\" : "\" +let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsJumpForwardTrigger="" +let g:UltiSnipsJumpBackwardTrigger="" -" Remap keys for gotos -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) +" Tell Vim which characters to show for expanded TABs, +" trailing whitespace, and end-of-lines. VERY useful! +if &listchars ==# 'eol:$' + " set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ + set listchars=tab:>\ ,extends:>,precedes:<,nbsp:+ +endif -" Use U to show documentation in preview window -nnoremap U :call show_documentation() +" nerdtree config +map :NERDTreeToggle -" Remap for rename current word -nmap rn (coc-rename) +" airline settings +let g:airline#extensions#tabline#enabled = 2 +let g:airline#extensions#tabline#fnamemod = ':t' +let g:airline#extensions#tabline#left_sep = ' ' +let g:airline#extensions#tabline#left_alt_sep = '|' +let g:airline#extensions#tabline#right_sep = ' ' +let g:airline#extensions#tabline#right_alt_sep = '|' +let g:airline_powerline_fonts=1 +let g:airline_left_sep = ' ' +let g:airline_left_alt_sep = '|' +let g:airline_right_sep = ' ' +let g:airline_right_alt_sep = '|' +let g:airline_powerline_fonts=0 +let g:airline_theme='base16_default_dark' -" Remap for format selected region -vmap f (coc-format-selected) -nmap f (coc-format-selected) -" Show all diagnostics -nnoremap u :CocList diagnostics -" Manage extensions -nnoremap e :CocList extensions -" Show commands -nnoremap c :CocList commands -" Find symbol of current document -nnoremap o :CocList outline -" Search workspace symbols -nnoremap s :CocList -I symbols -" Do default action for next item. -nnoremap j :CocNext -" Do default action for previous item. -nnoremap k :CocPrev -" Resume latest coc list -nnoremap p :CocListResume +" Multicursor +let g:multi_cursor_use_default_mapping=0 +let g:multi_cursor_next_key='' +let g:multi_cursor_quit_key='' +let g:multi_cursor_quit_key='' -" disable vim-go :GoDef short cut (gd) -" this is handled by LanguageClient [LC] -let g:go_def_mapping_enabled = 0 +" YouCompleteMe +let g:ycm_autoclose_preview_window_after_completion = 1 +let g:ycm_min_num_of_chars_for_completion = 1 +" Other +set mouse= +set list +lua require('github-theme').setup() +"darcula fix to hide the indents: +set nolist +let NERDTreeIgnore = ['_site'] +" Buffer handling +nmap L :let &number=1-&number +nmap ] :bnext +nmap [ :bprevious +nmap bq :bp bd # +nmap bl :ls +nmap 0 :set invnumber +" map :q to byffer delete +" http://stackoverflow.com/questions/7513380/vim-change-x-function-to-delete-buffer-instead-of-save-quit +cnoreabbrev x getcmdtype() == ":" && getcmdline() == 'x' ? 'bd' : 'x'