Git Product home page Git Product logo

dotfiles's Introduction

Dotfiles

Sections

  • Setting up
  • Common Problems

1. Setting up

1.0 (optional) change the default keyboard settings

  • change the keyboard layout to "English (intl, with AltGr dead keys)"
  • swap the escape key with the caps lock key (gnome-tweaks should allow that)
  • swap the left alt key with the left ctrl key (gnome-tweaks should allow that)
  • create a keyboard shortcut for "Switch windows directly" and map it to Ctrl+Space

1.1. Clone this repository

$ cd <wherever_you_want_to_store_this>
$ git clone [email protected]:HeitorBoschirolli/dotfiles.git

1.2 Create a soft link for the bashrc

The general form of the command:

$ ln -s <absolute_path_to_dotfiles>/bash/.bashrc $HOME/

An example:

$ ln -s $HOME/dotfiles/bash/.bashrc $HOME

Restart the terminal to apply the changes.

1.3. Install neovim

The safest way to install neovim is to follow what's described in their documentation. Here I will describe how to do it using an appimage, it always worked fine for me.

Download the appimage of the desired version here.

Rename it to "nvim"

$ mv nvim.appimage nvim

Allow it to be executed:

$ chmod +x nvim

Move it to "/usr/bin" (sudo required)

$ sudo mv nvim /usr/bin

1.4. Install vim-plug (other plugin managers should work fine as well)

Follow the instructions described here. Be careful not to install it for vim, there's both a vim and a neovim version!

1.5. Create a directory for the neovim configuration

$ mkdir ~/.config/nvim

1.6. Create a soft link for the neovim configuration file

The general form of the command:

$ ln -s <absolute_path_to_dotfiles>/nvim/init.vim $HOME/.config/nvim/

An example:

$ ln -s $HOME/dotfiles/nvim/init.vim $HOME/.config/nvim/

1.7 Create a soft link for coc-settings.json

The general form of the command:

$ ln -s <absolute_path_to_dotfiles>/nvim/coc-settings.json $HOME/.config/nvim/

An example:

$ ln -s $HOME/dotfiles/nvim/coc-settings.json $HOME/.config/nvim

1.8 Install xclip

Your system's package manager should have xclip.

An example (Ubuntu 20.04):

$ sudo apt update
$ sudo apt-get install xclip

1.9. Install nodejs

If you use nodejs for development you might prefer to install it via the node version manager (NVM). The method described here will not use NVM since it's simpler and I don't use nodejs for development (at least at the time of writing this).

$ curl -sL install-node.now.sh/lts | bash

note: restarting the terminal might be necessary

In case of permission problems with npm, do:

$ sudo chown $USER <the_directory_with_permission_problems>

1.10. Install the "neovim" package for nodejs

$ npm install -g neovim

1.11. Install pip

Your system's package manager should contain pip.

An example (Ubuntu 20.04):

$ sudo apt install python3-pip

1.12. Install the "neovim" package for python

$ pip3 install neovim

1.13. Install CoC extensions

From inside of neovim, run:

:CocInstall coc-eslint

and

:CocInstall coc-json

and

:CocInstall coc-tsserver

1.11. Install a nerd font

The safest way to install any nerd font is to follow what's described in their documentation. Here I will described a method that worked to install JetBrainsMono at the time of writing. I think any nerd font will work.

Clone the nerd-fonts repository wherever you want and run the install script:

$ cd <wherever_you_want>
$ git clone --depth 1 [email protected]:ryanoasis/nerd-fonts.git
$ cd nerd-fonts
$ ./install JetBrainsMono

1.12. Install tmux

Your system's package manager should have tmux.

An example (Ubuntu 20.04):

$ sudo apt update
$ sudo apt-get install tmux

1.13. Soft link the tmux configuration files

$ ln -s <absolute_path_to_dotfiles>/tmux/.tmux.conf $HOME/
$ ln -s <absolute_path_to_dotfiles>/tmux.tmux.conf.local $HOME/

1.14. Install powerline fonts

The safest way to install the powerline fonts is to follow what's described here. That should always be up to date.

I never had problems installing it using apt nor dnf:

$ sudo apt update
$ sudo apt-get install fonts-powerline

1.15. Soft link bash_profile

$ ln -s <absolute_path_to_dotfiles>/bash/.bash_profile $HOME/

2. Create a python project using the language server

Depending on what you use to manage the virtual environments some configuration might change. Here I will describe the step by step to create a python project using poetry to manage the virtual environments.

2.0. Install poetry

Follow the installation instructions from poetry's documentation

2.1. Create the project

$ mkdir demo_project
$ cd demo_project
$ poetry init

2.2. Add flake8

You can use another linting tool for your project, flake8 is just an example

$ poetry add flake8

2.3. Add the language server

$ poetry add --dev python-language-server

2.4. Install everything into a virtual environment

$ poetry install

The output from this command will be used in future steps, so we need to save some info from it. The output should look something like this:

Recreating virtualenv pomodorus-zdbNqdz1-py3.6 in <path_to_a_virtual_env>
Installing dependencies from lock file


Package operations: 30 installs, 0 updates, 0 removals

  - Installing markupsafe (1.1.1)
  - Installing zipp (1.2.0)
  - Installing click (7.1.2)
  - Installing importlib-metadata (1.6.1)
  - Installing itsdangerous (1.1.0)

The important information is <path_to_a_virtual_env>. Store it somewhere.

2.5. Configure CoC

Create a directory named .vim inside demo_project/

$ mkdir .vim

Open neovim

$ nvim

Run :CocLocalConfig

Use whatever configuration you want. Here's an example:

{
    "languageserver": {
        "python": {
            "command": "/home/hboschirolli/.cache/pypoetry/virtualenvs/pomodorus-zdbNqdz1-py3.6/bin/python",
            "args": [
                "-mpyls",
                "-vv",
                "--log-file",
                "/tmp/lsp_python.log"
            ],
            "trace.server": "verbose",
            "filetypes": [
                "python"
            ],
            "settings": {
                "pyls": {
                    "enable": true,
                    "trace": {
                        "server": "verbose"
                    },
                    "commandPath": "",
                    "configurationSources": [
                        "flake8"
                    ],
                    "plugins": {
                        "jedi_completion": {
                            "enabled": true
                        },
                        "jedi_hover": {
                            "enabled": true
                        },
                        "jedi_references": {
                            "enabled": true
                        },
                        "jedi_signature_help": {
                            "enabled": true
                        },
                        "jedi_symbols": {
                            "enabled": true,
                            "all_scopes": true
                        },
                        "mccabe": {
                            "enabled": true,
                            "threshold": 15
                        },
                        "preload": {
                            "enabled": true
                        },
                        "pycodestyle": {
                            "enabled": true
                        },
                        "pydocstyle": {
                            "enabled": false,
                            "match": "(?!test_).*\\.py",
                            "matchDir": "[^\\.].*"
                        },
                        "pyflakes": {
                            "enabled": true
                        },
                        "rope_completion": {
                            "enabled": true
                        },
                        "yapf": {
                            "enabled": false
                        }
                    }
                }
            }
        }
    }
}

The important part is /home/hboschirolli/.cache/pypoetry/virtualenvs/pomodorus-zdbNqdz1-py3.6/bin/python replace it with <path_to_a_virtual_env> obtained in a previous step.

Restart neovim

2.6. Configure flake8

Any valid configuration will work. As an example you can place the code bellow in a file named .flake8

[flake8]
max-line-length = 80

# ignored rules:
# W503: Line break occurred before a binary operator. This goes against PEP8.
# C901: Function is too complex. I just don't care whether the function have
# too many ifs.
ignore = W503, C901

# count the number of occurrences of each error/warning code and print a report
statistics = true

# print the source code generating the error/warning in question
show-source = true

With this the CoC linter should work in your project

Common Problems

[vista.vim] Error when calling CocActionAsync...

This happens when CoC (os vista, idk) tries to load a language server for an invalid filetype. There's no harm caused by this error message.

dotfiles's People

Contributors

heitorboschirolli avatar

Watchers

James Cloos avatar

dotfiles's Issues

Powerline-like plugin

Install and configure a powerline-like, some options are:

  • poweline (too heavy, try to avoid it)
  • lightline
  • airline
  • I think there is a nerdtree-line

Things to consider:

  • integration with dev-icons
  • integration with coc-nvim
  • integration with git

Test nerdtree-git-plugin refreshing times and icons

nerdtree-git-plugin is poorly configured, the default icons are rather ugly and I don't know if the statuses update right after git-reset, git-add, etc. operations (which says a lot about how much I actually use the plugin). Consider removing the plugin.

Minimum config (if you choose to keep the plugin):

  • fast status update after git-reset, git-add, etc. operations
  • nerdicons instead of the default ones

py and js snippets

Create function snippets for python and javascript functions. The snippets must include a function description.

Error updates with CoC are slow

To reproduce open CRM, write an incorrect line and update the line. Sometimes the line takes too long to update or erase the error message and sign. It might be a problem with CoC or with nvim updates.

Js and python syntax highligh

The syntax highlight comes as default, but some keywords are not highlighted. Apparently there are some language-specific plugins to solve that, the one I tried for javascript changed the theme's color which is not ideal. It would be necessary to look for a syntax highlight plugin that does not corrupt Gruvbox colors. Looking into other people's vim files might be a good way to find that.

Spell check

Neovim (and probably vim as well) already have a spell check option (:set spell), but some project-specific words will be marked as incorrect, vs-code have an option to add custom words for the project folder or globally (for the user). Find something similar for Neovim.

Nerd commenter plugin

Install nerd-commenter (I think that's the name) plugin.

Minimum configuration:

  • toggle comments, i.e. if used on a block already commented it should uncomment it.
  • work for python
  • work for javascript
  • work for c++
  • work for yaml
  • work for Dockerfiles

obs: making it work for Dockerfiles might be tricky because they can be named Dockerfile.dev or Dockerfile-dev and vim do not classify files fs those name as Dockerfile filetype. Worst case scenario you can develop your own version of the plugin and use a file name like Dockerfile* to trigger the autocmd

fuzzy finder plugin

I know for sure that fzf works great, but it's best to check ripgrep as well. As far as I know, they are complementary.

Javascript linter's false positives

eslint-coc displays some warnings incorrectly, as far as I know, it only occurs on import statements. The same issue occurs with vs code, so it might be a problem with the extension.

Possible solutions are:

  • configure the extension to find the imports properly.
  • replace coc-eslint or coc-tsserver with an LSP client.
  • replace coc with a different extension.

kj mapping not working after ":set paste"

After a ":set paste" the insert mode seems to be different from the standard insert mode, it's a "paste insert mode". the "kj" mapping must be adapted to work in this "paste insert mode" as well

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.