Prechádzať zdrojové kódy

feat(nvim telescope fuzzyfinder + shortcuts)

Douglas A 4 rokov pred
rodič
commit
a0bd43e388
5 zmenil súbory, kde vykonal 60 pridanie a 31 odobranie
  1. 7 19
      X/Xresources
  2. 3 0
      bash/bashrc
  3. 1 1
      bash/environment
  4. 25 0
      bash/ps1
  5. 24 11
      nvim/init.vim

+ 7 - 19
X/Xresources

@@ -1,24 +1,12 @@
-Xft.dpi:			            96
-Xft.antialias:			        true
+Xft.dpi:        96
+Xft.antialias:  true
+Xft.rgba:       rgb
+Xft.hinting:    true
+Xft.hintstyle:  hintslight
+
 
 ! Colors
-*background:   [97]#282a36
+*background:   #282a36
 *foreground:   #eff0eb
 *cursorColor:  #9aedfe
 
-*color0:      #33303b
-*color8:      #4f4b58
-*color1:      #ff5c57
-*color9:      #ff5c57
-*color2:      #5af78e
-*color10:     #5af78e
-*color3:      #f3f99d
-*color11:     #f3f99d
-*color4:      #57c7ff
-*color12:     #57c7ff
-*color5:      #ff6ac1
-*color13:     #ff6ac1
-*color6:      #9aedfe
-*color14:     #9aedfe
-*color7:      #eff0eb
-*color15:     #eff0eb

+ 3 - 0
bash/bashrc

@@ -23,7 +23,10 @@ export PS1="[\u@\h \W]\\$ \[$(tput sgr0)\]"
 [ -f $DOTFILES/aliases ] && . $DOTFILES/aliases
 [ -f $DOTFILES/paths ] && . $DOTFILES/paths
 [ -f $DOTFILES/environment ] && . $DOTFILES/environment
+[ -f $DOTFILES/ps1 ] && . $DOTFILES/ps1
 source "$HOME/.cargo/env"
 
 # enable firefox hw renderer
 export MOZ_X11_EGL=1
+. "$HOME/.cargo/env"
+

+ 1 - 1
bash/environment

@@ -14,5 +14,5 @@ LC_IDENTIFICATION="en_US.UTF-8"; export LC_IDENTIFICATION
 LC_ALL=; export LC_ALL
 
 # Terminal settings
-test -e /usr/bin/nvim && EDITOR=nvim || EDITOR=nano
+test -e /usr/local/bin/nvim && EDITOR=nvim || EDITOR=nano
 export EDITOR

+ 25 - 0
bash/ps1

@@ -0,0 +1,25 @@
+RESET="\[\033[0m\]"
+RED="\[\033[0;31m\]"
+GREEN="\[\033[01;32m\]"
+BLUE="\[\033[01;34m\]"
+YELLOW="\[\033[0;33m\]"
+ 
+PS_LINE=``
+function parse_git_branch {
+  PS_BRANCH=''
+  PS_FILL=${PS_LINE:0:$COLUMNS}
+  if [ -d .svn ]; then
+    PS_BRANCH="(svn r$(svn info|awk '/Revision/{print $2}'))"
+    return
+  elif [ -f _FOSSIL_ -o -f .fslckout ]; then
+    PS_BRANCH="(fossil $(fossil status|awk '/tags/{print $2}')) "
+    return
+  fi
+  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
+  PS_BRANCH="(git ${ref#refs/heads/}) "
+}
+PROMPT_COMMAND=parse_git_branch
+PS_INFO="$GREEN\u@\h$RESET:$BLUE\w"
+PS_GIT="$YELLOW\$PS_BRANCH"
+PS_TIME="\[\033[\$((COLUMNS-10))G\] $RED[\t]"
+export PS1="\${PS_FILL}\[\033[0G\]${PS_INFO} ${PS_GIT}\n${RESET}\$ "

+ 24 - 11
nvim/init.vim

@@ -1,8 +1,6 @@
 syntax on
 filetype plugin indent on
 
-
-
 " Plugins
 call plug#begin('~/.vim/plugged')
 	Plug 'chriskempson/base16-vim'
@@ -10,6 +8,9 @@ call plug#begin('~/.vim/plugged')
 	Plug 'neovim/nvim-lspconfig'
 	Plug 'nvim-lua/completion-nvim'
 	Plug 'kaicataldo/material.vim', { 'branch': 'main' }
+    Plug 'nvim-lua/popup.nvim'
+    Plug 'nvim-lua/plenary.nvim'
+    Plug 'nvim-telescope/telescope.nvim'
 call plug#end()
 
 " General vim configurations
@@ -29,13 +30,28 @@ set nu
 set hidden
 set undodir=~/.config/nvim/undodir
 set undofile
+
+
+"  Theme settings
+"  https://github.com/kaicataldo/material.vim
+if (has('termguicolors'))
+  set termguicolors
+endif
+let g:material_theme_style = 'darker'
+colorscheme material
+
+
 " Lsp configuration for multiple languages
 lua require'lspconfig'.bashls.setup{}
 lua require'lspconfig'.jsonls.setup{}
-lua require'lspconfig'.jedi_language_server.setup{on_attach=require'completion'.on_attach }
+lua require'lspconfig'.pyls.setup{ on_attach=require'completion'.on_attach }
 lua require'lspconfig'.gopls.setup{ on_attach=require'completion'.on_attach }
 lua require'lspconfig'.rust_analyzer.setup{ on_attach=require'completion'.on_attach }
 lua require'lspconfig'.clangd.setup{ on_attach=require'completion'.on_attach }
+
+" auto complete matching strategy
+let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
+
 " Use <Tab> and <S-Tab> to navigate through popup menu
 inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"
 inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
@@ -44,14 +60,6 @@ inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
 " Avoid showing message extra message when using completion
 set shortmess+=c
 
-"  Theme settings
-"  https://github.com/kaicataldo/material.vim
-if (has('termguicolors'))
-  set termguicolors
-endif
-let g:material_theme_style = 'darker'
-colorscheme material
-
 
 " Tree-sitter config
 lua require'nvim-treesitter.configs'.setup { highlight = { enable = true } }
@@ -61,3 +69,8 @@ let mapleader = " "
 nnoremap <leader>n gt
 nnoremap <leader>m gT
 
+" Telescope shortcuts
+nnoremap <leader>ff <cmd>Telescope find_files<cr>
+nnoremap <leader>fg <cmd>Telescope live_grep<cr>
+nnoremap <leader>fb <cmd>Telescope buffers<cr>
+nnoremap <leader>fh <cmd>Telescope help_tags<cr>